2

Is it possible to overwrite a string resource in ANY language?

Via some gradle task/script/other "trick"? I have a library that defines a string in a lot of languages and I want to replace this with my custom one, but I can't provide all languages, so I want to overwrite all values with the default english one.

Is this possible?

Edit

Library defines following for example:

<string name="name">Default name<string> // in values/strings.xml
<string name="name">German name<string> // in values-de/strings.xml
<string name="name">Spanish name<string> // in values-es/strings.xml
// many, many more...

And I want to replace ALL names at once, I want them all to be "Default name", I don't want to define 3 languages in this example, because in my case I would have to define ~60 languages. And after a sync I may need to define new languages and may forget them...

What I tried

In my case I can define a simple string replace rule and so I tried following, without any effect though:

gradle.projectsEvaluated {
    task filter(type: Copy) {
        filter { String line -> line.replaceAll("<string name=\"name\">.*<string>", "<string name=\"name\">Default name</string>") }
    }
}
prom85
  • 16,896
  • 17
  • 122
  • 242
  • 1
    Possible duplicate of [Replace (or "Override") String in Android Library Project](https://stackoverflow.com/questions/4263259/replace-or-override-string-in-android-library-project) – Robin Vinzenz Sep 06 '17 at 07:04
  • @RobinVinzenz I added some example to show that this is not what I want – prom85 Sep 06 '17 at 07:14

0 Answers0