Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I am pretty new to C# and using resources in Localization. My query is :

If I have some Local Resources and Global resources in my application. Suppose If i don't have a resource in my App_LocalResources folder for particular language, Will the application look for App_GlobalResource folder for that language resource ?

For example :

App_GlobalResources folder :

Myweb.en-US.resx
Myweb.hi-IN.resx

App_LocalResources folder :

Myweb.en-US.resx
Myweb.hi-IN.resx


Suppose if my hindi-Indian resx file will be missing in App_LocalResources folder,,, Is it possible, to make the application look for APP_GlobalResource 's folder if the resx file is missing in App_LocalResource folder ? If it's possible, how can we do that ?

Thank you in advance.
Posted
Updated 19-Feb-12 0:22am
v2

1 solution

It won't look at the Global resources, nor should it. "Global" in this context means global to the application (available to across pages etc) rather than a global locale.

The rule is it traverses up the tree:
e.g.
Foo.resx (default - lets say english)
Foo.hi.resx (default hindi)
Foo.hi-IN.resx ("Indian" hindi, not sure what other forms there are, but this is it!)

Let's say you access a value called Foo and your culture is set to hi-IN. First it will look at the Indian Hindi, then just the generic Hindi, then the default. So the thing to do is have the default language (e.g. American English) in the base Foo.resx file, then localize it for different dialects (e.g. British English). Then add a deafault for Hindi (probably "Indian" hindi, then localize further for Hindi dialects). This should cover pretty much all circumstances and you should be able to re-factor what you have to do what you want in the existing local mechanism.

Hope this answers your question fully!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900