[Kroupware] translation efforts

Diego Rivera lrivera at racsa.co.cr
Thu May 8 12:44:09 CEST 2003


Gettext is most definitely better - especially if you're working with
PHP.

For example, in your setup, internationalizing the following pseudo-code
snippet:

{
    printf( "%s is not a valid option!\n", option );
}

Would mean the following:

LANG[ENGLISH][STR_INVALID_OPTION] = "%s is not a valid option!\n"
...
INTL_STRINGS = LANG[ENGLISH];
...

{
    char* INVALID_OPTION_STRING = INTL_STRINGS[STR_INVALID_OPTION];
    printf( INVALID_OPTION_STRING, option );
}

and the mapping of  for each language.  Note that I use arrays for
illustrative purposes only, and this happens in this way regardless of
whether it's done statically or dynamically.

While with gettext, you cut it down by letting gettext do that same
indexing:

{
    printf( _( "%s is not a valid option!\n" ), option );
}

And in the translation files for each language you'd have an entry like:

str "%s is not a valid option!\n"
msg "La opcion %s no es válida!\n"

Note the use of '_(...)' to enclose an internationalized string - this
would simplify internationalization efforts because one could
conceivable use sed or such to replace all '"'-enclosed strings with _(
"..." ), and thus automagically (or, at least, massively)
internationalize messages quickly (in case somebody forgot or didn't do
it initially).

This eliminates the need for memorizing "strange" indexes (i.e., was the
message at index SERVER_UNAVAILABLE or was it at
SERVER_CONNECT_FAILURE)?

I think gettext is the way to go, and it's very simple to use.  The
initialization code can be centralized in one place, app-wide, and then
using _() enables string internationalization.

Plus...I think most people doing I18N for Linux these days are going the
gettext() route because it's so widely supported.

On Thu, 2003-05-08 at 11:20, Jeroen Baten wrote:
> Op donderdag 8 mei 2003 18:24, schreef Frank Ochmann:
> > Hi,
> >
> > I am new to this mailing list so please bear with my missing knowledge
> > in some things.
> >
> > I would quite like to volunteer to translate the admin frontends of the
> > server into german, and am wondering if anyone else has done some work
> > on this already?
> >
> > As far as a method for translating is concended I do not know gettext
> > (as M. Konold suggested) - I would simply have an ressource file
> > included and replaced all english text with variables. The included
> > ressource file then would have the corresponding language expressions
> > for the original english text.
> 
> This would be my preferred solution too, but I am not a benevolent project 
> leader :-)
> 
> >
> > Any better ideas? Or is gettext already better?
> >
> > FO
> >
> > _______________________________________________
> > Kroupware mailing list
> > Kroupware at mail.kde.org
> > http://mail.kde.org/mailman/listinfo/kroupware
-- 
===========================================================
* Diego Rivera                                            *
*                                                         *
* "The Disease: Windows, the cure: Linux"                 *
*                                                         *
* E-mail: lrivera<AT>racsa<DOT>co<DOT>cr                  *
* Replace: <AT>='@', <DOT>='.'                            *
*                                                         *
* GPG: BE59 5469 C696 C80D FF5C  5926 0B36 F8FF DA98 62AD *
* GPG Public Key avaliable at: http://pgp.mit.edu         *
===========================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.kde.org/pipermail/kroupware/attachments/20030508/dc863e44/attachment-0001.bin


More information about the Kroupware mailing list