This is an open-source library designed to help C++ developer in creating of multi-language Windows application by using non-compiled PO-files. Project provide an utility to convert existing resources of application to PO-file. The PO-file is a native format of poEdit (a very convenient application for translators).
- Using poEdit or similar handy translation utility
- Every user can translate application by himself
- Simple integration to MFC Windows application
- Download and unpack latest ZIP-archive.
- Download and install poEdit.
- Add Localization.h and Localization.cpp from archive to your project for example to StdAfx.h and StdAfx.cpp files correspondingly.
- Add CLocalization class instantiation code and calls of CLocalization::Load() and CLocalization::Select() methods to load all available translations and to select current language.
- Add calls of CLocalization::Translate() methods to translate dialogs and menus.
- Replace CString::LoadString() by CLocalization::LoadString() to load localized strings.
- Compile your project.
- Run exe2po utility from archive for your binary file to produce initial POT-file:
"exe2po.exe your_application.exe your_application.exe.pot"
PO and POT files are the same but POT used by poEdit as template and PO as work translation file.
- Rename POT-file to PO-file by setting language identifier (in 2-digit or 4-digit hexadecimal format) of future translation. For example "your_application.exe.09.po" for English (0x09) or "you_application.exe.19.po" for Russian (0x19).
- Edit PO-file in poEdit and save it to folder of your application.
- Run your application to test and then repeat previous step.
- You can leave translated PO-files as-is near you application or embed PO-files directly to its resources. Just import files as "PO" (including quotes) resources and with resource ID equal to language ID. Library finds external PO-files at first place and only after that use embedded ones. So every user can help translate your application without recompiling.
Library can load translations in uncompressed or compressed formats (Lempel-Ziv algorithm only). Uncompressed files has ".po" extension and compressed ones has ".p_" extension. Compressed files can be produced by Microsoft File Compression Utility named "compress.exe". It can be found in any old Microsoft OS or Resource Kit. Usage example:
compress.exe you_application.exe.09.po you_application.exe.09.p_
Compressed files can be also inserted as resources (detected by magic number 'SZDD' at beginning of file).
Library uses WinAPI LZExpand library (Lz32.dll) to handle compressed files.
Note: Some versions of compress.exe produces incorrect compressed files (1 byte differ) just get another version of utility.
Microsoft (R) File Compression Utility Version 2.50
Copyright (C) Microsoft Corp. 1990-1994. All rights reserved.
© Николай Распопов