Home > Back-end >  How to get current language selected in android programmatically
How to get current language selected in android programmatically

Time:11-08

This code i am trying to get current language or default language of android phone

 String language = getApplicationContext().getResources().getConfiguration().locale.getLanguage();

but i am getting always es which is english i have changes my phone language to Japanese language but then also i am getting es which is english. i am trying to apply language localisation so that on launch it will check device language accordingly it will set .

Please help me what i am doing wrong how to get current language selected of android phone .

CodePudding user response:

You don't need to write any code to localize your app's resources, if you structure your resources correctly the framework will do it for you. See Using resources for localization for a detailed description of how to achieve this.

CodePudding user response:

There are inbuilt functions which provide country and language data as follows

Locale.getDefault().getLanguage()        = en      
Locale.getDefault().getISO3Language()    = eng 
Locale.getDefault().getDisplayLanguage() = English

You can use this strings to check with your implemented locale to update app language.

  • Related