Skip to content
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

Localize not working in Cordova app on Android 6.0 #72

Closed
ArkeoSupport opened this issue Mar 14, 2016 · 3 comments
Closed

Localize not working in Cordova app on Android 6.0 #72

ArkeoSupport opened this issue Mar 14, 2016 · 3 comments

Comments

@ArkeoSupport
Copy link

I have an app that I am building using cordova, and it uses jquery localize to switch between various JSON files in order to show my pages in different languages. The functionality works fine on the web, in iOS, and in previous versions of android. But after upgrading one of my test devices to Android 6.0, the buttons to switch languages no longer work. I hooked up the phone to adb and got this output while debugging:

Here is the error that it throws when the app is first loaded:

03-14 11:51:02.702 27974-27974/? I/chromium﹕ [INFO:CONSOLE(4)] "Uncaught TypeError: Cannot read property 'replace' of undefined", source: file:///android_asset/www/app/vendor/jquery-localize-i18n/dist/jquery.localize.js (4)

And here is the error that it throws every time you click on one of the language buttons:

03-14 11:51:48.323 27974-27974/? I/chromium﹕ [INFO:CONSOLE(469)] "Uncaught TypeError: $(...).localize is not a function", source: file:///android_asset/www/app/js/arkeo-functions.js (469)

The relevant section of code that it's referencing is the LocalizeThis function from arkeo-functions.js
Here it is:
function localizeThis(lang) {
$('#checkLang em').removeClass("fa-check");
$('#checkLang em').addClass("fa-fw");
$('.' + lang + ' em').addClass("fa-check");
$("[data-localize]").localize("i18n/site", { language: lang });
localStorage.setItem('jq-appLang', lang);
}
I checked and it seems that there may be one other person having this issue with the jquery.localize plugin, but it's very recent and hasn't been resolved.

Beyond this info, I'm not sure what to do. The functionality still works on the web, in iOS, and on older versions of Android. I can't for the life of me figure out what changed. After exhaustively looking into the whitelist plugin as well as content security policies, I don't think that's it at all.

Any insights you have would be super helpful.

@shaolin405mi16
Copy link
Contributor

How about this?
#74

@ArkeoSupport
Copy link
Author

Yes, your solution worked! Thanks so much for finding a fix!

@coderifous
Copy link
Owner

Fix merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants