Problems with satellite library

F

fabrice

hello,

I nedd help to create and use Library Satellite.
I'm using Web Form under framework 1.1 and VB.NET
I'm not using Visual Studio.

I'd like to internationalize my web application with using .DLL
For the moment i test many solutions with one .aspx page to create a model.
But i'm not.


I m able to create and use .resource file and to get text for my Control.

But i'd like to pass to the next step that is to say ... to use DLL and
subdirectory in the directory \BIN of my web application.
But i nedd help, i'm lost.

These is my steps, but the method doesn't work.

I have one file index.aspx with the code behind file index.aspx.vb

Steps :
1- creating.. text files
---------------------------------
strings.txt -> langue par défaut
strings.en-NZ.txt > version en-NZ


2- then, .resource files :
------------------------------------------

resgen strings.txt strings.resources
resgen strings.en-NZ.txtstrings.resources

3- compilation of the file : index.aspx.vb embeded wtih default resource
file : strings.resources
----------------------------------------------------------------------------------------------

vbc /t:library /r:system.web.dll /r:system.dll /r:System.Data.dll
/res:strings.resources index.aspx.vb

I get a .DLL and if i copy the file in \BIN directory, all is ok and i have
the differents texts (default languauge).

4- Then, i want en-NZ language
------------------------------------------

al /t:lib /culture:en-NZ /embed:strings.en-NZ.resources
/out:index.aspx.resources.dll

I have created the subdirectory en-NZ in the directory \BIN and copied the
new file index.aspx.resources.dll.

5 - Test and out :
----------------------

To testingfor testing the language, i'm using global.asax with "Sub
Application_BeginRequest" with the following Code :

Dim ci As New CultureInfo("en-NZ")
Thread.CurrentThread.CurrentCulture = ci
ci=CultureInfo.CurrentCulture


The new culture in the page index.aspx is en-NZ. But nothing works ! i have
always the default language !! I don't understand....
The is my code in the code behin file index.aspx.vb to retrieve the text :

Dim rm As ResourceManager = New ResourceManager("strings",
System.Reflection.Assembly.GetExecutingAssembly())
usernameLabel.Text = rm.GetString("Username")
passwordLabel.Text = rm.GetString("Password")
login.Text = rm.GetString("Login")


Thanks for you help.


fabrice
 
K

Karl Seguin

Fabrice:
I always let Vs.Net compile/generate my resx files, but I still think I see
the problem, as it's a very common one.

Dim rm As ResourceManager = New ResourceManager("strings",
System.Reflection.Assembly.GetExecutingAssembly())

I'm almost sure this line above is incorrect.

It should be "DefaultProjectNamespace.string", System.Reflection...

resources automatically inherit the default namespace ofthe project :)

Also, unless I'm mistaken, you need to set the CurrentUICulture. Actually
you should set both CurrentCulture and CurrentUICUlture, but it's
specifically the CurrentUICulture which the resource manager works against.

Karl
 
F

fabrice

Hello Karl

Thanks for your answer.
and yes....i have just set the UIculture. And great ! it works. That was the
problem.

My new code is my global.asax

Dim ci As New CultureInfo("en-GB")
Thread.CurrentThread.CurrentCulture = ci
---> System.Threading.Thread.CurrentThread.CurrentUICulture = ci
ci=CultureInfo.CurrentCulture

But for the part,
Dim rm As ResourceManager = New ResourceManager("strings",
System.Reflection.Assembly.GetExecutingAssembly())...

thanks a lot.
Have a nice day.

fabrice
 

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

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top