statelite resource assembly

K

Kelmen Wong

I'm having a real hard-time to work out the hell of the statelite
assembly.

1) At start,
the official MSDN stated to use:

.... new ResourceManager(strBaseName, Assembly.GetExecutingAssembly());
and the resource file should be named as <basename>.[culture.]resx

It didn't work (in WinApp).


2) Do some reseach, figured out should be:
.... new ResourceManager(strAssembly+BaseName,
Assembly.GetExecutingAssembly());

OK, got it work in WinApp.


3) Then attempt port to WebApp ASP.NET. Create a class assembly that
manage this task. And the hell, nothing work, either using the #2
findout or the MSDN.
Just keep on getting "Could not find any resources..." so and so.


Does anyone know what specifically need to be work out for WebApp?
 
K

Karl Seguin

Kelmen, you might be interested in my two articles about creating
multilingual websites, which provide an alternative to those satellite
assemblies:
http://openmymind.net/localization/index.html
http://openmymind.net/localization/index2.html


Also, is the error message saying anything about "appropriate for the
specified culture (or the neutral culture)". If so, the problem isn't with
the base name, the problem is that ASP.Net is running in a culture which you
don't have a resource file for. Consider creating a default resource file
(resource.resx instead of resource.en-CA.resx) for your project.

Finally, you should simply create your resource via:

new ResourceManager(ProjectNameSpace.ResourceFileName,
Assembly.GetExecutingAssembly());

Karl
 
K

Karl Seguin

About your question re recompilation and satelite assemblies, the situation
we were in was to use a default culture - which gets compiled into the
primary assembly. In retrospect, while having a default assembly is nice,
it's not worth the trouble (since it restarts the webapp). As you point
out, if you only have satelite assemblies it isn't as big a problem (still a
pita to have to recompile).

ASP.Net 2.0 will have nicer built-in support..yay!

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Kelmen Wong said:
Hello Karl, thanks for the help.

I managed to get it work as per your advise.

After review the code, I believe the proper way when instancing the
ResourceManager, the basename should be NameSpace.BaseName.

The initial findout about using ProjectName.BaseName is quite
misleading, as most WinApp we created for testing purposes will have
its namespace defaulted as the project name. It work in WinApp because
we actually using NameSpace.BaseName instead of the project name.
:)

---

I read your articles, they are very good one. But I have a question in
part 1.

You mentioned "every time the translation department wanted to change
some text, we'd need to recompile the entire application". If we adopt
the satelite assemblies approach, although we may need to recompile
the project, isn't that we only need to deploy only the satelite
assembly?

In my design, I attempt to approach the culture in 2 parts: 1 is the
core engine (the typically data-access-layer components) will adopt
the satelite approach, to store the (error) messages only used by
them. As these shouldn't subject to frequent changes.
The 2nd is the BLL (business-logic-layer, the so-called biz obj) which
will adopt the db approach, as those text will likely subject to
end-user constant maintenance.

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top