Perform substitution on all parts, not just the last one
Signed-off-by: Stefan Parviainen <pafcu@iki.fi> This way the substitutions don't need to appear in the same order in the translated string.
This commit is contained in:
parent
02629d13d9
commit
414ee82582
2 changed files with 58 additions and 40 deletions
|
@ -65,4 +65,9 @@ describe('languageHandler', function() {
|
|||
expect(languageHandler._t(text, {}, { 'StartChatButton': () => <i>foo</i> }))
|
||||
.toEqual(<span>Press <i>foo</i> to start a chat with someone</span>);
|
||||
});
|
||||
|
||||
it('replacements in the wrong order', function() {
|
||||
const text = '%(var1)s %(var2)s';
|
||||
expect(languageHandler._t(text, { var2: 'val2', var1: 'val1' })).toBe('val1 val2');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue