gettext (was Re: [Fwd: Re: Time to code?])
- From: Christian Rose <menthos menthos com>
- To: gnome-web-list gnome org
- Subject: gettext (was Re: [Fwd: Re: Time to code?])
- Date: Sun, 21 Jan 2001 19:06:47 +0100
Steve Fox wrote:
> Excellent ideas!
>
> So has anyone started any code anywhere yet? I'd like to start working
> on something, but I fear my internationalization skills are lacking so I
> could probably use some help with that. I believe most people decided
> that using readline was the best way to go since that's what the
> translators are familiar with?
I suppose you mean "gettext". Yes, using gettext will probably be very
convinient as it will let the web site internationalization be very much
integrated with the i18n of other parts of GNOME, which will save huge
amounts of work (existing tools/dictionary systems can be used).
As someone pointed out, PHP has a gettext function
(http://www.php.net/manual/en/function.gettext.php). I haven't tried it
myself yet, though. But I suppose this makes i18n of a web page work
exactly the same as an ordinary application.
What I believe is needed from the developer's POV in enabling
translation for a page is first determining the language(locale) to be
used, and setting the appropriate locale environment variables (see the
gettext example) and then using the bindtextdomain() and textdomain()
calls. These calls would be identical for all translated www.gnome.org
pages, and could be included in some sort of header function with the
rest of initialization for the pages.
Then it's just to place all user-visible US. English strings and
messages in the page inside gettext() or _() calls: _("This message is
translated.")
>From the translators perspective, all he has to do is running a script
that extracts those messages by using xgettext. Such tools already exist
in the form of the GNOME xml-i18n-tools suite, which are GNOME tools
acting as wrappers around gettext, and adding support for more types of
message sources.
If xgettext itself does not grok how to parse .php files in the search
for _() messages, this support can be added to xml-i18n-tools (it
already supports .c, .cpp, .desktop, .oaf, .glade, .xml, and mime-type
files and who knows what =).
Anyway, once the messages are in a .po file and translated, gettext()
should handle the process of including the appropriate translation in
the web page. If a translation is not found for the particular message,
the original US. English text is shown (this is also how all other
translations work).
I know there are a lot of translators on this list, so I'm sure you will
get any help you need if you want to help making this work. I believe we
also have one of the xml-i18n-tool authors, Kenneth, on this list... =)
Christian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]