[lazarus] Language support

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Jul 23 04:18:08 EDT 1999




On Fri, 23 Jul 1999, Daniel wrote:

> -> It's always hard and trickous to translate an application when the development
> tool is not provided with translation facilities. This problem can be solve with
> powerful tools (but it's worth 50,000$ for the easiest to use and deploy !) or
> by implementaing this translations in the application layers. This last solution
> must be apply to every project that need translation, so it's heavy.
> 
> Translation of an application has multiple goals to achieve :
> 1) translation of messages in "text" (or caption, or over) properties :
    All messages that are directly entered on object browser in IDE.
> 2) translation of messages that are in source code
   (such as strings used for error messages like "ShowMessage('File missing'))
> 3) Date, time, currency, number format.
> 4) Translated messages reusability, so that already translated messages could be used by al lot of application without translating them again (I think "Exit" will be encountered quiet a number of times in a lot of application :-).
> 5) Certainly, I'm not exhaustive. :-(
> 
> Q1: Is it plan to introduce translation facilities in Lazarus ?

I have just implemented support for the Delphi 'resourcestring' section;

It works like in Delphi, only more powerful;
When compiling a program that contains resourcestrings, the compiler
generates a table with the resourcestrings in it; the RTL contains routines
for getting/setting the value of these resource strings.

The compiler also generates a file with all resourcestrings in your program:
A .rst (from Resource String Table) file with lines of the form
UnitName.ConstantName='The string'
(It can also generate such a file for each unit)

This file can then be converted to whatever you want: A resource dll on Windows
a MO file for GNU gettext on Linux (this is being worked on at the moment);

In principle it is then possible to design a unit, say NLS, that checks the OS
language setting, and sets all resource strings to the correct values;
This unit can be made with whatever system you like; you can even have
multiple units that implement different systems.

It is imaginable that Lazarus has facilities for manipulating the .rst file, and
providing some easy means of translation.

Concerning internationalization: the sysutils unit has all needed functionality
for internationalizing your application; it works exactly like in Delpi:

Michael.






More information about the Lazarus mailing list