[Fwd: Re: PHP+gettext (was Re: My stab at the templates)]
- From: Christian Rose <menthos menthos com>
- To: "gnome-web-list gnome org" <gnome-web-list gnome org>
- Subject: [Fwd: Re: PHP+gettext (was Re: My stab at the templates)]
- Date: Fri, 29 Jun 2001 21:55:50 +0200
-------- Original Message --------
Subject: Re: PHP+gettext (was Re: My stab at the templates)
Date: 29 Jun 2001 21:33:37 +0200
From: cgabriel softwarelibero org (Christopher R. Gabriel)
To: Christian Rose <menthos menthos com>
References: <992502024 2600 1 camel tp pcxtreme>
<20010618232740 A9985 eventloop com> <3B2EE20D B1C664E8 menthos com>
Christian> A slightly modified example from the php gettext page:
Christian> <?php // the following will be common for every page
Christian> and could be put in a // common inclusion file.
Christian> // Set language to German. This would obviously be
Christian> handled by // a system for choosing language and/or
Christian> using the one the // browser supplies. putenv
Christian> ("LANG=de"); // use all the locale variables. This can
Christian> be used for printing numbers // correctly (decimal
Christian> points/commas) and so on. setlocale(LC_ALL, ""); //
Christian> Specify location of translation tables bindtextdomain
Christian> ("gnomeweb",
Christian> "./path-to-where-the-language-catalogs-are"); // Choose
Christian> domain textdomain ("gnomeweb");
Christian> // This is how translations will be used in the
Christian> pages. _() is a shortcut // for gettext() and will show
Christian> the translated message. echo _("Welcome to Gnome
Christian> Web")."<BR>"; echo _("This should all be translated. If
Christian> you see this message in the language you entered, it
Christian> works"); ?>
Christian> That should be it. Whenever you add new content to the
Christian> site, you only have to put strings that you will show
Christian> inside _() and it should work.
Christian> Granted, I haven't tested that gettext in php works. If
Christian> anyone wants something to do... If you want help, just
Christian> ask. Or I'll have to wait until I have the time to test
Christian> this... :(
I'm using this extensively on http://furbo.firenze.linux.it, and it
works really fine. The code is available at
http://cvs.firenze.linux.it/cgi/viewcvs.cgi/furbo/
Cheers,
--
Christopher
There's an interference between the keyboard and the chair.
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]