Articles → Android → Support Multiple Languages In An Android Application
Support Multiple Languages In An Android Application
Scenario
Steps
- Add a new strings file in values folder.
- Add a string for French language.
- Add a textview in main activity that displays the text.
- Run the application with default language settings.
- Run the application with French language settings.
Add A New Strings File In Values Folder
- Right-click on values folder and go to New Values resource file
Click to Enlarge
- Following window will appear
Click to Enlarge
- Enter the file name as strings
- Select the ‘Available qualifiers’ as ‘Country Code’ using ‘>>’.
- Once you click on ‘>>’ button, your window will become like this
Click to Enlarge
- Here you can enter mobile country code (208 for French) and rename the ‘Directory Name’ as ‘values-fr’ and click on Ok.
Click to Enlarge
Add A String For French Language
Click to Enlarge
Add A Textview In Main Activity That Displays The Text
Click to Enlarge
Run The Application With Default Language Settings
Click to Enlarge
Run The Application With French Language Settings
Click to Enlarge