Also referred to in .net as Globalization and Localization
Globalization is how the application is produced so that it will load different resources depending on the users setup
Localization is the reverse of globalization (sort of) After the application has been globalized, then the process of preparing language specific resources is then called localization.
Google for Globalization and Localization gets loads of results, but most I found were pretty useless - mainly referring to ASP.NET and web development.
Please add some more references if you find any good ones
Hopefully not much.
If we get into the habit of setting all our forms to Localizable and NEVER hard-code strings but always fetch them from the resource file then I hope that would be the bulk of our work done.
Each resource file is XML, so hopefully we would just need to share the resulting XML resource files with someone in Trimble who can then get them translated to the various languages.
There will probably be some issues to do with keeping resource files in sync and so on, but hopefullly Trimble will have something in place to help with this.
The form properties has a Localizable property which is set to false by default.
When this is set to true, the system will extract all the strings used on the form (labels, captions etc) to a resource file FormName.resx. When the Localizable property is first set to true, the Language property will be set to Default.
To add resource files for a different language, change the Language property to the one to be created.
Unfortunately each control text property must now be changed to the correct value in the new label.
In the code, all hard-coded strings must be replaced by resource strings.
So this
sText="Hello World"
Must be replaced by this
Dim sBase As String = "ProjectName.ResourceName" Dim rm As Resources.ResourceManager = New System.Resources.ResourceManager(sBase, System.Reflection.Assembly.GetExecutingAssembly()) sText=rm.GetString("HelloWorld")
Obviously before this works a resource file has to be created containing the HelloWorld string resource. I think the best way to do this might be to have a single resource file containing the strings. This can then be duplicated for the various languages.
From the Solution Explorer right click and add a new resource file.
Open up the resource file and add a string with the key “HelloWorld” and the value “Hello World!”. When the application runs, it will look in the resource files to find strings with the key “HelloWorld”. It will look in the language specific files first (eg strings.en-GB.resx), and default back to the base resource file strings.resx if it can't find anything.
The code snippet now looks like this (with the resource file named strings.resx)
Dim sBase As String = "ProjectName.strings" Dim rm As Resources.ResourceManager = New System.Resources.ResourceManager(sBase, System.Reflection.Assembly.GetExecutingAssembly()) sText=rm.GetString("HelloWorld")
It is possible to change the locale settings in order to test the code.
This must be done before the form is loaded. It needs to go in the FormName.designer.vb code. Modify the New() sub and place the code to change the language before the call to InitializeComponent.
Public Sub New() Dim s() As String = System.Environment.GetCommandLineArgs If s.Length() > 1 Then Dim sLoc As String = s(s.Length() - 1) ' This call is required by the Windows Form Designer. ' Set the culture and UI culture before ' the call to InitializeComponent. Threading.Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo(sLoc) Threading.Thread.CurrentThread.CurrentUICulture = New Globalization.CultureInfo(sLoc) End If InitializeComponent() ' Add any initialization after the InitializeComponent() call. End Sub