Hi, I am currently trying to decide on how best to approach this subject. Obviously this is more relevant to languages other than English. I'm sure someone has tackled this before but have had no luck in finding any answer. I have started playing around with
writing my own custom resourceManager/Provider etc. classes, but I feel like it might be overkill since all i need is a tiny piece of logic determining which of 2 strings to choose. On the other hand i would definitely want to come up with a solution which
would work seamlessly with the ResourceManager and not resort to adding logic to all relevant pages in my appplication. Any thoughts or a pointer to an existing answer? Thanks in advance!
The easiest way to do this would be to simply create your own cultures, and install them on the machine running your app. These cultures would be literally clones of en-US (or whatever you're using), with absolutely no difference aside for their registered
name (a lot of cultures are implemented that way, by the way, with maybe minimal differences such as date format and thats it).
You can follow that example, but in your case, it will be even simpler. You make a new culture based on en-US, with a different name...let say, en-US-m and en-Us-f, or something, and change nothing else. Make this a command line application, that you'll
run once.
Then by simply setting the thread's UI Culture, and naming your resx files appropriately, you'll get the behavior you want. Much simpler than making your own resourceManager :)
Marked as answer by talyg on Feb 25, 2009 09:06 AM
Hi shados, thanks a lot for your reply, it indeed seems much simpler :)
I read a bit about creating custom cultures and it sounds easy enough. I have one question left:
How can i specify the fallback culture for my new culture?
What I have in mind is creating a custom culture for each relevant language and call it for instance he-IL-f,
and then make sure it falls back to he-IL. That way i could only enter in the "female" file the strings that need changing..
For example, if you have ressource files for en-CA and fr-CA (english canada and french canada), and some strings aren't found in en-CA, it will then try to find a ressource file for just en, and failing that, it will use the ressource file without any culture
(the default ressource file).
I never tried it with cultures that had 2 levels, like en-CA-f, but i'm guessing it (hopefully) will work the same way.
talyg
Member
1 Points
2 Posts
Best approach to gender aware localization
Feb 24, 2009 02:09 PM|LINK
shados
Star
12285 Points
2229 Posts
Re: Best approach to gender aware localization
Feb 24, 2009 02:57 PM|LINK
The easiest way to do this would be to simply create your own cultures, and install them on the machine running your app. These cultures would be literally clones of en-US (or whatever you're using), with absolutely no difference aside for their registered name (a lot of cultures are implemented that way, by the way, with maybe minimal differences such as date format and thats it).
http://msdn.microsoft.com/en-us/library/ms172469.aspx
You can follow that example, but in your case, it will be even simpler. You make a new culture based on en-US, with a different name...let say, en-US-m and en-Us-f, or something, and change nothing else. Make this a command line application, that you'll run once.
Then by simply setting the thread's UI Culture, and naming your resx files appropriately, you'll get the behavior you want. Much simpler than making your own resourceManager :)
talyg
Member
1 Points
2 Posts
Re: Best approach to gender aware localization
Feb 24, 2009 07:02 PM|LINK
Hi shados, thanks a lot for your reply, it indeed seems much simpler :)
I read a bit about creating custom cultures and it sounds easy enough. I have one question left:
How can i specify the fallback culture for my new culture?
What I have in mind is creating a custom culture for each relevant language and call it for instance he-IL-f,
and then make sure it falls back to he-IL. That way i could only enter in the "female" file the strings that need changing..
appreciate your help
shados
Star
12285 Points
2229 Posts
Re: Best approach to gender aware localization
Feb 24, 2009 08:00 PM|LINK
Its automatic.
For example, if you have ressource files for en-CA and fr-CA (english canada and french canada), and some strings aren't found in en-CA, it will then try to find a ressource file for just en, and failing that, it will use the ressource file without any culture (the default ressource file).
I never tried it with cultures that had 2 levels, like en-CA-f, but i'm guessing it (hopefully) will work the same way.