Soluling home   Document home

Lazarus Localization and Internationalization

Lazarus Localization and Internationalization

Lazarus (Wikipedia) is an open-source Pascal IDE to create Windows, macOS and Linux applications. Lazarus uses PO format. Soluling localization tool and service support Lazarus.

The end of the document contains links to get the full source code of the samples. After reading this document, we recommend reading a tutorial about how to use Soluling.

Localization Process

Start Lazarus and open your project. Click Project | Project Options.

Project I18N settings

If you want to have the language files in a sub folder enter ther name of the folder in PO Output Directory. If left empty, the .pot and .po file wil be in the root directory.

Add DefaultTranslator unit in the uses section in your main form. Use resourcestring strings in your code whenever you want to localize a string. Run the application. All the strings from your form files and resourestrings are automatically externalized to a .pot file in the output directory. Use Soluling to localize the .pot file. Make sure that Soluling creates the localized files in <file>.<leg>.po format.

Output files

To run you application in a specific language enter

<yourapp> --lang <locale>

where the lang option specifies the language. To run project1.exe in Finnish enter

project1.exe --lang fi

Samples

GitHub and <data-dir>\Samples\Lazarus contains following samples:

Directory Description Notes
Simple A simple applicarion that contains few strings. Try this first!

In addition PO, PHP and Python samples show how to localize PO files.

Configuring gettext/PO Localization

You can configure how to localize your Lazarus PO file by selecting the item in the project tree, right-clicking, and choosing the Options menu. A source dialog appears that lets you edit the options. This source uses the following option sheets.

Settings