[Lazarus] Sharing translations between Lazarus and Delphi versions of the same project

Werner Pamler werner.pamler at freenet.de
Fri Jan 26 10:54:21 CET 2018

Currently I am porting the component TMoon to Lazarus 
(https://github.com/Ahoerstemeier/delphimoon). A goal is to be able to 
compile package and demo with Lazarus AND Delphi. The original demo is a 
multi-language application which achieves translation using resource 
strings in a (I guess) Delphi1-like, windows-specific way. Using the 
Lazarus system of po files really is very easy and much more versatile 
compared to that.

But now I am faced with the problem how to bring this back into the 
Delphi version. I know that the Lazarus translation system is based on 
gnugettext. I can add the unit gnugettext to the Delphi project. But how 
to continue? The original gnugettext requires the language to be 
specified as the name of a subfolder between "locale" and "LC_MESSAGES" 
(e.g., "locale/de/LC_MESSAGES/default.mo" for German), but Lazarus puts 
the language code into the po/mo file name (e.g., "project.de.po"). And 
I also don't get the point how to switch languages at runtime.

Does anybody have experience with a similar project? I mean: how to use 
the po files for both Lazarus and Delphi.

BTW: Working with the i18n options again I noticed that there are now 
two boxes "Excluded" > "Identifiers", "Originals" in the i18n project 
options. What can be put in there? Which effect does it have? Does it 
solve the issue that the same strings enter the po files again and again?


More information about the Lazarus mailing list