Permalink
Browse files

added test case

  • Loading branch information...
jamuhl committed May 29, 2012
1 parent ca905a6 commit 1644ea0d28ca58539ed7598512ab92a34b27470a
Showing with 5 additions and 3 deletions.
  1. +1 −1 i18next-1.3.1.js
  2. +1 −1 i18next-1.3.1.min.js
  3. +3 −1 test/test.js
View
@@ -252,7 +252,7 @@
if (typeof value === 'object') {
str = applyReplacement(str, value, key);
} else {
- str = str.replace([o.interpolationPrefix, nestedKey ? nestedKey + '.' + key : key, o.interpolationSuffix].join(''), value);
+ str = str.replace(new RegExp([o.interpolationPrefix, nestedKey ? nestedKey + '.' + key : key, o.interpolationSuffix].join(''), 'g'), value);
}
});
return str;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -173,7 +173,8 @@ asyncTest("extended functions", function() {
nesting3: '3',
pluralTest: 'no plural',
pluralTest_plural: 'plural',
- interpolationTest: 'added __toAdd__'
+ interpolationTest: 'added __toAdd__',
+ interpolationTest2: 'added __toAdd__ __toAdd__ twice'
}
}
}
@@ -183,6 +184,7 @@ asyncTest("extended functions", function() {
equals(t('pluralTest', {count: 1}), 'no plural', 'call plural with count = 1');
equals(t('pluralTest', {count: 2}), 'plural', 'call plural with count = 2');
equals(t('interpolationTest', {toAdd: 'something'}), 'added something', 'insert variable into resource');
+ equals(t('interpolationTest2', {toAdd: 'something'}), 'added something something twice', 'insert variable into resource');
start();
});

0 comments on commit 1644ea0

Please sign in to comment.