简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM