[Mono-list] Multi-langual Assemblies
Gonzalo Paniagua Javier
gonzalo@ximian.com
Sat, 23 Aug 2003 18:29:39 +0200
El sáb, 23-08-2003 a las 15:29, Giuseppe Greco escribió:
> Hi all,
>
> I've statically linked resources in different languages to
> my assembly (myApp.en-US.resx, myApp.de-DE.resx, etc.).
>
> The question is, how can I get my error messages in another
> language than English?
>
> For test purposes, I've just tried to put the following
> lines at the beginning of my app:
>
> Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
> Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
Setting CurrentUICulture is enough.
>
> Despite that, I always get the error message in English. English
> resources have been linked like this:
>
> -res:en-US/myApp.en-US.resources,myApp.resources
You gotta add German resources like:
-res:de-DE/myapp.de-DE.resources,myApp.de-DE.resources
Then:
ResourceManager rm = new ResourceManager ("myApp",
Assembly.GetExecutingAssebly ());
Console.WriteLine (rm.GetString ("id_of_the_string"));
The id_of_the_string shoule be that way if you use MS resource format,
but you can use .po and other formats that allow using spaces
(monoresgen.exe).
-Gonzalo