Globalization of ASP.NET applications problem

R

Rob Garfoot

I'm hoping someone here can help with this one as I've
been looking all around for a solution to this and I've
yet to find one that is satisfactory.

I'm trying to add support for different languages to my
ASP.NET project. I have read the docs in MSDN and several
sites and newsgrops but still can't get this working as
advertized.

I have created string resources in both a .txt and a .resx
and get the same results with both. I have tried using
VS.NET to compile the satellite assemblies for me and I
have built them myself.

I have the following problems:
When I let VS.NET build my .resx files by adding them to
the project, it correctly creates the satellite assemblies
and places them in bin/en-GB/appname.resource.dll and
thats fine. However when I use ildasm to look at the dll I
see that the name of the resource section is the fully
qualified namespace of my app with the culture on the end.
I have no problem with using the full app name but the
culture should not be there from what I've seen since I
have to specify this name on the constructor to
ResourceManager and I want multiple cultures. This means
given that I have a resx called strings.en-GB.resx and
assuming a namespace of Namespace.Something.App I have to
create a resource manager like this:

new ResourceManager("Namespace.Something.App.strings.en-
GB")

which is not good. I can get around this problem by
manually building using resgen and al but from what I see
this should work without the en-GB on the end.

The second, and probably more major problem since I cannot
get around it, is that when I write code that matches all
of the examples it looks like the satellite assemblies are
not being found.

Assembly a = Assembly.GetExecutingAssembly();
ResourceManager rm = new ResourceManager("myapp", a);
errorMsg.Text = rm.GetString("PAGE_ERROR");

I've checked that the current UI and thread culture is en-
GB but nothing is being retrieved from the en-GB
satellite. Its as though it cannot be found and it falls
back to culture neutral.

When I try this explicitly setting the satellite it works
fine eg.

Assembly a = Assembly.GetExecutingAssembly
().GetSatelliteAssembly(CultureInfo.CurrentUICulture);

Its as though the resource manager is not looking up the
satellite assembly. Obviously I don't want to have to use
code like the above since I'd have to have different
resource managers for each culture which sort of defeats
the point. I've been over this so many times now, I must
be missing something obvious but I can't see what it is.

Hopefully someone can help me with one or both of these
problems. Preferably the latter if they can but both would
be nice.

Thanks

Rob Garfoot
 
R

Rob Garfoot

Ok I've got this working now, I have absolutely no idea
what I did but it works.
 
M

Michael

Ok I've got this working now, I have absolutely no idea
what I did but it works.

Does it work on another server than the one you are developing on?


Michael
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top