Voting

: five plus three?
(Example: nine)

The Note You're Voting On

duckx at mezimail dot com
20 years ago
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 :)

<< Back to user notes page

To Top