4

I'm implementing an app in Hebrew, and I like it to be user-friendly in such way that at the first time the user logs on, there will be a question "Are you a male or a female?". After answering this question, I want most of the strings to be gender-dependent

(E.g. in Hebrew the question "Would you like some coffee?" will be

תרצה לשתות קפה?

for a male, and -

תרצי לשתות קפה?

for a female)

Meanwhile my app supports English and Unisex-Hebrew Locales, so I'm using String resources (like R.string.somevalue) and I know how to handle values-he and values-en.

Let's say I can ask for is_male() and is_locale_hebrew() at anytime, I saw this answer but it won't help my case since there are a hell lot of strings in my working-already app and I want the solution to add only xml files (hopefully) with the less needed change in my "Activity"s code. I thought maybe overloading the parser that looks for the xml files will do the magic, but I have no clue where to start from.

My question divides into two parts:

A. How can I implement gender-dependnt String-resources?

B. (Opt) Some of the string-resources are good as unisex right now, is there any option to avoid copying those resources to the 2 new gender-dependent files and just add a default behavior of "if you don't find a string resource at values-he-male search for it in values-he"?

Thanks in advance!

Re'em

Community
  • 1
  • 1
Re'em
  • 1,869
  • 1
  • 22
  • 28

1 Answers1

0

Same question for me. I plan to have (in addition to the default string.xml in English) iw (for male) and iw_fe (for female). When the user selects his/her gender, I will change the locale (Set Locale programmatically )

As for using default values in Hebrew, I am still clueless. For now I will simply copy the Hebrew XML and change the required entries, leaving all the rest intact.

HTH Noam

Community
  • 1
  • 1
noam cohen
  • 87
  • 1
  • 6