Hi,
in a Windows form VB.Net project I use localization for all texts.
In App.Config I added:
<appSettings>
<add key="locale" value="de"/>
</appSettings>
In the project I have ressource files strings.resx (English text) and
strings.de.resx for the German texts.
In the Main Module I use the follwowÃ*ng code:
Imports System.Configuration
Imports System.Resources
Imports System.Globalization
Imports System.Threading
.......
Friend M_LocRM As ResourceManager
Friend M_Locale As String
......
Sub Main()
M_Locale = ConfigurationSettings.AppSettings.Get("locale")
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(M_Locale)
Thread.CurrentThread.CurrentUICulture = New CultureInfo(M_Locale)
M_LocRM = New ResourceManager("MyNamespace.Strings",
GetType(MyMainModule).Assembly)
......
For all texts I then use the GetString method of the ResourceManager M_LocRM.
This works fine, as long as I debug the project: changing the value of
'locale' in app.config from 'en' to 'de' (and vice versa) gives all the texts
in German or English like it should be.
When I install MyFunction.exe in a different folder (say c:\program
files\MyFunction) together with the config file MyFunction.exe.config it does
not work any more:
Changing the value of 'locale' in the config file has no effect, as only the
entries of the ressource file 'strings.resx' are used. Changing the locale
from 'en' to 'de' has not the effect that the entries of 'strings.de.resx'
are used.
Why? Can anybody give me some hint, as the above described implementation
works fine in any of my ASP.Net projects but not in my Windows form projects.
--
Best regards
Henry