问题
I have an app with several translations, and I want to delete some strings.
How can I refactor and delete them only once for example in the default strings.xml file and automatically propagate the deletion to the other strings.xml file of other translations? Thanks
回答1:
default strings.xml file and automatically propagate the deletion to the other strings.xml file of other translations
ADT does not support this operation. You need to get rid of the text from all your XML files yourself, which should not be hard task anyway, as it would be sufficient to do project global search (in Eclipse CTRL-H), set file mask to *.xml
and search for your string key. Then just remove this file from each file found.
回答2:
You can remove all translations by "Translations Editor" in Android Studio.
- Select string's key
- Click on "Remove key" button
- Uncheck all checkboxes in "Delete" dialog
- Click "OK" button in "Delete" dialog
回答3:
- CTRL-H
- select tab
File Search
- check regular expression
- input
\R\s*<string name="string_name">(.|\R)*?</string>
and don't forget replacestring_name
to actual string name. - file name patterns set
*.xml
- Press
Replace...
- Leave replace field empty.
- Press
Preview >
- Check all replacement.
- Apply changes by press `Ok'
回答4:
This is the way that I have done to Delete a language I do not want.
1: Make a backup copy of your project.zip
2:Go to Your project folder >app>src>main>res:
In this folder, you will find all languages in the form of folders
Remove the language folder that you not want For example : values-ar-rSA
back to android studio clean your project and test
来源:https://stackoverflow.com/questions/23928615/remove-a-string-in-all-the-languages-android