Home All Groups Group Topic Archive Search About

Dynamic language dependent ressources

Author
13 May 2006 1:27 PM
Stephan Hofmann

Hello,

how would you solve in general the following requirement:
my application will ask you to login with a language, so you have installed
on your desktop one version of my application, providing multilanguage
support that means text, description, column names etc. will be displayed in
your login language.

The issue around translations of table columns is solved by myself, I will
dynamically display language dependent column titles (using SQL table for
translation of column names and updating the controls which are bound to this
a data column).

But how should I handle all the rest?

I'm using already the project resources (text strings) and fill "caption"
and "text" and other properties of the controls by these resource strings.

So is possible to change the resource file at run-time to get all text etc.
displayed in your language? If not, should I maintain in SQL a table doing
the translation for me how I did for SQL table column titles?

I don't want to compile individual program versions for each language,
install them on the computer and the user has to select the exe file of the
specific language each time he is using the program, this wouldn't be nice.


Thanks
Stephan
Author
13 May 2006 4:58 PM
Ben Voigt
Show quote Hide quote
"Stephan Hofmann" <StephanHofm***@discussions.microsoft.com> wrote in
message news:FD508772-10CB-47B8-AD72-C603D09CCF38@microsoft.com...
> Hello,
>
> how would you solve in general the following requirement:
> my application will ask you to login with a language, so you have
> installed
> on your desktop one version of my application, providing multilanguage
> support that means text, description, column names etc. will be displayed
> in
> your login language.
>
> The issue around translations of table columns is solved by myself, I will
> dynamically display language dependent column titles (using SQL table for
> translation of column names and updating the controls which are bound to
> this
> a data column).
>
> But how should I handle all the rest?
>
> I'm using already the project resources (text strings) and fill "caption"
> and "text" and other properties of the controls by these resource strings.
>
> So is possible to change the resource file at run-time to get all text
> etc.
> displayed in your language? If not, should I maintain in SQL a table doing
> the translation for me how I did for SQL table column titles?

You can certainly load a particular resources module using Assembly.Load and
then call the resource methods that take an assembly parameter, for
resources you handle that way.

The designer-generated resources file includes a "Culture" property you can
reassign.  I'm not sure if this will affect the display of UI-elements such
as forms, etc.  Actually, looking at InitializeComponent, I think you'd have
to rewrite that to retrieve resources, because I've got constant strings
appearing in the designer-generated code on my non-localizable (prototype
only) app.

Show quoteHide quote
>
> I don't want to compile individual program versions for each language,
> install them on the computer and the user has to select the exe file of
> the
> specific language each time he is using the program, this wouldn't be
> nice.
>
>
> Thanks
> Stephan
Are all your drivers up to date? click for free checkup

Author
14 May 2006 1:20 AM
Gaurav Vaish (EduJini.IN)
> The designer-generated resources file includes a "Culture" property you
> can reassign.  I'm not sure if this will affect the display of UI-elements
> such as forms, etc.  Actually, looking at InitializeComponent, I think
> you'd have

No. You wouldn't need to rewrite anything.

In the constructor of the class, before the InitializeComponent method is
called, change the culture using:

Thread.CurrentCulture = ...
Thread.CurrentUICulture = ...


--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------
Author
14 May 2006 12:42 PM
Stephan Hofmann
Hello,

thanks for the hint. I found the following:
my.application.ChangeUICulture ("xx")  (xx = two chars for country) before
the InitializeComponent as you mentioned.

Yours
Stephan

Show quoteHide quote
"Gaurav Vaish (EduJini.IN)" wrote:

> > The designer-generated resources file includes a "Culture" property you
> > can reassign.  I'm not sure if this will affect the display of UI-elements
> > such as forms, etc.  Actually, looking at InitializeComponent, I think
> > you'd have
>
> No. You wouldn't need to rewrite anything.
>
> In the constructor of the class, before the InitializeComponent method is
> called, change the culture using:
>
> Thread.CurrentCulture = ...
> Thread.CurrentUICulture = ...
>
>
> --
> Cheers,
> Gaurav Vaish
> http://www.mastergaurav.org
> http://www.edujini.in
> -------------------
>
>
>

Bookmark and Share