Le pluriel avec Zend_Translate Gettext et PoEdit
Bonjour,
Je désire utiliser Zend_Translate avec l'adaptateur Gettext pour internationaliser une application.
Connaissant mal Gettext et PoEdit (logiciel pour éditer les fichiers de traductions), j'ai effectué le test suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?php
$translate = new Zend_Translate('gettext',
'/mon/chemin/source-de.mo',
'de');
$translate->addTranslation('//mon/chemin/fr-source.mo', 'fr');
print $translate->_("Exemple")."\n";
print "=======\n";
print $translate->_("Ceci la ligne une")."\n";
printf($translate->_("Aujourd'hui nous sommes le %1\$s") . "\n",
date("d/m/Y"));
print "\n";
$translate->setLocale('fr');
print $translate->_("Correction de la langue ceci est la ligne deux") . "\n";
print $translate->plural("Il y a %1\$d article dans votre panier","Il y a %1\$d articles dans votre panier",$number) . "\n"; |
Voici le fichier .po généré :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| msgid ""
msgstr ""
"Project-Id-Version: test\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-05-28 01:12-0000\n"
"PO-Revision-Date: 2010-05-28 01:12-0000\n"
"Last-Translator: Traducteur <iletaitunfois@hotmail.fr>\n"
"Language-Team: Feng\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop;translate;plural\n"
"X-Poedit-Basepath: /home/feng/projets/1ersite\n"
"X-Poedit-Language: French\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-SourceCharset: utf-8\n"
"Plural-Forms: nplurals=2; plural=(n>1);\n"
"X-Poedit-SearchPath-0: application\n"
#: application/test.php:8
msgid "Exemple"
msgstr "Exemple"
#: application/test.php:10
msgid "Ceci la ligne une"
msgstr "Ceci la ligne une"
#: application/test.php:11
#, php-format
msgid "Aujourd'hui nous sommes le %1$s"
msgstr "Aujourd'hui nous sommes le %1$s"
#: application/test.php:15
msgid "Correction de la langue ceci est la ligne deux"
msgstr "Correction de la langue ceci est la ligne deux"
#: application/test.php:16
#, php-format
msgid "Il y a %1$d article dans votre panier"
msgstr "Il y a %1$d article dans votre panier" |
Je ne comprends pas pourquoi PoEdit ne reconnait pas mon pluriel.
En outre, comment puis-je faire pour séparer mes fichiers de traduction ?
Par exemple un fichier pour le menu, un autre pour le formulaire1, etc ; Côté Zend j'ai vu la doc ok, mais côté PoEdit ??