Nativescript: platform.device.language value caching

Created on 17 Jul 2018  路  3Comments  路  Source: NativeScript/NativeScript

If user change system language, platform.device.language, value updates only after app restart.
But if I want check this value onResume event, I have to use java.util.Locale.getDefault().getLanguage(). And thus create own cross-platform wrapper for this purpose. So presence of platform.device.language loses its meaning.
I think whether to cache this value or not, should be taken at the application level (NS should not cache it).
Perhaps the same applies to platform.device.region.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

feature android

Most helpful comment

#6082

All 3 comments

Hi @webleaf,
Thank you for the provided suggestion.
I tested your case and indeed the platform.device.language will return the initial value, while the app comes from the suspend mode and the language is changed.
Regarding that this behaviour seems to be related to a missing feature. Any PR that provides functionality for handling the language change will be highly appreciated. You can review our contributing guidelines.

issue

#6082

Was this page helpful?
0 / 5 - 0 ratings