-
Notifications
You must be signed in to change notification settings - Fork 145
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
Could you update jquery.i18n.parser.js on line 33 for $ problem #218
Comments
In your message, where is $1? Jquery.i18n assumes placeholders in its linear order. So of you have a placeholder value "10", that is 1st placeholder indicated by $1. It does not make sense to assume it as $2. This is the reason for the assumption of $1 in parameters array. If I add extra checks there, I am afraid it will break in other places because this isa fundamental assumption about message parameters. |
@santhoshtr : I want to write the message ‘’Korean Grandma Living On $2 A Day”. I try PS. You know, Normally language file is written by not a programmer. |
@BG-Kim using the Instead, you can use the HTML code for the |
Hum… I think null and undefined checks are more written solid code.
|
HTML
<div data-i18n="HOME_FOO"></div>
JSON en
"HOME_FOO" : "Give me $2"
This is make warning follows :
jQuery.Deferred exception: Cannot read property '1' of undefined TypeError: Cannot read property '1' of undefined
Problem is jquery.i18n.parser.js simpleParse() on line 33
return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
=>
return parameters && parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
or
return parameters !== undefined && parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
I guess missing to check parameter also undefined or not.
Thank you.
The text was updated successfully, but these errors were encountered: