Re: "Localizing" inherited forms?
From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 02/02/05
- Next message: Peter Proost: "Re: How to export from Access to CSV?"
- Previous message: Paul Clement: "Re: updating a access Database Record"
- In reply to: Cor Ligthert: "Re: "Localizing" inherited forms?"
- Next in thread: Cor Ligthert: "Re: "Localizing" inherited forms?"
- Reply: Cor Ligthert: "Re: "Localizing" inherited forms?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 2 Feb 2005 09:34:18 -0600
Cor,
> Now I have put in the sub new (direct after the mybase.new) of the
> inherrited form
> Threading.Thread.CurrentThread.CurrentUICulture = New
> Globalization.CultureInfo("en-US")
You need to set CurrentUICulture before you create any forms! I would
normally put it as the very first thing in my Sub Main. When you called the
derived (inherited) form's mybase.new, the base form used the initial
CurrentUICulture, then your derived form used the new CurrentUICulture. The
code that actually reads the localized properties is in each form's
InitializeComponent routine.
> I find this with the RESX a terrible system it seems for me if it is made
> by people who never had anything to do with more languages.
There is nothing stating that you need to use the built-in Localization. You
are free to implement your own method. In fact Shawn implemented his own
localization for icons, bitmaps & such:
http://www.windojitsu.com/blog/resxsucks.html
I implemented my own localization for XSLT transforms:
http://msmvps.com/jayharlow/archive/2005/01/24/33766.aspx
If you search for the thread "Load icon from resx" in this newsgroup about
27 Jan 2005 you can see a copy of a ResourceLoader based on the same logic
in my code above.
For binary resources such as icons, bitmaps & such, I normally use a method
similiar to Shawn's, largely for the reasons Shawn lists on his page above.
Until the XSLT Transforms, I did not really need to localize them...
One could easily do the same for other resources (strings & property
settings).
> This languages problem can in my opinion very good be done by an External
> XML file where localized people write the correct text. Even when people
> from Globalize countries write text in another language in a program, than
> you see often strange things.
Using a "global" instance of a ResourceManager & a single .resx you could
very easily implement a single XML file for the resources. By "global" I
mean one private to a Module or Shared Class.
The major advantage of using the built-in stuff is the fall back support.
For example if CurrentUICulture is "de-DE", ResourceManager will look for
"de-DE" resources, if it doesn't find it there, it will look for "de"
resources, if it doesn't find it there, it will look in your base assembly.
As Shawn & I show in the above web pages, adding this fall back support is
not that difficult...
The other major advantage is VS.NET support, which depending on who is doing
the translation may be a hindrance more then a help.
Hope this helps
Jay
"Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
news:uLwKaCQCFHA.3592@TK2MSFTNGP09.phx.gbl...
> Nick,
>
> I tried it yesterday however was not anymore in the mood to write.
> I have created a form
> Put one label on it.
> Set the localization to true
> Have set the language to Dutch and wrote "Bier" in it
> Have set the language to English and wrote "Beer" in it
> I have inheritted this form
> I have put an extra label on it
> Have set the language to Dutch and wrote "Jenever" in it
> Have set the language to Englis and wrote "Whiskey" in it
> I have set the startup form to the inheritted form
> I have runned it and it showed Bier and Jenever
> Now I have put in the sub new (direct after the mybase.new) of the
> inherrited form
> Threading.Thread.CurrentThread.CurrentUICulture = New
> Globalization.CultureInfo("en-US")
> Than I see something strange because it gives Bier and Whiskey
>
> I find this with the RESX a terrible system it seems for me if it is made
> by people who never had anything to do with more languages.
>
> There should be in my opinion one file for a complete project and not for
> every form class in my opinion. I can only think when I do something with
> it at WILLIAM J. LEDERER AND EUGENE BUR*** who describe it in a fantastic
> way. http://www.wwnorton.com/catalog/fall98/uglyamerican.htm
>
> To give you more information. Both the Original and the inherited form
> have now four RESX files
> en
> nl
> nl-NL
> the default one.
>
> I hope this gives you some ideas
>
> This languages problem can in my opinion very good be done by an External
> XML file where localized people write the correct text. Even when people
> from Globalize countries write text in another language in a program, than
> you see often strange things.
>
> Even Microsoft has no versions for there programs which work all over the
> world. They have versions for every language and some products even very
> limited.
> (Although before I give them ideas, I and probably all people from
> Globalize countries would not like a version of VSNET in their special
> language. The reason, the documentation is than often very flaw and than
> you would have to translate words as Bier to Beer to find documentation.
> The last word I know in many languages, however there are as well words,
> which are translated by people who don't know the meaning and than I
> never, find the documentation)
>
>
> Cor
>
>
>
>
>
- Next message: Peter Proost: "Re: How to export from Access to CSV?"
- Previous message: Paul Clement: "Re: updating a access Database Record"
- In reply to: Cor Ligthert: "Re: "Localizing" inherited forms?"
- Next in thread: Cor Ligthert: "Re: "Localizing" inherited forms?"
- Reply: Cor Ligthert: "Re: "Localizing" inherited forms?"
- Messages sorted by: [ date ] [ thread ]