How do u handle multi-language resource files

J

JollyK

Hello friends,

In a large asp.net project, I don't think it is a good idea for having one
common resource file containing all localized strings for the whole
application. I think a better approach would be to have individual resx
files for each form/user control.
My main problem is having difficulties in naming my resource file.
For example, suppose I have a web form called Items.aspx. I want to have a
resource file for it and name it Items.resx, but Visual Studio.net will show
an error during compilation mentioning...
Resources 'Items.aspx.resx' and 'Items.resx' have the same manifest resource
name '<Namespace>.Items.resources'.

The reason for this error is cause Visual Studio.net will always create a
resource file called 'Items.aspx.resx' automatically. Even if I delete this
autogenerated file, Visual Studio.net will re-create it. So what is
happening is that 'Items.aspx.resx' and 'Items.resx' are both clashing.

How do I solve this issue because I would like to also have a resource file
in a french version named Items.fr-ca.resx.

I would also like to hear a discussion on what would be the best approach to
deal with multi-language resource files.

Thanks..

JK
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

There are certain things where it is better to give in and do it the way MS
wants you to, which is the pageName.aspx.resx, even if you have to delete
and then drop your file in with the same name. MS does listen to feedback
and will change things over time, but you are often stuck to begin with.

If you are really stuck on having the file Images.resx, here is an idea to
try. Not sure if it will work, but it is the best shot.

1. Open ProjectName.vbproj (VB.NET) or ProjectName.csproj (C#) in notepad
2. Find the name of the resx file (the default name pageName.aspx.resx) and
change to the name you desire
3. Drop your file in the folder.
4. Open the project

The test will likely come when you add the French language file. I would do
this ASAP to see if this solution will work. If not, you are back to
pageName.aspx.resx.

If it works, post a followup.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************************************************
Think outside the box!
***************************************************************
 
J

JollyK

Hello Greg,
Your solution is very interesting, but it is not working because if I change
the name of the file in the .csproj(C#) file, VS.NET will recreate a brand
new file with aspx.resx extention.
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top