-1

I have a multilanguage application that uses the standard xml files to provide string values in different laguages.

...
res/values/strings.xml
res/values-es/strings.xml
res/values-pt/strings.xml
...

What I want to do is override the normal behavior of Android to look for a resource somewhere else before looking into the standard xml files.

So when the code calls getResources().getString() a custom code would look into an alternative resource file before falling back into the standard getString implementation.

Is there any way to achieve this?

thanks!

dami
  • 25
  • 4
  • 1
    You could derive a wrapper class doing this call first – Trinimon Feb 27 '13 at 17:01
  • The correct question to ask is "why somewhere else"? – Simon Feb 27 '13 at 17:35
  • @André Yes, I should have added that I want to get the same functionality when using string resources from xml files, like _@string/stringKey_. – dami Feb 27 '13 at 18:22
  • @Simon Well it's an attempt to integrate a legacy i18n system that actually works on the same product on other platforms. Anyway, thanks all for your time. – dami Feb 27 '13 at 18:22

2 Answers2

2

Is there any way to achieve this?

No. For your own invocations of getString(), you can wrap those calls in your own code to check "somewhere else".

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

The part you intend to achieve is not possible as Android by default would look only i the res folder for the required resources.

Karan_Rana
  • 2,813
  • 2
  • 26
  • 35