GUI form support for multiple languages

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 25
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Sun Mar 03, 2013 12:39 pm

GUI form support for multiple languages

Post by kerbob »

One of the powershell GUI scripts I wrote the company wants me to make available in Spanish as well as English. Here are the ways I was thinking to accomplish this:
1.) Query the OS language. If Spanish, display Spanish verbiage. Else, use English. Con to this is that some Spanish speakers may use English as their OS default.
2.) Have two versions: one script that does english and one that does spanish. Con to this is knowing which version to deploy to a user's system.
3.) Always display English, but have a link at the bottom of the form "En español" that would switch the verbiage in the existing form and retain the preference in a config file.

Does anyone have an example of how to implement this or a recommended approach?

Posts: 14442
Joined: Tue May 22, 2007 9:57 am

Re: GUI form support for multiple languages

Post by jvierra »

Make all strings virtual and load from a file. You can use Export/Import CliXml to do this. The issue you will have is making the form behave with different strings..

PowerShell has not support for MUI. It must be done by hand.