xili-dictionary : a short story ! what new ?

At the beginning, this plugin was created to manage internal dictionary of live multilingual themes. The original texts and translations were stored in taxonomies introduced with WP 2.3.
Just before shipping first public release of xili-language, it was decided to use commun features of GNU Gettext and .mo files delivered with international themes like kubrick or fusion. So xili-dictionary was improved to create or update .mo files (and .po files).
No need to use an external software like poEdit or terminal applications (msgfmt,…) to change or to adapt some translated texts of an international theme delivered with his .po files for most languages. All can be done online with few clicks. (see Jacob post.)

Why last version 1.0.0 ß ?

Until 0.9.9 beta release, xili-dictionary uses some short parts of GNU Gettext libraries. Since 2.8, WordPress has added a folder named pomo inside wp-includes sub-folder. POMO libraries contain functions and classes to manage mo and po files. Today only mo library is included in wp-settings but po library is available : xili-dictionary plugin includes it to manage po files (import and export).
These classes are full ready to manage plural forms of translation. So it is possible to add in theme function like _n() to display term which has plurals. (no need to have a term for singular and another for plural).

Example in po file :

in spanish

msgid « 1 file »
msgid_plural « %d files »
msgstr[0] « 1 fichero »
msgstr[1] « %d ficheros »

or it may look like this in a Polish translation:

msgid « 1 file »
msgid_plural « %d files »
msgstr[0] « 1 plik »
msgstr[1] « %d pliki »
msgstr[2] « %d plików »

in the theme, a display can be like :

** _n() replaces deprecated __ngettext **

<code><?php printf(_n('%d file', '%d file', $number, 'themedomain'),$number) ?></code>

xili-dictionary is now able to import and export .po file containing plural forms. It export also .mo files.

Some features are in the ‘todo‘ list for next releases :

– Setting Plural-Forms rule line of (.po / .mo) header for other than current languages (as « Plural-Forms: nplurals=2; plural=n>1 ») (see) ,
– Better UI for plural forms of translation 2 or more. (today ascetic way : a separator – [XPLURAL] must be written by hand !)
– and perhaps if more used or expected : management of contexts.

M.

Ce contenu a été publié dans News, xili-dictionary, avec comme mot(s)-clé(s) , , , . Vous pouvez le mettre en favoris avec ce permalien.

Laisser un commentaire