improve(i18n): move translations to their own module, use i18n from habitrpg-shared, @djuretic i have remove the tests because the code is now handled in habitrpg-shared, we may add them back there

This commit is contained in:
Matteo Pagliazzi
2014-03-05 16:43:00 +01:00
parent 4990a6d0e1
commit 8ec69b4f83
5 changed files with 110 additions and 124 deletions

View File

@@ -28,30 +28,4 @@ describe('Root Controller', function() {
expect(scope.contribText({level: 8, text: 'Blacksmith'}, {npc: 'NPC'})).to.eql('NPC');
});
describe('i18n', function(){
var t = env.t;
beforeEach(function(){
env.translations = {
"text1": 'translatedText1',
"text2": '<%= number %> eggs',
"stringNotFound" : "String '<%= string %>' not found.",
};
});
it('translates strings', function(){
expect(t('')).to.eql("String '' not found.");
expect(t('text1')).to.eql('translatedText1');
expect(t(' text1 ')).to.eql("String ' text1 ' not found.");
expect(t('text3')).to.eql("String 'text3' not found.");
});
it('interpolates strings', function(){
expect(t('text2', {number: 2})).to.eql('2 eggs');
expect(t('text2', {number: 'ten'})).to.eql('ten eggs');
expect(t('text2', {n: 10, number: 'ten'})).to.eql('ten eggs');
expect(t('text2')).to.eql('<%= number %> eggs');
});
});
});