Localizer
Localizer
Ïåðåéòè íà ðóññêèé >>

Files

Current Version: 2.3.8

  • Download
    Utility (in the subdirectory exe), examples of loaders, source. No installation is required. This program is free. The project is partially of Open Source (most important sources are included to zip).

General

The program allows you to perform automated localization of projects.

Features:

  • Changes in the localization does not cause changes in the general header file and does not lead to large-scale recompiling the project.
  • Localized string is a pointer type const char *. It does work with strings as effectively as possible. During the execution any search by key or ID does not happen, any function does not called.
  • The process of localization is highly automated. After the initial development minimum efforts required of the user for the maintenance of the project in a "localized" state.

As usual, no warranties is given. However, the program has been used almost every day, and serious bugs have not been noticed.

Quick Start

This section describes how to localize in the simplest form. It is anticipated that many projects this will be enough. If not, all the subtleties and all the incomprehensible terminology explained further.

You must have a project file for Microsoft Visual Studio 2003, 2005, 2008, 2010. Either should be just a list of files in a file with extension .lst. Either you have to build list of your "sources" by hand (you can use wildcards).

Determine the special prefix:

#define LS
- This or the other, if only unique. Mark with this prefix all strings to be localized e.g. LS"this string" or LS("this string").

Call the localizer:

localizer -auto LS file1 file2 ...

Example, suppose your project is called "interval":

localizer -auto LS +interval.vcproj interval.eng.loc interval.rus.loc interval_loc.cpp interval.eng.bin interval.rus.bin
Or if you do not have a project, but there is only a list of interval.lst, then:

localizer -auto LS +interval.lst interval.eng.loc interval.rus.loc interval_loc.cpp interval.eng.bin interval.rus.bin
Or if you do not even have a list, but all .cpp/.h files are in the current directory, then:

localizer -auto LS +*.cpp +*.h interval.eng.loc interval.rus.loc interval_loc.cpp interval.eng.bin interval.rus.bin

Do not be afraid of a large number of parameters. In almost all cases have to call the same command so just create a .bat-file and use.

Among the options are first prefix, then the list of "sources" with the symbol "+", then the files associated with localization.

The meaning is determined by its file extension:

  • .vcproj or.vcxproj - project of Visual Studio 2003-2010. it is need to take out a list of "source" of your project.
  • .lst - an alternative way to specify sources by a simple listing in a text file.
  • .loc (first) - the main (English) localization file in the format:
    identifier_string_content=string
    identifier_string_content=string
    ...
    (in the normal format of C/C++with all kinds of \n, \r only without framing quotes).
  • .loc (next) - localization files in other languages. They will be synchronized with the main, all new strings are in need of translation, will be marked with a comment /!TRANSLATE!/.
  • .cpp - this file will need to add to your project, when the utility it generates, it defines the row ID-s.
  • .bin (first) - this file should be put somewhere close to the final executable, or packed in resources. It contains localized strings, which will be loaded at runtime.
  • .bin (next) - if there are more files with the extension .bin, it is considered that they comply with localizations in other languages.

Once you call localizer for the first time in the source code of the project there will be changes. Instead of a literal kind

 LS"this string" 
will pointers (const char *) like
LS__this_string
and declarations like
extern const char *LS__this_string;

Now add in the project generated file interval_loc.cpp, and loader files (see "loaders" folder in zip). In total, the project must be added the three files - two .cpp and one .h.

Add somewhere in the beginning write loading strings for one of the generated *.bin-files (at your option) something like this:

#include "localizer.h"
...
static Localizer localizer;
...
extern const char **LS_all[];
if (! localizer.load ("interval_loc.bin", LS_all))
    (error processing)

Now build until successful compilation of your project. Everything on this localization is completed.

Then you can from time to time to translate the strings in *.loc-files and run the localizer with the same parameters. You can also add new modules to the program to mark them with 'LS' prefix, and the next start of a localizer these strings will be extracted and distributed to the localization file.

We recommend a course of action. First, programming a usual. Quoted write text in English and mark with prefix that will require translation. When these strings accumulate a lot, call the localizer. Then see .loc files and translate all that marked marker /!TRANSLATE!/, removing markers. Then again start localizer and compile the project.

That's the whole "quick start". Next come the details.

Command-string Syntax

In general, the call localizer is:

path\localizer.exe [options] command [prefix] [list_of_sources] [other_files]

All options begin with "-" character, they are slightly alter the execution. complete list of options here.

The command starts with "-" character, it is obligatory and the only one. Here all commands with their syntax specification.

About prefix is written here.

[list_of_sources] - a list of the files in your project to be localized. A list of sources is formed by a series of statements beginning with the characters "+", "-" and "=". Once found the argument without such a character in the beginning, it is considered that [list_of_sources] was over and [other_files] started.

Operators

  • +... added to the list of new source files
  • -... excluded from the list
  • =... keep a list in a file on disk (if you want to check its accuracy).

After the icon +or - may be:

  • Usual file with path or not, for example: +my.cpp
  • File mask with or without path, for example: +D:\ExtProject\Includes\*.h
  • File with the extension .lst, for example: +D:\ExtProject\files.lst
    - in this case a list of paths is taken from the file. Assumed it is a plain text file, on each string one path. If there path is not absolute, it is considered relative .lst file.
  • File with the extension .vcproj or .vcxproj, for example: +D:\ExtProject\my.vcxproj
    - this file is supposed to project file of Visual Studio. It is parsed and files from there added to the list. If there path is not absolute, it is considered to be relative project file.

Between +/-/= character and file name should be no space. But before the character space should be. Combining operators can make very complicated lists combining many different parts of the project.

Commands List

The meaning of each command is explained in detail in subsequent sections.

    localizer.exe [options] -auto prefix [source_list] cpp_file
      localization_file localization_file... bin_file bin_file...
    - The main command. Combines the effects of commands list, get, put, cpp, bin and merge.
    localizer.exe [options] -list [source_list]
    - Check the list of sources.
    localizer.exe [options] -mark prefix [source_list] 
    - Performs automatic prefix insertion for the project, which has not previously localized.
    localizer.exe [options] -get prefix [source_list] localization_file 
    - Scans the source code, collects the marked strings in a text file.
    localizer.exe [options] -put prefix [source_list] localization_file 
    - Plus to modify the source code, replacing the marked strings.
    localizer.exe [options] -puttest prefix [source_list] localization_file 
    - For very cautious: instead of modifying the source files created new with extension .rez
    localizer.exe [options] -cpp prefix localization_file cpp_file 
    - Creates a cpp-file to be included in the project.
    localizer.exe [options] -bin localization_file bin_file 
    - Creates a bin-file to be included in the distributive or resources.
    localizer.exe [options] -test bin_file 
    - Shows the contents of the bin-file in a readable form.
    localizer.exe [options] -merge localization_file localization_file ...
    - Merge the localization files in other languages with the first file as a standard.

Prefix

Prefix is a short identifier, for example to be specific "LS". By prefix localizer recognizes strings to be localized.

Prefix uniquely determines localization. One program can have several localizations those differ by prefix.

Prefix should be declared somewhere in the general header as empty define:

#define LS

Files

The following files are used for the localizer.

[proj] .vcproj or .vcxproj project file. It is need to get from it a list of sources, be analyzed. Localizer understands projects of Visual Studio versions 2003, 2005, 2008, 2010.

[lst] .lst file contains list of files to be analyzed (just filenames, each on a separate string).

[src] The project source files which may contain localized strings. Localizer scans these files and their names are taken from [lst] or [proj].

[loc] Main .loc file. This file contains the IDs of localized strings and their contents in two formats "raw" and "escape". details see here.

[loc+] Additional .loc files. All the same [loc], but the content is in another language. Identifiers can not be translated. Additional localization files are synchronized with main.

[cpp] Generated .cpp-file. This file contains all the localized strings individually and list. It must be included in the project. For all languages use the same [cpp] file.

[bin] Binary localization file (extension .bin). It is the contents of strings. It is separate [bin] for each language. Binary file must conform to [cpp], the order and number of strings in it are the same. detailssee here.

.loc-file Format

The "raw" format:

/Comment
Identifier
Contents
/END/
/Comment
Identifier
Contents
/END/
...

The "escape" format:

/Comment
Identifier=content
/Comment
Identifier=content
...

If you want a single localization file can be filled with strings in both formats.

Identifier - a sequence of characters, which may include letters, digits and underscore. The sequence may begin with a digit. Inside the program to these identifiers add a prefix and two with an underscore. For example, the identifier 'OK' turns into 'LS__OK'.

Content - an arbitrary string.

For the "raw" format any characters are allowed, including '\0', newlines and so on. The string "\r\n/END/\r\n" is indicator of the end of the content, this string can not present in the Contents.

For the "escape" format the Ñontents of string encoded regular C/C++ string using the escape-character "\". Frame the quotes are not needed, gaps around the delimiter '=' leave should not be. For multi-string strings can use the sign \ at the end of the string (as in the usual C/C++ sources).

At the end of each string will be added one character '\0', so that the hand not necessary.

Comment - optional comment string. Each string can be accompanied by one comment before. Also the program can generate a special sort of comments:

/!Text!/

The main localization file should contain the contents of the localized strings for the base language. Very it is desirable that the basic language was English. Then, localization can automatically generate meaningful identifiers that are acceptable in terms of syntax C++. You can also use Russian language in Windows-1251, in this case, identifiers will be generated with the use of transliteration.

.bin-file Format

Format:

DWORD N - number of rows
DWORD SZ - the size of block of strings
DWORD OFFSET[N] - block of offsets
 - Offset of each of the N rows in a block of strings from the beginning of the block of strings
BYTE  DATA [SZ] - block of strings

For all numbers endianness is x86 (high byte - high address).

Localized String

Localized String it is simply a pointer const char*, which operate as usual. When running program localized strings are loaded from the [bin] and each pointer adjust to the desired point memory. Specifically from the [bin] in the memory load 'block of strings', and j-th pointer is set to address: DATA + OFFSET[j]

The names of localized strings have the form: __ For example: LS__OK, LS__It_is_a__0.

Localized Strings Array

It's a static array of pointers to pointers to localized strings. He has the type const char ** [] and is used only once when downloading localization at the start of the program.

His name is: prefix_all.

For example: LS_all.

Defined in [cpp].

Localized Strings Definitions

All localized strings of this localization are defined in [cpp]. This file must be included in the project. Localized strings array is defined in the same file.

Localized Strings Declarations

It was decided to abandon any headers, which lists the IDs of localized strings. Such header would include many files, and the slightest change in it would lead to recompile a large part of the project. Instead, the 'extern' declarations uses in each file, but they do not have to manually add, it localizer makes. The only (and single) exception the declaration of the localized strings array before calling Localizer::load (see below).

Strings for Localization

Have the form: prefix"literal"

For example: LS"OK"

This method should be marked those strings that are subject to localization. If you have old project, where many such strings, the prefix insertion can be automated with command "localizer -mark".

Source with such marks will be normally compiled since LS is a empty #define. Thus, you can mark strings for localization, but real localization delay until the right moment.

If the project has several mixed parts, each of parts should has separate localization module with different prefix.

Localization Loading

Localization of your own program is loaded with the object "Localizer", the function "load". In the folder "loaders" there are several loaders:

  • Localizer for ANSI project,
  • WLocalizer for Unicode,
  • QLocalizer for Qt (-qt option),
  • Q8Localizer for Qt (-qt8 option),
  • RLocalizer for load from the resources.

"Localizer" object must exist as long as localized strings, so it's best to make it static.

1-st function parameter - the name of binary localization (for "RLocalizer" - integer resource identifier).

2-nd function parameter - an localized strings array (mentioned above and see example below).

Return Value - true if successful, false on error. Calling "load" should be placed at the beginning of the program.

Example:

#include "localizer.h"
...
static Localizer localizer;
...
extern const char **LS_all[];
if (!localizer.load ("interval_loc.bin", LS_all))
(
   printf ("Error of localization.\n")
   return -1;
)

In this example, the program uses the localization with the prefix LS and loads it from file interval_loc.bin.

Localization Step-by-Step

List of steps is long, but it's not terrible, as most of them fit into one bat-file. Process is divided into these fragments to show details. In our daily work on the project is only bat-file, and think about the many small steps do not need.

Step 0. Add localizer.cpp and localizer.h to the project.

Step 1. Contrive a unique prefix that will identify the localization. Choose a short prefix as it will have to write many times. But it must be a unique identifier that is not used in program.

Step 2. Define prefix. Example:

#define LS

This directive must be inserted in a header, preferably 'precompiled'.

List of Sources Creation

Step 3. Now we have to make a list of files to be localized. The list should include all project files, which occurs or may occur in the future with tag "LS". The list can be made manually or automatically.

You can use the standard command "dir", to create a list file, for example:

dir /B *.cpp> my.lst
dir /B *.h>> my.lst
dir /B *.hpp>> my.lst

But it is better to use the project file .vcproj or .vcxproj. Then the list will not get random files are in the folder, but do not belong to the project, either in the project, but excluded from the build.

Example call localizer to list:

localizer.exe -list +greenwin.vcproj =greenwin.lst

File greenwin.lst here optional, just if you want to see what files get into treatment.

Step 4. Specify the strings to be localized. It is necessary to search for all literals of the project file (for example, the symbol ") and mark with prefix all literals that must be localized. Of course, it may be marked as general, all strings, but it is unnecessary. It should mark only those strings that can appear differently in different languages.

The process can be accelerated by applying a localizer:

localizer.exe -mark LS +greenwin.vcproj

This prefix will be automatically placed in front of all literals containing letters, and will only remove the excess.

Main Localization File Creation

Step 5. Main Localization File Creation:

localizer.exe -get LS +greenwin.vcproj greenwin.eng.loc

At this stage the analysis of the sources and the collection of strings to be localized in the main .loc file (in this case greenwin.eng.loc). The whole process is fully automatic.

It is possible the following situations:

- The main language file is not created. He is considered empty and is re-created.

- The main language file already exists. Then its content is downloaded and compared with the scan results.

- When scanning is already discovered a localized string that is not in the .loc file. For example, occurs ID LS__OK. Localizer will warn you about this. The reason may be that was taken out of date version of the source where this string is used. It is desirable to get rid of such identifiers.

- When scanning is already discovered a localized string that is in the .loc file. This is a normal situation. This means that the file already localized before and contents of the string is stored in greenwin.eng.loc.

- When you scan revealed a string to be localized. Its content is equivalent to one of the strings in greenwin.eng.loc. This is a normal situation. For all the same strings used by a single repository, so that this string will simply refer to the existing string, and it will use the same identifier.

- When you scan revealed a string to be localized. Its contents do not appear on any of the strings in greenwin.eng.loc. This is a normal situation. For such a string will be automatically generated unique identifier (letter by letter and figures from the beginning of the string) and its contents will be stored in greenwin.eng.loc.

- In greenwin.eng.loc is a string that is not mentioned in the project, and none of the strings to be localized, does not contain such a text. The reason may be due to the fact that this string has been found before, but since the file from which it was taken, was removed. Or was removed a piece of text, where it was taken. Such strings should be removed from greenwin.eng.loc, not to occupy too much space. Will be issued a warning that the string is deleted. The file greenwin.eng.loc before this string will comment /!REMOVE!/. Remove it from there manually, or run the localizer with the option "-remove". Default such strings are not removed from greenwin.eng.loc just in case you edit the file back, and it reappears this identifier. Such strings will not be loaded into memory during execution.

Step 6. Adjusting the main localization file.

Now you can make in greenwin.eng.loc manual corrections, if needed. Basically it makes sense to automatically generated identifiers - if they are not "beautiful". If this ID is already in use in the program, it must be corrected. But the sort you should not do, it will be restored the next time you call a localizer.

String Localization

Step 7. String Localization

localizer.exe -put LS +greenwin.vcproj greenwin.eng.loc

At this stage the modification sources. All strings subject to localization, like LS"..." are replaced by pointers like LS__... In addition, in each file, where there are strings added declarations:

/*--LOCALIZER DECLARATIONS--  Localizer: LS --BEGIN-- */
extern const char 
	*LS__..., *LS__...;
/*--LOCALIZER DECLARATIONS--  Localizer: LS --END-- */

These declarations are automatically generated and automatically maintained in the correct position for each call "localizer.exe -put..." The place for such declarations also set automatically before the first function or announcement, but after the initial comments, blank strings and directives (like #include). If you not satisfied automatically selected location, this piece of code can be moved above or below, and subsequent calls "localizer.exe -put..." will write the declaration is there.

The program keeps track of which files really need to change, and does not touch the rest. This reduces the amount recompilation.

Instead "-put", you can use command "-puttest", then the original files will not be changed, and instead are generated with the extension ".rez". This is useful if you do not want yet to localize project, but want to see what happens as a result of the generation.

Step 8. Compile program

Now you need to get rid of compilation errors that might occur. The main reason may be that, that literals have been replaced by pointers. Given that it's almost apples to apples, there are some subtleties which may play a role. The most common case:

static char mystring[] = LS"mystring";
- Becomes:
static char mystring[] = LS__mystring;
- And this compile error.

To fix this string simply removed, and everywhere instead "mystring" written "LS__mystring".

Fix the program in the right places, until you get to compiled (linking it still will not).

Please note that the localization is loaded at the time of execution "Localizer::load" function in the "main/WinMain/DllMain" (or where you are there insert a call). You should not use localized strings in the static objects that are created before the call "Localizer::load", because at the time of the creation of static objects of all the localized strings point to "". However, you can initialize static objects are pointers to pointers localized strings that do not change.

For example, suppose given a localized string identifier OK and the content "&OK". This means that:

- The source file specified ID:

extern const char * LS__OK;

- In .loc is a fragment:

OK=&OK

First LS__OK pointer points to "", but after localization loading will point to the string "&OK". In the static object You can save &LS__OK, and then make pointer dereference when the localization is already loaded.

Another case:

struct SomeClass
(
   char * text;
   int id;
)
static SomeClass bups = (LS "blin", 12);
- Becomes:
static SomeClass bups = (LS__blin, 12);
- And it is unpleasant, because the pointer LS__blin initialized too late.

This is corrected as follows:

struct SomeClass
(
   char **text;
   int id;
)
static SomeClass bups = (&LS__blin, 12);

cpp-module Generation

Step 9. cpp-module Generation.

A successful linking lacks generated [cpp] files. Do it:

localizer.exe -cpp LS greenwin.eng.loc greenwin_loc.cpp

Add this file to the project. Now Linking to take place normally.

bin-module Generation

Step 10. Generate binary.

localizer.exe -bin greenwin.eng.loc greenwin.eng.bin

This [bin]-file to be added to the distributive. In the installed program must be somewhere close to an executable file, so the program can find it and load the calling "Localizer::load".

Step 11. Download localization

Now you need to add to the code loading localized strings. Example already given above:

#include "localizer.h"
...
static Localizer localizer;
...
extern const char **LS_all[];
if (!localizer.load ("greenwin.eng.bin", LS_all))
    throw GInitException ();

In general, it is necessary to determine where a Localizer object and call the function load. The input is given by name [bin]-file and the array type prefix_all, which is defined in the generated [cpp]-file.

Step 12. Debugging

After this localized program is ready to launch. Make sure that everything works.

Updates

Step 13. Update localization.

All of these commands can be combined into one:

localizer.exe -auto LS +greenwin.vcproj greenwin.eng.loc greenwin_loc.cpp greenwin.eng.bin

If your project has changed for example, new strings to be localized, they have changed or removed, you must run this command. The program will conduct all the necessary changes if they are not needed then no file will not be affected, and recompilation is not required.

Translation

Step 14. Translation into other languages.

Once the program is debugged, you can translate into other languages. For this we must create additional files with the extension .loc. They should contain the same identifiers, but differebt contents of strings.

Step 15. Changing the language of the program.

Suppose you have created a version of greenwin.rus.loc, where all strings are translated into Russian. For him the need corresponding to a binary file, for example, greenwin.rus.bin. Add these files to a normal localizer call:

localizer.exe -auto LS +greenwin.vcproj greenwin_loc.cpp
   greenwin.eng.loc greenwin.rus.loc greenwin.eng.bin greenwin.rus.bin

Then we need to either replace the old file greenwin.eng.bin with this greenwin.rus.bin, or modify the loader call, so that loads a bin-modules depending on the desired language.

Merge

Step 16. Merge

If the program has changed and, consequently, changed the main language file [loc], and then translations the same must change accordingly. The same call to make and synchronize translations. If desired, this can be done as a specific command "-merge":

localizer.exe -merge greenwin.eng.loc greenwin.rus.loc

Localizer compare the two file locations to each other. In this case the first file has a higher priority considered a model.

All identifiers that are in the main file, but which are not in second, will be added to the second, and they must be translated. To facilitate the search of such places, before the identifier is added comment /!TRANSLATE!/

All identifiers that are not in the main file, but which is in second, will be removed from the second.

After this you should regenerate bin-module for that language (in the same universal calling or "localizer -auto" or special command "localizer -bin").

Project without bin-s

If your application can not load language file, the program is likely to be unworkable, because instead of many rows will be empty strings. In this case, you have the program exit. Error message (if any) must be non-localized string.

But you may want to ignore the absence of the localization file and work fine. In this case, add the option "-default" before the command "-auto" or "-cpp". As a result, in the cpp file will be written to all strings from [loc]. All variables are assigned to the strings from the main [loc]. Then an error loading the file can just ignore and continue executing the program with these strings.

Additional Options

Additional Options can be specified before the command in any order:

  • "-backup". Each time the program changes the file localization ([loc], [loc+]), it will create its a safety copy of the extension .bak.
  • "-verbose". This enables a more detailed messages.
  • "-remove". This option removes from the localization file all strings that are no longer used in the source. If you do not set this option, then all these strings will be marked with the comment /!REMOVE!/ and you need to remove them manually. By default, this option is disabled to avoid accidental strings deletion.
  • "-rawout". Writes all the strings in "raw" format. By default, strings are written in the format which were originally.
  • "-escout". Writes all the strings to "escape" format. By default, strings are written in the format which were originally.
  • "-raw". Creates a new rows in the "raw"-format. By default, new rows are created in the "escape" format.
  • "-default". Write to [cpp] not only the identifiers of rows, but their contents from the main localization file. This allows you to run the program without errors even in the absence of the localization file. The size of the program executable file in this case increases slightly (about the size of strings).
  • "-regenid". It only works with a command "-auto". Starts the process of generating the row IDs again. This option may be useful for those who like to have code in perfect order. If some strings have been removed or changed, it was originally generated identifiers may not match string content, as in the numbering similar strings may arise omissions.
    When you run the localizer will try to optimize the IDs and correctly correct them in the localization file and the source. Since this option can affect multiple files at once, recommended to make a safety copy of the project before its launch. It is strongly recommended to specify in command prompt all localization files to avoid their desync.
  • "-nosplit". By default in the "escape"-format text containing characters \n, divided into several strings for readability files localization ([loc], [loc+]). If the splittins is not desirable and necessary that all merged into one long string, you must specify this option.
  • "-config ConfigurationName". If your Visual Studio project there are several configurations (Debug, Release) and for each configuration using different sets of files (with the option Exclude From Build), then this option allows you to handle various different configurations.
  • "-unicode". Used for unicode-projects (16-bit unicode). Files localization [loc+] should be encoded in UTF-8 a loaded string will be of type extern const wchar_t *.
  • "-qt". Used for QT-projects. Files localization [loc+] should be encoded in UTF-8 a loaded string will be of type extern QString. It creates [bin] with 16-bit Unicode encoding.
  • "-qt8". Used for QT-projects. Like previous but creates [bin] with UTF-8 encoding. Loading may be slower but compartible with UNIX systems with non 16-bit Unicode.
  • "-remdups". If localization files contain duplicate identifiers them will be correctly united and superfluous ones will be marked to remove.
  • "-()". For -mark command. Generate strings like LCL("string") instead LCL"string".
  • "-prepend". Add a strnig to begin of [cpp]. Usually this useful for PCH-header, for example:
    -prepend #include""my_pch.h""
  • "-append". Similar add to end of [cpp] file.

Loading from Resources

Localized strings can be stored directly in the exe-file, but when the program starts load them from there. That course of action for such a project.

1. Create resource header (this is usually a file with extension .rh) add identifiers for resources. Something like:

#define IDLOC_ENGLISH 4000
#define IDLOC_RUSSIAN 4001

2. Create resource file (this is usually a file with extension .rc), add resources, indicating [bin]-localization files. Something like:

IDLOC_ENGLISH BINARY "interval_loc.bin"
IDLOC_RUSSIAN BINARY "interval_loc.rus.bin"

3. To load the correct localization use the loader "RLocalizer" and code like this:

#include "rlocalizer.h"
#include "resource.rh"
...
static RLocalizer localizer;
...
extern const char **LS_all[];
if (! localizer.load (IDLOC_RUSSIAN, LS_all))
  (error processing)

Unicode Localization

Localization of Unicode project has the following differences:

  1. When you call a localizer to use the option "-unicode".
  2. Localization files [loc+] should be encoded in UTF-8.
  3. Loaded strings will be of type const wchar_t *.
  4. Must use the loader "WLocalizer".
  5. Source files must be in ANSI or UTF-8.
  6. Localizable strings in the source codes to be written in ANSI or UTF-8. Mark with the localizer prefix and immediately run localizer. Either mark with the wide string prefix L and later replaced the prefix L to localizer prefix. Do not use string constructions specific for unicode syntax.

Qt Localization

Localization of Qt projects have the following differences:

  1. When you call a localizer to use the option "-qt" or "-qt".
  2. Localization files [loc+] should be encoded in UTF-8.
  3. Loaded strings will be of type QString.
  4. Must use the loader "QLocalizer".
  5. Source files must be in ANSI or UTF-8.
  6. Localizable strings in the source codes to be written in ANSI or UTF-8 Mark with the localizer prefix and immediately run localizer. Do not use string constructions specific for unicode syntax.

Prefix replacement

If you want change prefix use command like this:

localizer -prefix LS LSN +interval.vcproj

Here LS is old prefix, LSN is new one followed by list of files to scan.

Projects splitting or integration

Suppose you have a project you want to split into two, with each separate localization. To do this:

  1. Make usual splitting without localization
  2. Adjust localization scripts or .bat-files because some folders, project names or lists of sources may be changed.
  3. If you want use different prefix for second project then use command "localizer -prefix..." to auto replace prefixes instead manual replacement.
  4. Just clone all .loc files for both projects.
  5. Now run localization for every project. Since all the lines in them are duplicated, it would appear that the first project now uses some of the strings of the second one and the second one uses some strings from the first. All superfluous strings will be marked with comment "/!REMOVE!/". You can delete them by running localization with "-remove" option or manually.

Now assume that you have two projects that you want to merge including localization. To do this:

  1. Make usual merge without localization
  2. Adjust localization scripts or .bat-files because some folders, project names or lists of sources may be changed.
  3. If projects used different prefixes then use command "localizer -prefix..." to auto replace prefixes instead manual replacement.
  4. Unite all .loc files just with appending each other (e.g., with "copy" command with character "+").
  5. Now run the localization for each project. Might find that some string identifiers are duplicated. Run the localizer with the option "-remdups", to perform the union of these identifiers.