-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support backslash based escaping for placeholders #78
base: master
Are you sure you want to change the base?
Conversation
Can you rebase this to get rid of the conflict? |
dcc4562
to
827ca13
Compare
@@ -142,7 +142,7 @@ | |||
source = 'i18n/' + $.i18n().locale + '.json'; | |||
locale = $.i18n().locale; | |||
} | |||
if ( typeof source === 'string' && | |||
if ( typeof source === 'string' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What changed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange. dont know.
The simpleParse method of parser, which get invoked if message contains only placeholders, was not supporting escaped placeholders(\\$10) The light weight versio of jquery.i18n when parser.js not included also has the same fix now. Add support for that and add tests. Updated the documentation in README.md too Fixes issue wikimedia#74
} ); | ||
assert.strictEqual( | ||
$.i18n( 'This message key does not exist' ), | ||
'This message key does not exist', | ||
'This message key does not exist' | ||
); | ||
assert.strictEqual( $.i18n( 'Hello $1', 'Bob' ), 'Hello Bob', 'Parameter replacement' ); | ||
assert.strictEqual( | ||
$.i18n( 'Price of {{PLURAL:$1|an item|$1 items}} is $2, you get \\$2 discount', 5, 2000 ), | ||
'Price of 5 items is 2000, you get $2 discount', 'Parameter replacement with dollar sign escaped, not parsed using simplePaser' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The third param should be on its own line.
Rebase needed. |
The simpleParse method of parser, which get invoked if message contains
only placeholders, was not supporting escaped placeholders($10)
The light weight versio of jquery.i18n when parser.js not included
also has the same fix now.
Add support for that and add tests.
Updated the documentation in README.md too
Fixes issue #74