[Lazarus] Localization in toolkit like fpGUI

ik idokan at gmail.com
Tue Feb 19 09:30:45 CET 2008


Hi,

Well I don't like both ideas. Because when (?) fpGUI will support
Bi-Directional and other Unicode rules, you will require to have some
sort of code to find out what rule to apply on non direction and/or
other invisible chars (unless we add it to each text line).

However both GTK and QT are using gnu gettext, and it does work.
Please remember that fpGUI is more like GTK and QT then a single
executable. I also believe that if you'll make a library out of the
GUI, you will give chance to other programming languages to use it as
well.

So if you'll use the library way, gettext is the right solution, and
you must also think also on the chars you wish your program to
support.. So if you wish to use the one executable file, then you
should use the resourcesting solution IMHO.

Ido

On Feb 19, 2008 9:59 AM, Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> Hi,
>
> I know this is not directly related to Lazarus, but I thought with all
> the experience collected and that Lazarus supports localization, I
> might get some good ideas here...
>
> I want to localize the fpGUI toolkit. Standard dialogs, error
> messages, etc... What is the best way to approach this.
>
> 1) GetText: This was my first thought, but that means every fpGUI
> based application needs to ship with external .po files which I don't
> like and don't want. fpGUI based applications must preferably be a
> single executable at best.  GetText works great for your own
> applications, but not for the GUI framework I think.
>
> 2) Include files with Constants. This is what I'm starting with for
> now. A gfx_constants.pas unit with $Defines for each supported
> language. Depending on which define you have active, it will pull in
> the correct language .inc file with resource strings. If no define has
> been specified, it defaults to English. This obviously happens at
> compile time, but at least we have no external files to ship with a
> simple one file fpGUI based application. The only down side is when
> you add a new constant, you must remember to insert it into all the
> other language .inc files - though I'm sure I can create some tool to
> automate this.
>
>  eg:
> ----------------[ gfx_constants.pas ]---------------------
> ....
> resourcestring
>
> { Define Compiler language symbol (eg: gr for German) to include the correct
>   language resource file otherwise the Default (English) resource file will
>   be used. }
>
> {.$DEFINE gr}     // German
> {.$DEFINE ru}     // Russian
> {.$DEFINE fr}     // French
> {.$DEFINE pt}     // Portuguese
>
> {$IF defined(gr)}
>   {$I lang_german.inc}
> {$ELSEIF defined(ru)}
>   {$I lang_russian.inc}
> {$ELSEIF defined(fr)}
>   {$I lang_french.inc}
> {$ELSEIF defined(pt)}
>   {$I lang_portuguese.inc}
> {$ELSE}
>   {$I lang_english.inc}
> {$IFEND}
> ....
> ----------------[ end ]--------------------
>
> Example language include file:
>
> ------------[ lang_english.inc ]-------------
> {%mainunit gfx_constants.pas}
>
> rsLanguage               = 'English';
>
> // Buttons
> rsOK                     = 'OK';
> rsCancel                 = 'Cancel';
> rsHelp                   = 'Help';
> ...
> --------------[ end ]--------------------
>
> 3) ????  Anybody got any other ideas?  Remember, this is localization
> for a Toolkit, not for a application.  GetText works perfectly for a
> application.
>
>
> Regards,
>   - Graeme -
>
>
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
http://ik.homelinux.org/



More information about the Lazarus mailing list