Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Why my program is not multi-language when i do a setup project ?
 

Why my program is not multi-language when i do a setup project ?

Hi,

I've done an application that has multiple languages,
When I run the project, I can switch languages, even though I have to restart it.

However, when I build the Setup Project and install it,
English-US remains as the only language available.

Do you have any idea about it ?

Thank you

aybe  Tuesday, January 09, 2007 3:25 PM
Visual Studio setups have a localisation value so that you can build an MSI file for the language you want. There isn't a built-in capability for you to decide what language you want to use when you run the MSI file.
PhilWilson  Tuesday, January 09, 2007 9:23 PM
No, all I can do is repeat myself. The way it works is that there is one MSI file per language. I don't know what "switch to any language though your program" means exactly, but I assume you have multiple resource Dlls or something that you can switch too. MSI files don't work like that.
PhilWilson  Wednesday, January 17, 2007 7:35 PM
Visual Studio setups have a localisation value so that you can build an MSI file for the language you want. There isn't a built-in capability for you to decide what language you want to use when you run the MSI file.
PhilWilson  Tuesday, January 09, 2007 9:23 PM

No, I am asking whether it is possible to have multi-languages setup and application.
When debugging, I can switch to any language through my program,
But when i publish or do a setup project, only one language remains.
It seems to not be possible, the only way is to publish one version per language.

Do you have any idea ?

Thanks

aybe  Tuesday, January 09, 2007 11:48 PM
No, all I can do is repeat myself. The way it works is that there is one MSI file per language. I don't know what "switch to any language though your program" means exactly, but I assume you have multiple resource Dlls or something that you can switch too. MSI files don't work like that.
PhilWilson  Wednesday, January 17, 2007 7:35 PM

Hello,

This is what I'm gonna do but I will lose the flexibility that gives VS.

Thanks

aybe  Wednesday, January 17, 2007 10:27 PM

If I understand, you are basically trying to deploy an application that has multiple localized resources installed with it... like the Japanese and German resources for your application.

If that's right, there's a way to do it with ClickOnce, and a way to do it with Setup projects.

For ClickOnce, you need to open the ApplicationFiles dialog, and then click the "Show All Files" checkbox. Then, include the resource assemblies you want by changing the drop-down from Exclude to Include.

For Setup projects, just add the Localized Resources project output group. That will include all of them.

Now, once you have it installed, that's 1/2 the battle, how do you get them to be loaded? The runtime takes the OS language settings, and looks for resources assemblies in that locale. If it finds them, it loads them up... if not, it falls back to the default resources (usually your English ones). You can write some code to switch the resources on the fly, but part of it is a little tricky or monotonous, depending on your take.

To switch the application's locale, you change something like the System.Threading CurrentThread.UICulture to the culture you wish to display... then, the next trick is you have to reload the resources for each of your controls. Usually, you copy and re-write some of the InitializeComponents method.

Here's a sample method I used in VS 2002... I don't know if there's an easier way to do it now... I'd like to think so but I haven't played with it in a few years :-)

Private Sub LoadResource()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(WindowsApplication1.Form1))
Dim strCulture As String
strCulture = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString

Select Case strCulture
Case "de"
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("ja") 'JPN=ja (null)=Neutral DEU=de
Case "ja"
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("") 'JPN=ja (null)=Neutral DEU=de
Case Else
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("de") 'JPN=ja (null)=Neutral DEU=de
End Select
#ExternalSource("C:\My Documents\Visual Studio Projects\Setup2\WindowsApplication1\Form1.vb",86)
Me.Button1.Text = resources.GetString("Button1.Text")
#End ExternalSource
End Sub
David Guyer MSFT  Thursday, January 18, 2007 6:19 AM

You can use google to search for other answers

Custom Search

More Threads

• AppUpdater Component
• Clickonce download Error
• Publish Question
• App Config file problem w/ No-Touch Deploy 2
• Not getting the installation path option for clickonce deployment
• Change the "SourcePath" when transfering a VS Solution with a Deployment Project to another PC
• application expiry
• Error 1001. Item has already been added. Key in dictionary:
• Windows App Newbie Question
• Question re VS 2005 setup projects