|
 |
aspx thread: Creating satellite assemblies
Message #1 by "Ros Lee" <rosl@p...> on Wed, 19 Dec 2001 23:17:43
|
|
Could not find any resources appropriate for your culture or the neutral
culture in your assembly. baseName: Language.string locationInfo: <null>
resource file name: Language.string.resources assembly: _pphfhpq,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Message #2 by "Ros Lee" <rosl@p...> on Thu, 20 Dec 2001 01:58:28
|
|
I am trying to create a multilingual application named Language. I have
created resource files (string.<culture>.resources) from string.txt using
ResGen, for three cultures, and used the Assembly Linker to put them into
satellite assemblies, creating Language.Resources.dll in the corresponding
subfolders in the bin folder (de, fr and de-AT).
Could any one tell me :
When I create the main assembly, is the 'fallback' resource file compiled
into the main dll. I assume that it is, but I am wondering whether I need
to create a Language.Resources.dll file using AL.exe to go in the bin
folder for my main asssembly.
I am using the following code to try and access the resources. I keep
getting this message :
Could not find any resources appropriate for your culture or the neutral
culture in your assembly. baseName: Language.string locationInfo: <null>
resource file name: Language.string.resources assembly: _pphfhpq,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
It seems to be looking for locationInfo - why is it null and how does it
get a value?
Which folder should my neutral culture resources file be in when I build
the application?
I am a new programmer and there's a lot of stuff I don't know about
assemblies etc. If any one can help me I'd be very grateful. Am I using
the Resource Manager correctly to look in the resource
file "string.resources". For this example I have hard coded in the
current culture I want to use.
Dim Resources As ResourceManager
CurrentCulture = "de-DE"
Thread.CurrentThread.CurrentCulture() = New CultureInfo
(CurrentCulture)
Resources = New ResourceManager("string", Me.GetType
().Assembly)
Me.Button1.Text = Resources.GetString("txtSearch")
Me.Button2.Text = Resources.GetString("txtWelcome")
Message #3 by "Ollie Cornes" <lotsofemail@c...> on Thu, 20 Dec 2001 10:38:55 -0000
|
|
From: "Ros Lee" <rosl@p...>
>
> When I create the main assembly, is the 'fallback' resource file compiled
> into the main dll. I assume that it is, but I am wondering whether I need
> to create a Language.Resources.dll file using AL.exe to go in the bin
> folder for my main asssembly.
I use Visual Studio .NET that does all this for me, so my advice will be
patchy I'm afraid. For example, I'm not sure whether you need to use al.exe
to get the default resources into the main assembly.
> It seems to be looking for locationInfo - why is it null and how does it
> get a value?
I suggest a couple of things that might be worth a try:
1. Change your code to work with..
System.Threading.CurrentThread.CurrentUICulture
I think I'm right in saying that it is CurrentUICulture that specifies the
culture used for resource files, not CurrentCulture.
2. Get a copy of Reflector for .NET from Lutz Reoder's site and have a look
in your assembly to see if there are any resources in there. Reflector is
like a microscope for assemblies, it lets you see what's inside.
http://www.aisto.com/roeder/dotnet/
> Which folder should my neutral culture resources file be in when I build
> the application?
They should be compiled into the assembly - the neutral resources aren't be
in a satellite assembly.
> Dim Resources As ResourceManager
> CurrentCulture = "de-DE"
> Thread.CurrentThread.CurrentCulture() = New CultureInfo
> (CurrentCulture)
> Resources = New ResourceManager("string", Me.GetType
> ().Assembly)
> Me.Button1.Text = Resources.GetString("txtSearch")
> Me.Button2.Text = Resources.GetString("txtWelcome")
OK, well your code looks a little different from mine, so it might be worth
looking at that. Here's a piece from a working app I have:
ResourceManager res = new
ResourceManager("MyNamespace.MyResources",Assembly.GetExecutingAssembly());
string text = res.GetString(textName);
In my project is an XML resource file called MyResources.resX. Notice how
that name is referenced (without the ".ResX") in the constructor and how the
namespace is bolted on the front.
If you need more help, I'd recommend you sign up to this mailing list where
there's a whole bunch of people who know loads about localization.
http://www.asplists.com/asplists/aspngreg.asp
Ollie
--
ollie@c...
.NET Books - http://www.cornes.org/books/
|
|
 |