I have a Spinner
with three language choice on login page. I want when user choose one language suppose "Persian" language the language of whole application should change. I am able to change language of current Activity
only. How can I change the language of whole application.
Check into the modules, you will get to see all apps list that is installed on your Android phone. Step 4: Select one of the app which you want to edit the language. With the help of the app interface, choose the desired language from the given options and click on the confirm button.
In the Preferences menu -> Editor -> Spelling : You can add a custom dictionary. Your language.
First things first; add a second language to your Windows system. On Windows 10, you can add a second language from the Settings app. Go to the Time & Language group of settings and select the Region & Language tab. Click Add language and select the one you want to add. You may have to restart Windows to complete the process.
In order to change the language of a given application independently of the operating system language you need to edit its resources. Just go through the following steps: Go to C:\Program Files or C:\Program Files (x86) on Vista. Locate and open the directory of the application you want to change the language of.
Now, we are ready to add a new language to our app. Follow the below steps to do so: 1 Right Click on res > New > Android Resource File 2 Put the file name as strings.xml 3 Select the option of Locale More ...
Long before Windows 7, users could add multiple languages and easily switch between them. Switching between a language, or toggling between languages if you have more than 2 configured is pretty easy. You can use the Left Alt + Shift keyboard shortcut to change languages on the fly.
Change Language Programmatically in Android
Here is the appropriate way of changing the locale of the application:
There are some difficulties which you have to overcome to change the language programmatically.
1.)Your application will not remember your language change after it is closed or recreated during the configuration change.
2.)You should update currently visible UI properly according to the selected language.
Solution
“LocaleHelper
” is the solution all you need. You just have to initialize locale on your application’s main class. After that all your language changes will persist.
After the recent changes in Android API Version 24(Nougat) we need to override attachBaseContext to reflect changes.
Below method used to change language for application :
private static boolean updateResources(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
find more details in below link :
Changing Android’s Locale Programmatically
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With