-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Issue with [prepend] and [append] attributes #19
Comments
I have made few changes in jquery-i18next.js starting line no: 67 in my local to fix this: Old Code: New Code:
Can you please suggest if this is a valid fix or do you have any other proper fix or suggestions? Thanks, |
seems valid. If you like you can provide a PR changing both prepend and append. |
Hi @jamuhl , Sorry I cannot raise a PR as I don't have access to git installed on my pc at office due to securoty reasons and even I cannot clone git repo due to network proxy. May be you can please go ahead and make the necessary changes as suggested for prepend and append attributes. Hope it is fine. Thanks, |
published jquery-i18next@1.0.0 |
cool thanks 👍 |
Hi @jamuhl, There seems to be a small glitch in the fix as I am not trimming the spaces in the key when I am actually trying to find the element but I did so when I am actually assigning the id which could cause the problem. PF link of screenshot for the changes required for the same and I am also adding the code changes below for the full function parse starting line no: 43.
May be you can move this fix once you publish the next version. Thanks, |
published jquery-i18next@1.0.1 |
Hi @jamuhl , The fix for that issue was to use the below lines of code: Actually I found the issue the day after I posted the fix for this issue but was busy to post the fix here. Please update the lines of code in jquery-i18next.js with below 2 lines of code(line no's : 47 and 48): // Removing any spaces and any invalid special characters in key for valid html5 id var trimmedKey = key.replace(/[^a-z0-9-_:.]|^[^a-z]+/gi, ""); Thanks, |
Hi @jamuhl ,
I noticed that there is an issue with prepend and append attributes. Each and every time the language is switched it is prepending or appending the same content again and again.
For ex:
<div data-i18n="[prepend]information"> is wealth.</div>
Suppose if my app is supporting 2 languages English and German then each time I change the language it is prepending the same text in the chosen language each time I change the language.
Actual Output (Switched the language from English to German 4 times):
GE - Information. Information GE - Information. Information GE - Information is Wealth
Expected Output:
GE - Information is Wealth. (If language chosen is German)
Information is Wealth. (If language chosen is German)
I actually took a look at the source code and for prepend and append in jquery-i18next.js line no: 67 and I found that it doesn't have any intelligence of finding the already prepended/appended element and then just localize it but instead each time it actually prepends or appends to the element content which is actually causing the issue.
The text was updated successfully, but these errors were encountered: