0

Resource Localization is a tool for android developers that helps them support multiple users with different locales. For instance, if I want to display different names for French and Italian users I must include the following lines in their respective directories.

In res/values-fr/strings.xml

<string name="my_app_name">Mon programme</string>

and in res/values-it/strings.xml

<string name="my_app_name">Il mio programma</string>

The application decides which string to show, based on the device locale. It can also be chosen by the programmer explicitly.

There are always a number of languages that we don't want to use. Is is possible to appoint each of these languages to a color (for instance one for teal and one for orchid) and allow the user to select their desired color theme in the program?

In res/values-xx/strings.xml where xx is a language I don't want to use, I will have

<color name="my_background">#008080</color> <!-- Teal -->

and in res/values-yy/strings.xml I will have

<color name="my_background">#DA70D6</color> <!-- Orchid -->

In the application I can alternate between these two by user's choice. Can I use this scheme to implement having different color themes in the application? If not, what's a good solution?

Community
  • 1
  • 1
mehrdadjg
  • 384
  • 1
  • 11
  • The answer is yes, and you pretty much explained how to do it. If you show the relevant parts of your code, where you want to use the color, and how, we might be able to help more – Gavriel Feb 03 '16 at 09:11
  • I was wondering if there was a more appropriate way to handle this task, for instance a dedicated library. – mehrdadjg Feb 03 '16 at 09:17
  • There might be. "If you show the relevant parts of your code, where you want to use the color, and how, we might be able to help more" – Gavriel Feb 03 '16 at 09:25

0 Answers0