Loading...
 
Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


Multi-Language Add-In for Windows CE Forms

Hello everyone,
at the moment I'm trying to implement the Multi-Language Add-In into an Windows CE Application (using VS 2003). So I've downloaded and installed the latest Version (which seems to be just 4.01.0011 and not 4.65 question) of the Add-In and added it to my project. The application uses a TreeView-Control for the mainmenue. Each menueentry is loaded from an xml-file which holds the needed translations (DE and NL) and I just pick the right one to show the menue. All the other applications which can be started directly from the menue (everything in one big Solution) need to be translated too, so I decided to choose the Multi-Language Add-In (we use it already for other Windows Projects - not CE - with VS2008).

The Add-In works good with Windows CE. I can implement it in my project and scan all controls and the source code. But I just can't figure it out how to switch the language on the fly (based on the language-strings "de" and "nl"), because there is no CurrentUICulture in the Thread-property. I thought this Thread would help me, but I only know that he had achieved what I want, but I don't know HOW :-D I need to switch the language without showing a selection-form or something like that. Is there a way how I can switch the language (and so trigger the Multi-Language Add-In to translate the Controls) in the source code?

Could you give me a hint, how I can achieve this (if it's possible)? Thank you in advance for your answers.

Kind Regards,
Kai

Germany

Hi Kai

The compact framework version 1.0 does not have the same support for localization as the normal .NET framework. I originally implemented the alternative runtime support for Smart Device projects in VS 2002 or 2003.

If you want to select the language when the program starts up, you can call the function ml_UseCulture() which is defined in the MlString module. This loads a resource set for the specified culture.

If you want to change the language on the fly, you will have to add support for runtime language switching via the drop down runtime-support menu (3rd button on the toolbar).

This adds the project MlRuntime to your solution, which contains a singleton class for firing events when you change the language. It also registers the function ml_UpdateControls() as a handler for this event.

If you call MlRuntime.MlRuntime.BroadcastLanguageChanged() it will fire this event in all active forms or controls.

Because the class MlRuntime.MlRuntime is a singleton class, it fires events across separately compiled components.

However, I do see a problem if you are using separately compiled components. This mechanism works in Windows Forms projects, because the the CurrentThread.CurrentUICulture is already a global setting. In compact framework 1.0, there is no CurrentUICulture property, so I think that the MlRuntime will have to pass on the selected culture. It could do this as a parameter to the LanguageChanged event, or it could have a public property with the current language.

Let me know if this is a real problem for you, and I will try to come up with a solution.

Phil


Hi Phil,
thank you for your fast reply. The method ml_UseCulture() is exactly what I was looking for. Due to my first tests I can say, that it works fine now. Before I'm able to try the implementation of the on the fly switch I need to makeover some parts of the source code. It's hard coded to the xml-structure which didn't support multilanguage so far and therefor need some makeover.

I'll let you know when I need further information/help. Thank you for your support Phil! :-)

Kind Regards,
Kai