Replies: 2 comments 1 reply
-
Given that it requires AGP 8.1 it will require apache/cordova-android#1678 But most resources in cordova apps are web resources and can't really take advantage of the native locale system. So this will only really be useful if you have plugins that builds native views and displays text to the user at the native view layer (outside of the webview). A plugin can probably be implemented to expose the build configurations required to setup the auto locale config. Note that The webview does have an INTL API to handle formatting of text and numbers, and most JS frameworks incorporates some kind of localisation string table system. If you're trying to localize your webview content, a pure webview solution will likely be far more efficient. |
Beta Was this translation helpful? Give feedback.
-
I reply to myself. Two steps are necessary:
hook-android-before-compile.js:
Build and run your Cordova app on your phone. The app appears in the App languages menu. You can now select language only for your app. The app (or only the internal webview, I don't know exactly) restarts with a new language code. This Android 13 feature is really VERY USEFUL because there is one general method to select language for any app (provided it is properly configured). No need for other extra JS code in your Cordova apps. I've used language files in my apps so far but never (luckily!) tried to implement own in-app language picker and corresponding code. I'm not sure how to implement the automatic generation of the locales_config.xml described here https://developer.android.com/guide/topics/resources/app-languages#auto-localeconfig but for me the manual process is simple. I don't need it, but I'm not sure how to implement an in-app language picker as described here https://developer.android.com/guide/topics/resources/app-languages#api-implementation, either. |
Beta Was this translation helpful? Give feedback.
-
Hello, this is a new and VERY USEFUL feature in Android 13. Do you have any information about this feature in cordova (or cordova-android)?
https://developer.android.com/guide/topics/resources/app-languages#auto-localeconfig
Thanks
Beta Was this translation helpful? Give feedback.
All reactions