|
||||||||
|
This document will explain in a few steps how to create and manage a project with vbLocalization Manager alpha. Before starting to create your own project, you should go through these steps with the sample project provided in the download archive and read the issues listed below. Remarks / Alpha IssuesDon't use the build-in editor unless you have a backup of your files! Options dialog is in construction. User Controls are not supported for source processing. To translate user controls all string resources should be exposed as public properties. Save the vbLM project as often as possible to prevent data loss on runtime errors. Source files are provided only as samples. Feel free to change source files to fit your needs. If you think that the changes you made are a benefit for all vbLM users, you might send me the changed files or suggestions and I will post them for download. Please send bug reports, improvement suggestions or support requests by using the contact form on the VBX Homepage Unicode IssuesLanguage files are saved in true Unicode (DBCS), meaning that natively all Unicode languages are supported by vbLM. A problem is Cross-Codepaging, as VB6 does not support this feature: you won't be able to edit and display languages that use double byte non-ANSI characters on systems that don't have this specific codepage set as default. This is a VB 6.0 related problem, which is very difficult to solve on the various platforms (95 to XP).
Unicode language support for non-ANSI characters can be enabled
only on NT Systems (NT, 2000, XP, 2003) and just for one
specific language at a time. Source FilesAll source files needed for vbLM integration are located in the InstallDir\Source\Translation Kit folder. You can access the folder with the Source link in the programs start menu. Don't add the original files to your project
as they will change with every new vbLM version and are deleted
on uninstall.
How to create a vbLM projectcLocalization class Add the cLocalization class to your VB project (cLocalization.cls) and make sure that fso is declared
on global level as Scripting.FileSystemObject (add the
Microsoft Scripting Runtime reference). See also: cLocalization - general, cLocalization - reference Base class or main form:
Public WithEvents Localizer As cLocalization
Module:
Public lc As cLocalization
Public fso As Scripting.FileSystemObject
Public Sub Main()
Set fso = New Scripting.FileSystemObject
Set MyBaseClass.Localizer = New cLocalization
Set lc = MyBaseClass.Localizer
End Sub
Preparing strings for implementation All strings (excluding static control properties) needing translation must be passed to the cLocalization instance on runtime. MsgBox lc("Translate this text")
lblInfo.Caption = lc("My name is %1", strName)
strInfo = lc("I live in %1", strCity)
Creating the vbLM projectWhen handling source files in vbLM, it's recommended to close
the VB IDE, although files are not modified unless you use the
build in editor. Strings are automatically extracted from source files and added to the strings list. Ignoring unwanted strings Go to View -> Ignore lists ->
Called procedures (Inclusion) and add a new element with the
name of your global cLocalization instance (e.g. lc). Click on strings looking suspicious,
ignore them by value, control, property or procedure with a
right click on the element. Static control localization This feature enables runtime control localization. Go to Project -> Control
localization. Click the star button to add a new control
localization module. Add a localization module for each
individual VB project. Save the project
(recommended in the folder where the VB project is located), close vbLM
and reopen the VB project. The localization module template is located under InstallDir\Data\modCL.cmp and can be customized to fit your needs. Note: localization modules are not processed when loading a VB project into vbLM, as they contain only redundant strings. Private Sub Form_Load()
SetFormLanguage Me
...
End Sub
Private Sub mnuLanguage_Click(Index As Integer)
If Index = 0 Then
'standard language
lc.ClearTranslation
Else
'load the choosen language
lc.Load mnuLanguage(Index).Caption
End If
SetFormLanguage Me
...
End Sub
Dynamic control localizationThis feature is not supported by vbLM and must be
individually programmed. Control properties or entire controls with dynamic string values must be added to the ignore lists, otherwise the properties will be overwritten with wrong values when languages are switched on runtime. It is recommended to use a private form procedure that handles dynamic controls, which is called each time the user switches languages. Private Sub SetDynFormLanguage()
mnuActions(0).Caption = lc("Edit")
mnuActions(1).Caption = lc("Delete")
...
End Sub
Preparing string resources for translation Switch to Show ignored only filter and check if you have missed to pass a string to the cLocalization instance. You can easily edit the source file using the build-in editor (double click on the string list item). Save the translation file (vbt) in the folder, your language files will be placed later. This file includes all relevant (not ignored) strings, some source information and is used as resource for third party translation. Language and translation files should be placed in a sub-folder of the main executable folder. (recommended: YourAppInstallDir\languages) To enable third party translation, you can deliver the translation file (vbt) with the Translation Kit (vbLT.exe) or include the translation form in your application. You can customize the Translation Kit as well as the translation form to fit your needs, although it is not recommended, as you will encounter difficulties while upgrading. How to enable build in translation functionalityIf you intend to provide build in translation functionality, please go through the following steps: Add frmLocalization.frm (include frmLocalization.frx on copy) and cCommonDialog.cls to your project. Take a look at the sample project provided in the installation. The form must be initialized by passing the path of the translation file and the extension of language files. Language files are loaded only from the folder where the translation file is saved. Dim froTranslation As frmTranslation
Set froTranslation = New frmTranslation
With froTranslation
.Initialize App.Path & "\languages\myApp.vbt", "lng"
.Show vbModal
End With
The user will now be able to edit and translate your app in any desired language. Don't forget to provide the user with a menu or option panel to select one of the available language files. Needed RuntimesFollowing runtimes are needed while adding source files to your application. Please make sure to provide these runtimes in your installation package. cLocalization: Microsoft® Scripting Runtimes 5.5 or above frmTranslation: Microsoft® Common Dialog Control 6.0, Microsoft® Windows Common Controls 6.0
|
||||||||
|
© 2002-2007 VBX System |
||||||||