Remove a string in all the languages Android

纵饮孤独 提交于 2019-12-09 08:33:43

问题


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.

  1. Select string's key
  2. Click on "Remove key" button
  3. Uncheck all checkboxes in "Delete" dialog
  4. Click "OK" button in "Delete" dialog




回答3:


  1. CTRL-H
  2. select tab File Search
  3. check regular expression
  4. input \R\s*<string name="string_name">(.|\R)*?</string> and don't forget replace string_name to actual string name.
  5. file name patterns set *.xml
  6. Press Replace...
  7. Leave replace field empty.
  8. Press Preview >
  9. Check all replacement.
  10. 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

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