Help with Localization

C

CGuy

Hi,

I'm trying to develop an ASPX page that supports multiple languages.
Everything has gone well till now -

1. Created a project in VS.NET 2003
2. Added 2 resource files named Captions.resx and Captions.fr.resx for
English and French cultures respectively
3. Used the following code in the ASPX Code Behind file

resourceManager = new ResourceManager("MyProject.Captions",
Assembly.GetExecutingAssembly());
this.Label.Text = resourceManager.GetString("LABEL_CAPTION");

4. Compiled the project in VS.NET 2003. The page loads fine with the
label's caption set to English or French (depending on the Culture)

Now the problem

Since I plan to support more languages and there are going to be more
resource files (per language, per category etc), I would like to organize
them into several directories. So, I moved both my resource files into a
"Resources" directory and recompiled the project - BOOM - get a runtime
error saying:

"Could not find any resources appropriate for the specified culture (or the
neutral culture) in the given assembly. Make sure
"MyProject.Captions.resources" was correctly embedded or linked into
assembly "MyProject". baseName: MyProject.Captions locationInfo: <null>
resource file name: MyProject.Captions.resources assembly: MyProject,
Version=1.0.1361.33724, Culture=neutral, PublicKeyToken=null "

I guess the problem is due to the fact that VS.NET is unable to locate the
resx files during compilation. How do I fix this problem? Any help in this
matter is greatly appreciated.

CGuy
 
G

Grant Richins [MS]

Actually I believe the VS project system is including the directory name
into the resource name. So I would change your code correspondingly:
resourceManager = new
ResourceManager("MyProject.Resources.Captions",
Assembly.GetExecutingAssembly());
 

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

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top