Ammar
Ammar

Reputation: 346

Android get the language & region currently used in the app regardless of the one selected in the settings

I have an android application that acts like an HTTP server and sends HTML page to the client when requested.
I have multiple translated HTML pages that I need to decide which one to send to the client based on the currently used language in the app.

The issue is that when an app has for an example the translation of ar-rEG and ar-rSA and the language in settings is set to ar-rLY the app fallbacks to ar-rEG I don't know why it decides to fallback to ar-rEG but I need to determine the correct locale for other languages as well.

using Locale.getDefault().toLanguageTag() gets me the language & region selected in settings and not the one used by the app. ConfigurationCompat.getLocales(Resources.getSystem().configuration).get(0)?.toLanguageTag() didn't help with this problem neither.

Upvotes: 0

Views: 21

Answers (0)

Related Questions