|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamic language dependent ressourceshow 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
Show quote
"Stephan Hofmann" <StephanHofm***@discussions.microsoft.com> wrote in You can certainly load a particular resources module using Assembly.Load and 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? 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 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 > The designer-generated resources file includes a "Culture" property you No. You wouldn't need to rewrite anything.> 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 In the constructor of the class, before the InitializeComponent method is called, change the culture using: Thread.CurrentCulture = ... Thread.CurrentUICulture = ... 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 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 > ------------------- > > > |
|||||||||||||||||||||||