[MonoDevelop] Fwd: Using resource Files on MonoDevelop

Petit Eric surfzoid at gmail.com
Sun Feb 10 12:30:54 EST 2008


2008/2/10, Paulo Aboim Pinto <esqueleto at tusofona.com>:
> this message was not to the list
>
>
> ---------- Forwarded message ----------
> From: Paulo Aboim Pinto <esqueleto at tusofona.com>
>  Date: Feb 10, 2008 4:31 PM
> Subject: Re: [MonoDevelop] Using resource Files on MonoDevelop
> To: Petit Eric
>
>
> This code works well. Every time I change the
> Thread.CurrentThread.CurrentCulture property, I get the
> correct name.
>
> I still can't access the resource for the current Culture. I've done this:
>
>
> CultureInfo ci = new CultureInfo("pt-PT");
>  Thread.CurrentThread.CurrentCulture = ci;
> System.Console.WriteLine(Thread.CurrentThread.CurrentCulture.Name);
>
> System.Console.WriteLine(string.Format("--> {0}", rm.GetString("Field1")));
>
> the result was the same. I still get the Field1 value for the default
> resource.
> The resource files are: res.resources and res.pt-PT.resources
> Maybe the names of the resources are wrong.... they are all on the same
> directory (root directory) and I put the res.pt-PT.resouces in the pt-PT
> directory and nothing.
>
> I need some lights here..... pleaseeeeeeeeeeeeeee
Well, from my experiance, i never sucessfull change the language of a
thread already runing, i thind i had folow the way as you, wath i say,
is the satelite seem correct, but this satelite was used only in
function of your system culture, i never change this sucessfull by the
code and don't know how to do this.
If you prefer, a good check should be under windows with VS express,
make a windows app project, with form, put at true the localized
propriety of the form, choice portugal laungage and change the text
(title) of the form by portugal, choice Fr language and change text to
FR .....
With a combo change the language and you will see, the text of the
form never change, because the curent thread use at startup of it the
culture of the system and then load the corect dll assembly, in your
case the pt-PT.dll but after when change the language with the combo
to other than pt-PT, how say : unload pt-PT.dll and then load for
exemple fr-FR.dll without restarting the thred.
If you find the solution i will be very interesded to know it.
Thank's
>
>
>
> Regards
> Paulo Aboim Pinto
> odivelas - Portugal
>
>
>
> On Feb 10, 2008 4:08 PM, Petit Eric <surfzoid at gmail.com> wrote:
>
> >
> >
> >
> > 2008/2/10, Paulo Aboim Pinto <esqueleto at tusofona.com>:
> > > I don't undestand what you are saying.
> > >
> > > I'm using this example on Console Application. Where is the Localizable
> > > property?
> > >
> > > The culture on my PC us-US and I'm changing this here:
> > > CultureInfo ci = new CultureInfo("pt-PT");
> > >  if (rm.GetResourceSet(ci, true, false) == null)
> > >
> > > If I have one culture and want that my application will use another
> > > culture!? How can I change?!? I try this:
> > > CultureInfo ci = new CultureInfo("pt-PT");
> > >  Thread.CurrentThread.CurrentCulture = ci
> > >
> > > And the result is the same.
> > >
> > > Anyone can help!?!?!
> > >
> > >
> > > Regards
> > > Paulo Aboim Pinto
> > > Odivelas - Portugal
> > >
> > >
> > > On Feb 10, 2008 11:31 AM, Petit Eric <surfzoid at gmail.com> wrote:
> > >
> > > > 2008/2/10, Petit Eric <surfzoid at gmail.com>:
> > > >
> > > >
> > > >
> > > > > 2008/2/10, Paulo Aboim Pinto <esqueleto at tusofona.com>:
> > > > > > Hello
> > > > > >
> > > > > > I'm trying to use resource files on MonoDevelop and I can figure
> how I
> > > do
> > > > > > it.
> > > > > >
> > > > > > I try to follow this tutorial:
> > > > > >
> > >
> http://msdn2.microsoft.com/en-us/library/system.resources.resourcemanager.aspx
> > > > > >  to create the resource files for default culture and for another
> > > culture.
> > > > > >
> > > > > > I can use the strings from default resource file, but I can't use
> the
> > > second
> > > > > > resource file. I'm trying to create a file for pt-PT culture.
> > > > > >
> > > > > > I add the resource files created with the tutorial above and when
> I do
> > > this:
> > > > > >
> > > > > > ResourceManager rm = new ResourceManager("newTestBed",
> > > > > > Assembly.GetExecutingAssembly());
> > > > > > System.Console.WriteLine(string.Format("--> {0}",
> > > rm.GetString("Field1")));
> > > > > >
> > > > > > I get the default value of the Field1
> > > > > >
> > > > > > When I do this:
> > > > > > CultureInfo ci = new CultureInfo("pt-PT");
> > > > > > if (rm.GetResourceSet(ci, true, false) == null)
> > > > > >                 System.Console.WriteLine("pt-PT not found");
> > > > > >
> > > > > > I always get that "pt-PT not found". Why? I add the
> > > newTestBed.resources,
> > > > > > newTestBed.pt-PT.resources to the Resources folder and this still
> > > don't
> > > > > > work.
> > > > > > When I compile my project I get this:
> > > > > > Generating satellite assembly for 'pt-PT' culture with al2
> > > > > >
> > > > > > If the pt-PT culture is compile to the assembly, why I can't use
> the
> > > > > > resource.
> > > > > Because, i think the culture of your system is not pt-PT.
> > > > Also your form(s) should have property "localizable" to "true".
> > > >
> > > >
> > > >
> > > > > >
> > > > > >
> > > > > > Regards
> > > > > > Paulo Aboim Pinto
> > > > > > Odivelas - Portugal
> > > > > >
> > > > > > --
> > > > > > Have income spending 5 minutes a day
> > > > > > Click here: http://bux.to/?r=esqueleto
> > > > > > _______________________________________________
> > > > > > Monodevelop-list mailing list
> > > > > > Monodevelop-list at lists.ximian.com
> > > > > >
> > >
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > >
> > > Have income spending 5 minutes a day
> > > Click here: http://bux.to/?r=esqueleto
> >
> > Can you try the following code in a console VB project and say if the
> > culture change,
> > Also i had posted a bugroport to bugzilla feww month ago, there is
> > inside a testcase with a loop on all culture installed, but can 't
> > remember the bug report link.
> >
> >
> Console.WriteLine("-----------------------------------------")
> >
> System.Threading.Thread.CurrentThread.CurrentCulture _
> >            = New
> System.Globalization.CultureInfo("en-US")
> >
> Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentCulture)
> >        Console.WriteLine
> >        RunTests
> >
> >        Console.WriteLine
> >        Console.WriteLine
> >
> Console.WriteLine("-----------------------------------------")
> >
> System.Threading.Thread.CurrentThread.CurrentCulture _
> >            = New
> System.Globalization.CultureInfo("fr-FR")
> >
> Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentCulture)
> >        Console.WriteLine
> >        RunTests
> >
> >        Console.WriteLine
> >        Console.WriteLine
> >
> Console.WriteLine("-----------------------------------------")
> >
> System.Threading.Thread.CurrentThread.CurrentCulture _
> >            = New
> System.Globalization.CultureInfo("en-GB")
> >
> Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentCulture)
> >        Console.WriteLine
> >
> >
>
>
>
> --
>
>
> Have income spending 5 minutes a day
> Click here: http://bux.to/?r=esqueleto
>
>
> --
>
> Have income spending 5 minutes a day
> Click here: http://bux.to/?r=esqueleto
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>
>


More information about the Monodevelop-list mailing list