12

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.

1 Answers1

28

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.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • oh! ok. That would mean I need to manually translate that raw text file in the language I want to support. I thought there would be some way by which I can get automatic translation depending upon the language set in user's device settings. – Piyush-Ask Any Difference Jun 26 '13 at 16:58