Android: How to re-use strings in multi-language resources

旧巷老猫 提交于 2019-12-21 02:48:09

问题


This one puzzles me since my first android project. Consider multi-language string resources with 'en' as the default:

res/values/strings.xml     <--- The default language 'en'
res/values-de/strings.xml  <--- de
res/values-fr/strings.xml  <--- fr
res/values-it/strings.xml  <--- it

With that folder structure the Android Market entry for this app shows language support for "default, german, french and italian only". Yes, english is missing in that list.

Is it possible to "include" the complete default strings resource from the "values" folder in an additional "values-en" folder. And yes, I don't want to maintain that file in that new folder because everything is declared in the default string resource already.

Many thanks in advance.

Harald


回答1:


I don't quite understand where the problem is. Just create a values-en directory and copy'n paste the XMLs from your default directory to the new one.

If you just want to have a kind of symbolic link to that default values directory so that when you change something inside the default directory the files i the linked directory represent the same changes then you just go to File -> New -> Folder select where the new folder should be created (in your case the res directory) and then hit on Advanced >> and there select Link to alternate location (Linked Folder) then browse to the directory you want to link to (in your case the values directory) and your done.

Now whenever you change something inside the values directory all your changes apply to the new linked directory.



来源:https://stackoverflow.com/questions/4334082/android-how-to-re-use-strings-in-multi-language-resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!