HTML5 Mobile app localization using javascript and PhoneGap

前端 未结 3 520
粉色の甜心
粉色の甜心 2021-01-01 03:21

I\'m creating a HTML5 mobile app that runs on all 3 mobile platforms (Android, iOS a,d Windows Mobile 8). I\'m using javascript for localization(https://github.com/eligrey/l

3条回答
  •  醉酒成梦
    2021-01-01 03:46

    There's one common pitfall with localisation, maybe this is your problem:
    Many devices report locales in the form of de_DE, en_GB, etc... - note the underscore.

    l10n (or in my case, globalize.js) use a hyphen to separate language and country - thus no matching culture is found and it comes up with the default fallback.

    Put a console.log in your app to dump the locale string you are getting, then go the the console and check with adb logcat whether this might be the case on your device. Then simply modify the string to allow matching (e.g. locale.value.replace('_', '-') )

提交回复
热议问题