Page 1 sur 1

Gettext to Array

Posté : 20 févr. 2017, 22:02
par Elie
Hello,

Je me sers de la class PHP Gettext : https://github.com/oscarotero/Gettext
Je suis en train de mettre en place le système pour basculer d'une page à l'autre et je voudrais recuperer un tableau de tous les mots francais et de tous les mots anglais pour pouvoir les comparer.

Je récupère une objet et je voudrais le passer en tableau PHP.

Je ne sais pas si certains utilise cette class et save comment trouver un mot dans toutes les langues disponibles ?

Bref c'est pas très clair mais je ne sais pas comment expliquer :/

Code : Tout sélectionner

Gettext\Translator Object ( [domain:Gettext\Translator:private] => [dictionary:Gettext\Translator:private] => Array ( [] => Array ( [] => Array ( [] => Array ( [0] => Project-Id-Version: PoEdit Report-Msgid-Bugs-To: Last-Translator: Language-Team: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POT-Creation-Date: 2017-02-20 20:14+0100 PO-Revision-Date: 2017-02-20 20:14+0100 Language: en X-Generator: Poedit 1.8.11 X-Poedit-Basepath: ../../../.. Plural-Forms: nplurals=2; plural=(n != 1); X-Poedit-KeywordsList: __;ngettext X-Poedit-SourceCharset: UTF-8 X-Poedit-SearchPath-0: . : msgid "Aujourd'hui, j'ai mangé une %s"msgstr "Today, i ate an %s"msgid "pomme"msgstr "apple"msgid "Salut comment ca va ?"msgstr "Hello, How are you ?"msgid "%d fenetre"msgid_plural "%d fenetres"msgstr[0] "%d window"msgstr[1] "%d windows"msgid "Pomme"msgstr "Apple"msgid "Aujourd'hui, j'ai mangé"msgstr "Today, i ate an" ) [About <strong>TheBox</strong>] => Array ( [0] => About <strong>TheBox</strong> ) [Studio de post production] => Array ( [0] => Post production company ) [Films] => Array ( [0] => File ) [Print] => Array ( [0] => Impression ) [Heathen] => Array ( [0] => Heathen ) [Projet] => Array ( [0] => Project ) [Contactez-nous] => Array ( [0] => Contact us ) [Retour] => Array ( [0] => Back ) [Lecture de la vidéo] => Array ( [0] => Play the video ) [Categorie] => Array ( [0] => Category ) [Recherche] => Array ( [0] => Search ) [À propos] => Array ( [0] => About ) [Contact] => Array ( [0] => Contact us ) [Ouvrir le menu] => Array ( [0] => Open the menu ) ) ) ) [plurals:Gettext\Translator:private] => Array ( [] => Array ( [count] => 2 [code] => return ($n != 1);; ) ) )

Re: Gettext to Array

Posté : 20 févr. 2017, 23:46
par Elie
Bon bah je me suis servi d'une autre classe pour parser le fichier PO : https://github.com/raulferras/PHP-po-parser
Dommage que cela ne soit pas de base dans la class gettext