[MonoDevelop] Fwd: Using resource Files on MonoDevelop

Paulo Aboim Pinto esqueleto at tusofona.com
Sun Feb 10 11:33:56 EST 2008


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


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20080210/3ec7548b/attachment-0001.html 


More information about the Monodevelop-list mailing list