Reputation: 13
We want to implement the following requirement for localization -
We are comtemplating 2 possible approaches -
Make use of the device DB and load values from there (personally I dont like this approach very much as I am not able to predict the impact on performance. Any comments? )
Create a wrapper implementation to parse xml's and have these values stored in the specific xml.
Depending upon the language selected parse the corresponding xml and use that to populate the map. The values are then fetched from this maps (in place of android Resource file)
If anybody who has faced similar issues, can you please provide your inputs and possible approach. If there is something default in Android api that I am missing and can be used in this situation ?
Looking forward to people's input on the above.
Upvotes: 1
Views: 1787
Reputation: 2260
The problem is you need to depend on Android's ability to discover the correct localization based on locale, screen size, orientation, etc. These are conditions that are outside of your ability to influence and you don't want to try to reproduce the search logic.
Perhaps you could put a tag string in each of the individual string.xml files. This tag would have a keyword, perhaps the name of a table that is filled at runtime with your translated strings.
Upvotes: 1