ResourcesManager HELP ME!!!!

M

mastermirko

Hello,
I need help please,is 3 days that I think how do this code(I'm sorry
for my english not perfectly)...
I need an application multilanguage, I do all passage that describe
MSDN :
I write 2 files :
strings.txt
label=etichetta italiano
and strings.en.txt
label=english label
I save this file strings.txt on principal directory and sstrings.en.txt

on directory call en.
I compile this file with resgen and it create strings.resources and
strings.en.resources on respective directory.
I use VS 2005.
After I execute the command al from prompt msdos :
"al /t:lib /embed:strings.resources /out:provaSatelliteAssembly.dll"
and "al /t:lib /culture:en /embed:strings.en.resources
/out:provaSatelliteAssembly.dll"
I add the file dll to my application project.
This is my principal class Form1:
public partial class Form1 : Form
{
static ResourceManager rm = new
ResourceManager("ProvaSatelliteAssembly.strings",
Assembly.GetExecutingAssembly());
CultureInfo ci = new CultureInfo(CultureInfo.CurrentUICulture.Name);
public Form1()
{
InitializeComponent();
label1.Text = rm.GetString("LABEL",ci);
}
private void button4_Click(object sender, EventArgs e)
{
ci = new CultureInfo("en");
label1.Text = rm.GetString("LABEL", ci);
this.Refresh();
}
}

The application compile , but when I click button4, it doesn't load the

specific language culture.
It load always the language default (strings.resources).
Where is my error???
Thanks for all people that answer my question.
Mirko...
 
G

Guest

I'm not sure what you are trying to achieve, but you are not setting the
langauge at all, all you are doing is creating variables. If you want to
actually change the culture information for the application then you need to
do:

System.Threading.Thread.CurrentThread.CurrentCulture = new
System.Globalization.CultureInfo("en");

HTH

Ian
 

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

Top