Addev
Addev

Reputation: 32253

Remove a string in all the languages Android

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?

Upvotes: 25

Views: 8568

Answers (5)

Yvgen
Yvgen

Reputation: 2212

Now you can do it easily with Translations Editor. To open it click on the Open editor on the top right corner in xml file. Then in the editor right click on key you are want to delete and press Delete Keys(s)

Upvotes: 3

Said Erraoudy
Said Erraoudy

Reputation: 1559

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

Upvotes: 0

Dmitry Ognev
Dmitry Ognev

Reputation: 906

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

enter image description here

Upvotes: 46

Enyby
Enyby

Reputation: 4430

  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'

Upvotes: 15

Marcin Orlowski
Marcin Orlowski

Reputation: 75635

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.

Upvotes: 0

Related Questions