Problem accessing string resources

S

Sreekanth

Hi,
I am trying to globalize my application by separating out all the strings
into resource files. For testing purpose, I have created two resource files.
MyApp.resx, MyApp.en-US.resx. These resx files are built into binary
resource files(.resources) and embedded into MyApp.exe by my make script.

The problem, Even after setting my machine culture to English -United
states, my application is always picking from the nuetral resource file. If
I dont link MyApp.resx(default resource file) during make, it is throwing
MissingManifestResourceException. While debugging, I found that CultureInfo
am getting using CurrentThread.CurrentCulture is giving the right culture
i.e en-US. Code snippet I have used is as below.
///////////////////////////
ResourceManager aResourceManager = new ResourceManager("Namespace.MyApp",
System.Reflection.Assembly.GetExecutingAssembly());

System.Globalization.CultureInfo aCultureInfo =
System.Threading.Thread.CurrentThread.CurrentCulture;

string test = aResourceManager.GetString("test", aCultureInfo); //Is always
picking from the string from the neutral resources file. Culture specific
string is never taken.

////////////////////////////

Could you please let me know where I am doing wrong.

Thanks,
Sreekanth.
 
S

Sreekanth

When I try to call ResourceManager.GetResourceSet() for the current thread's
culture, Am getting null. Any idea why it is so?
Thanks,
Sreekanth.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top