Localization Questions

M

Matthias S.

Hi there,

on the way to create a "multilingual" site. And some probs:

To provide support for mulitple languages, I've added a new resx file to
my project (gave it the same "root" name as the project =
myproject.resx, to make it the default/fallback resource) and for
testing purpose, defined a string resource LBL_TEST with a default value
of "Hello World".

After that, I created a second resx file and named it
myproject.de-DE.resx and added the same string resource with a german
value. Whenever I now try to load this string from the ResourceManager I
get a MissingManifestResourceException telling me, that the resources
for the specified culture couldn't be found. I should make sure, it
suggests, that the resources are properly compiled/linked into the dll.

Here is the code that I'm using to load the resource-string:
ResourceManager res = new ResourceManager("myproject",
Assembly.GetExecutingAssembly());
Label1.Text = res.GetString("LBL_TEST");

When selecting the resource file in the SolutionExplorer and opening the
Properties, I see a "Namespace of the userdefined tool" (free
translation from german). I've changed this value to reflect my current
default namespace but it did not help.

Can anyone help?
 
K

Karl Seguin

Matthias, you need to specify your default projects namespace:
ResourceManager res = new ResourceManager("namespace.myproject",
Assembly.GetExecutingAssembly());

leave the "namespace of userdefined tool" blank and it'll automatically
append the project namespace....

Shameless plug...if you are serious about building a multilingual website,
take a look at this:
http://openmymind.net/index.aspx?documentId=3
and
http://openmymind.net/index.aspx?documentId=4

Karl
 

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