Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localizing raw resources in android app

I want to serve local language content in my app. I am reading a .txt file in res/raw folder using FileReader (Buffered one). I have read that Android can automatically translate text for values/strings.xml file.

Is the same possible for raw text files. I am looking for minimal code changes.

like image 734
Piyush-Ask Any Difference Avatar asked Jun 26 '13 16:06

Piyush-Ask Any Difference


1 Answers

Android does not automatically translate any files.

You as a developer can translate them and put the resources in appropriately qualified folders, like values-en, values-fr and so on.

These qualifiers work on all folders under res, including the raw folder.

No code changes are required, as Android will automatically pick the correct file upon runtime. However, you should always keep a copy in the default folder with no qualifications in case the app is run on a device for which you do not have content available.

like image 143
Raghav Sood Avatar answered Nov 16 '22 00:11

Raghav Sood