PO-Localization 1.0.0.4

PO-Localization #

PO-Localization

This is an open-source library designed to help C++ developers create multi-language Windows applications using non-compiled PO-files. The project provides a utility to convert existing application resources into PO-files. The PO-file is a native format of poEdit, a useful application for translators.



Sample screenshot (English) Sample screenshot (Russian)

Features #

  • The poEdit translation utility is used.
  • Any user can translate an application independently.
  • The MFC Windows application can be easily integrated.

Instructions #

  1. Download and unpack latest ZIP-archive.
  2. Download and install poEdit.
  3. Add Localization.h and Localization.cpp from archive to your project for example to StdAfx.h and StdAfx.cpp files correspondingly.
  4. Add CLocalization class instantiation code and calls of CLocalization::Load() and CLocalization::Select() methods to load all available translations and to select current language.
  5. Add calls of CLocalization::Translate() methods to translate dialogs and menus.
  6. Replace CString::LoadString() by CLocalization::LoadString() to load localized strings.
  7. Compile your project.
  8. Run exe2po utility from archive for your binary file to produce initial POT-file (PO and POT files are the same but POT used by poEdit as template and PO as work translation file): exe2po.exe your_application.exe your_application.exe.pot
  9. Rename POT-file to PO-file by setting language identifier (Language Identifier Constants and Strings) 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).
  10. Edit the PO-file in poEdit and save it to the folder of your application.
  11. To test, run your application and then repeat the preceding step.
  12. You can leave translated PO files near your application or embed them directly into its resources. Import files as “PO” resources (including quotes) with the resource ID equal to the language ID. The library first looks for external PO files and only after that uses the embedded ones. This way, every user can help translate your application without having to recompile it.

The library internally utilizes ATL for the CString, CAtlMap, and CAtlFile classes.

Compression #

The library is capable of loading translations in compressed or uncompressed formats, but only those compressed with the Lempel-Ziv algorithm. Uncompressed files have a “.po” extension, and compressed files have a “.p_” extension. Compressed files can be created using the Microsoft File Compression Utility, “compress.exe”. This utility can be found on any old Microsoft operating system or Resource Kit.

Example Usage:

compress.exe you_application.exe.09.po you_application.exe.09.p_

Compressed files can also be included as resources, detected by the magic number ‘SZDD’ at the beginning of the file.

The library uses the WinAPI LZExpand library (Lz32.dll) to handle compressed files.

Note: Some versions of ‘compress.exe’ produce compressed files with a single-byte difference. In such cases, obtain another version of the utility.

Applications #

Applications that use this library:

License #

Apache License 2.0

Copyright © 2011-2023 Nikolay Raspopov.

Microsoft ® File Compression Utility Version 2.50
Copyright © Microsoft Corp. 1990-1994. All rights reserved.