Multi Language Software
Softwarebuero Jollans
This is Tikiwiki v2.2 -Arcturus- © 2002–2008 by the Tiki community
Wed 08 of Sept., 2010 20:39 CEST
Importing existing localization in a .NET projectSuppose that your project is already partly localized, using hand coded function calls to load resource strings, and that you already have translations in multiple languages stored in resource files. If you decide to start using the Multi-Language Add-In for .NET to localize your project, what will happen to the existing localization?Starting with version 4.52.0003, the Add-In contains a special feature to import existing localization into the Add-In's project database. This import performs two functions:
To identify the function calls which are used to load resource strings, you must define a regular expression. We will look at this later on with a couple of examples.
Selecting the resource fileIf your project contains multiple resource files, then you must select the file containing the translations to be imported. You can select the resource file from a drop down list, which contains all of the neutral language resource files in your project.The list does not contain any language specific resource files or the local resource files used for Forms or UserControls. If you need to import strings from more than one resource file, then you must repeat the import operation for each file. Defining the search patternThe search pattern is defined using a regular expression. The syntax for regular expressions is defined in the Visual Studio Help, for the System.Text.RegularExpressions.RegEx class.The syntax supported by System.Text.RegularExpressions.RegEx class differs slightly from syntax supported by the Visual Studio Editor. In particular, the format "\s" for any whitespace character does not seem to work in the editor! Matching the resource nameThe regular expression must perform two tasks:
The resource name must be matched using the named grouping construct with the name param. The syntax for this is (?<param> ... )where ... represents the search pattern for the parameter itself. If the resource name is in quotes, then the quotes should not be part of the captured parameter. Let's look at some examples: Example 1In this example we want to detect the function calls to ResMgr.GetString() as shown below:
We can match these calls with the following regular expression ResMgr\.GetString\s*\(\s*\"(?<param>.*)\"\s*\)which contains the following elements:
After specifying the regular expression, you can start the search operation by clicking on the "Search" button. The results will be shown in the grid, as below: ![]() The grid contains the following columns:
In the screenshot above, you can see that the three function calls were detected. For the third function call, the resource string was not found. To actually import the resource strings and convert the function calls, click on the "Import" button. After the operation, the dialog is closed automatically. The function calls are converted as follows:
The third call is not converted, because the resource string was not found. The resource strings in all languages are imported into the Multi-Language Add-In's project database. If necessary, new languages are added to the project. The items will now appear in the source code grid as shown below. ![]() Example 2In this example we want to detect cases where named resource strings are loaded with the syntax ResourceFile.ResourceName.
In this case we can use the regular expression GlobalResources\.(?<param>[^ \)]*) which contains the elements:
After clicking on the search button, the results are shown in the grid: ![]() As before, clicking on "Import" completes the operation. The matches are converted as follows:
and the resource strings are imported into the Add-In's project database. At the end of the operation, the dialog is closed automatically and the source code is rescanned in order to update the contents of the source code grid.
|
||||||||||||||||||||||||||||||||||||||||||||||||




