26.01.2018 12:54, Werner Pamler via Lazarus пишет:
> 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.

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.

> 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?

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.

-- 
Best regards,
 Maxim Ganetsky                  mailto:gan...@narod.ru
-- 
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to