Support backslash based escaping for placeholders#78
Open
santhoshtr wants to merge 1 commit intowikimedia:masterfrom
Open
Support backslash based escaping for placeholders#78santhoshtr wants to merge 1 commit intowikimedia:masterfrom
santhoshtr wants to merge 1 commit intowikimedia:masterfrom
Conversation
Member
|
Can you rebase this to get rid of the conflict? |
dcc4562 to
827ca13
Compare
| locale = $.i18n().locale; | ||
| } | ||
| if ( typeof source === 'string' && | ||
| if ( typeof source === 'string' && |
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( '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' |
Member
There was a problem hiding this comment.
The third param should be on its own line.
Contributor
|
Rebase needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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