note 42631 added to function.bind-textdomain-codeset
| From: | duckx at mezimail dot com | Date: | Mon, 24 May 2004 15:33:24 +0000 |
| Subject: | note 42631 added to function.bind-textdomain-codeset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70027@lists.php.net to get a copy of this message | ||
First the the url of the gettext manual changed:
http://www.gnu.org/software/gettext/manual/
Secondly, lets explain a little bit what this fonction does.
By default, gettext will use the LC_CTYPE of the language you choose (for example fr_FR).
This LC_CTYPE is extracted from your locales.alias file in your configuration dir (Should be
/etc/locales.alias).
By default, the encoding is frequently iso-8859-1.
So if you want to make your site utf-8 aware, you need to bind your domain with the right encoding.
Here is a sample:
<?php
$locale="fr_FR.UTF-8"
setlocale(LC_MESSAGES, $locale);
$domain = 'your_text_domain';
bindtextdomain($domain, './translations_path');
textdomain($domain);
bind_textdomain_codeset($domain, 'UTF-8');
?>
As quoted in other notes, the translations path should be like
/translations_path
/de_DE/
/LC_MESSAGES
/fr_FR/
/LC_MESSAGES
...
Your translation goes in the LC_MESSAGES dirs ... Hopes this helps :)
----
Manual Page -- http://www.php.net/manual/en/function.bind-textdomain-codeset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42631
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42631&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42631&report=yes
Search -- http://master.php.net/manage/user-notes.php