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 EnlargeAdd A String For French Language
Click to EnlargeAdd A Textview In Main Activity That Displays The Text
Click to EnlargeRun The Application With Default Language Settings
Click to EnlargeRun The Application With French Language Settings
Click to EnlargePosted By - | Karan Gupta |
|
Posted On - | Monday, October 28, 2019 |