note 21251 modified in function.gettext by danbrown

From: Date: Tue, 08 Sep 2009 22:31:23 +0000
Subject: note 21251 modified in function.gettext by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160337@lists.php.net to get a copy of this message
There's a good tutorial to the GetText tools used with PHP at http://zez.org/article/articleview/42 The only modification I needed to do was to use the correct ISO-language/country-codes (don't know the ISO number) and call setlocale. helloworld.php: <?php putenv("LC_ALL=da_DK"); // For danish/Denmark setlocale(LC_ALL, ""); // ./locale/da/LC_MESSAGES holds the helloworld.mo file bindtextdomain("helloworld", "./locale"); textdomain("helloworld"); print(gettext("Hello world!")); ?> I had a lot of trouble getting this to work on Red Hat (Yellow Dog) Linux though. --was-- There's a good tutorial to the GetText tools used with PHP at http://zez.org/article/articleview/42 The only modification I needed to do was to use the correct ISO-language/country-codes (don't know the ISO number) and call setlocale. helloworld.php: putenv("LC_ALL=da_DK"); // For danish/Denmark setlocale(LC_ALL, ""); // ./locale/da/LC_MESSAGES holds the helloworld.mo file bindtextdomain("helloworld", "./locale"); textdomain("helloworld"); print(gettext("Hello world!")); I had a lot of trouble getting this to work on Red Hat (Yellow Dog) Linux though. http://php.net/manual/en/function.gettext.php

« previous php.notes (#160337) next »