Hello,
i am intresting for what purpose resourcestring file is created when compiling program. Can it be translated and later compiled into executable? How this can be done?

Mailing lists / fpc-devel / 2004-12
5 messages · 4 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello,
i am intresting for what purpose resourcestring file is created when compiling program. Can it be translated and later compiled into executable? How this can be done?
The .rst file is created to provide a mechanism to localize your application. Currently, only one localization mechanism is provided: gettext.
The steps are as follows:
1. Compiler creates .rst file.
2. rstconv tool converts to .po (input for gettext) This file can be translated to many languages. All standard gettext tools can be used.
3. Gettext creates .mo files.
4. .mo files are read by gettext unit and all resourcestrings are translated.
The calls needed to translate all resourcestrings are in the objpas unit. They are documented.
Nothing stops people from creating a mechanism that does not depend on gettext. One could implement a mechanism to create resource DLL's (as delphi does) which contain the translated texts.
The reason gettext was chosen is that it's more or less standard on Unix. But Gettext is horribly inefficient, so if someone has a better idea, please do. Plus, GetText is context insensitive (it operates on the string itself), which is a drawback: sometimes the same word/sentence must be translated differently according to the context, and this is not possible.
To implement another mechanism, 3 things are needed:
1. Update rstconv so it can output another format.
2. Tools to manipulate the other format.
3. Implement a unit that loads the other is also the reason we create an intermediate file format: this was the compiler needs no knowledge of the translation tool. It just needs to create the .rst file.
An alternate way of doing it would e.g. be create a ini file per language, with a section for each unit used, and a key for each string.
-------english.ini-------------------
[sysutils]
SErrInvalidDateTime="%S" is not a valid date/time indication. -------dutch.ini-------------------
[sysutils]
SErrInvalidDateTime="%S" is geen geldige datum/tijd aanduiding. ----------------------------------------
This would allow reuse of various files.
Michael.
wrote:
Added to the wiki for future reference:
http://www.freepascal.org/wiki/index.php/Using_resourcestrings
I guess it's not in the docs yet else Michael would provide a link :)
On Wed, 29 Dec 2004 18:23:52 +0100, Florian Klaempfl wrote
Slightly updated (in Wiki).
Tomas
There IS a whole chapter in the docs. Programmer's reference.
I always assume people have actually read the docs before asking questions on the list.
(OK, you can call me an irresponsible optimist :))
Michael.