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

Maxim Ganetsky ganmax at narod.ru
Fri Jan 26 12:16:52 CET 2018

26.01.2018 14:05, Werner Pamler via Lazarus пишет:
> Am 26.01.2018 um 11:33 schrieb Maxim Ganetsky via Lazarus:
>> 26.01.2018 12:54, Werner Pamler via Lazarus пишет:
>> Maybe you can use adapted copies of translations.pas unit (from
>> LazUtils) and lcltranslator.pas unit (from LCL). They will need to be
>> ported for Delphi, though.
> Hmm... A lot of work for just a demo. No other way? Can't gnugettext be
> configured to use the Lazarus structure?

Don't know, TBH.

>>> 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?
>> PO file consists of entries. Each entry consists of (at least)
>> identifier name, original string value and translated string value. By
>> default IDE collects all captions from components on form. If you use
>> resource strings for translation at the same time you may want in some
>> cases to filter some strings.
>> For example, you have a form with caption 'Form1' and with some labels
>> in it. Then you translate this caption via resource string and all
>> labels by IDE means. In this case you will have in PO file 'Form1' entry
>> and entry for resource string which effectively replaces it. Obviously
>> you don't want to burden translators with 'Form1' entry. That is where
>> the filters are useful.
> Thanks for the explanation. It motivated me to play with these two
> boxes: If I don't want to  have the auto-generated entry 'Form1' to be
> in the po file I must enter this string in the box "Originals".
> Alternatively I can use the identifier of the caption in the box
> "identifiers" - it must be entered in the po syntax: "tform1.caption",
> or "tform1.button1.caption" for a button named TButton. What was
> confusing me is that the ignored entries remain in the master po and
> translated po files after these modifications. Only after "Clean up and
> Build" they do disappear. This, however, takes a long time because all
> required units are recompiled. Wouldn't it be better to have a menu
> command "Clean po file" which just rebuilds the rsj and po files?

You have for this:

1. 'Project Options' -> 'i18n' -> 'Force PO files update on next
compilation' check box at the bottom of the page.

2. 'Project' -> 'Resave forms with enabled i18n' in main Lazarus menu to
regenerate all .lrj files in project.

Best regards,
 Maxim Ganetsky                  mailto:ganmax at narod.ru

More information about the Lazarus mailing list