xili-dictionary for international themes

Originally, xili-dictionary plugin was designed for realtime multilingual theme managed by xili-language plugin.
Since 1.0.2, it is now possible to use xili-dictionary to manage (or improve) translations of international (with localization) themes like kubrick , fusion, arclite or others.

A case study :

F.A.Q :
  • Your current theme is shipped with translation in your language but you are not totally satisfied with some words or sentences
  • The current theme is international ready but your language is absent. And you don’t have desktop application like poEdit.
  • You have designed your own theme with localization features (with __() and _e() functions) and a theme domain. and you want to deliver translations .po and .mo files.

Step by step :

The list of languages

Languages list for localization

Languages list for localization

(in realtime multilingual CMS website, the languages list is managed by xili-language plugin which detects the language to display according the post’s language). Here, in localized theme for a blog in only one language, xili-dictionary create an internal languages list is present in a new sidebox as here.
In this box, you can delete unused languages of the default list and (or) add a language described by his ISO code like ru_RU (russian) or fr_CA (french for Canada – few diffs with fr_FR) or others like Chinese – 中文 (zh_CN) Hong Kong (香港) (zh_HK) Taiwan (臺灣) (zh_TW).
This code is currently used in constant WPLANG of the wp-config.php of WordPress folder.
The box to edit

The box of translation

The box of translation

The name of the language will appear in the edit box in where you add translation. With the popup, you will choose the target translation and the reference term currently in english. This reference term is hard coded inside the translation functions of the theme. (will become each first line (msgid). The translated term (msgstr) is the second line of the series of coupled lines that po file contains.
Adding a term

Add a reference term in 1 click

Add a reference term in 2 clicks

Just add the term and click add (not need to set language (=default)).
To add a translation referring to a term

To add a translation referring to a term

More (only three) clicks to add a translation referring to a term and a language. Enter the term, choose his language and choose the referring (msgid) term in the popup.
Pause to go back to technical foundations

The translations in WordPress are based on GNU gettext functions. Here it not the purpose to go inside but only to see what are the content of .po files and his ‘machine’ optimization .mo files: 
exemple of .po (here french example)

msgid ""
msgstr ""
"Project-Id-Version: xili_language\n"
"POT-Creation-Date: 2009-04-04 11:58+0100\n"
"PO-Revision-Date: 2009-10-25 12:15+0100\n"
"Last-Translator: dev.xiligroup.com <contact@xiligroup.com>\n"
"Language-Team: dev.xiligroup.com <contact@xiligroup.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: French\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-SearchPath-0: trunk\n"
msgid "A new language was added."
msgstr "Une nouvelle langue a été ajoutée."
msgid "Language to update."
msgstr "Langue à mettre à jour."
msgid "A language was updated."
msgstr "Une langue a été mise à jour."
msgid "A language to delete."
msgstr "Langue à effacer."
msgid "A language was deleted."
msgstr "Une langue a été supprimée."

After the header containing all sources and translators informations, there is a series of couple of line containing the reference text (msgid) present inside the source and his translation (msgstr) displayed for end users. 
exemple of .mo (here only extracts)

mo example

mo example

A .mo file is not currently readable in text reader because it is coded but can very rapidly read by php code script.
xili-dictionary help you to manage ‘on line‘ current tasks without desktop applications like poEdit or LocFactory or other apps using terminal user’s interface.
Edit or modify a translated term

Modifying a translated term

Modifying a translated term

After typing, in only one click a term is updated. You see his reference term. CAUTION: a reference term can be modified if the term inside the php script was modified by the designer.

More info about reference term

Editing a reference term (msgid)
(from arrow to arrow): the term is on the top. The language is « default » because it is the reference. In the relationship fieldbox : the available translations : useful if you use xili-dictionary after creating a theme to deliver translation files for some countries. (of for multilingual websites if xili-language plugin is activate). 

Tips and tricks

Question: How to create a country adaptation of a generic po file (example from a fr_FR.po translation to a fr_CA.po) ?
Answer: As you know, some translation needs some modifications to be adapted to a country. So it is easy. You add the fr_CA (Québec) inside the list of xili-dictionary. On the server, you make a clone of fr_FR.po file renamed as fr_CA.po inside the lang folder. After that, import the .po file, sub-select in terms list management « fr_CA » and line by line inside the Multilingual main window, Edit the terms that you want to modify. When you are ready, create the fr_CA.mo file (Import & Export sidebox). Finally, verify that your wp_config is based on fr_CA for current language.

Question: Some PO files contain comments about the origin of the reference term (msgid): why they disappear when transformed by xili-dictionary ?
Answer: Today, xili-dictionary is ready to manage comments but it was decided not to keep them inside database because the dictionary can be used for more than one theme (or versions of theme).
CAUTION: xili-dictionary only manage the language files (.po, .mo) of the CURRENT theme.
Very soon: more steps…


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

Laisser un commentaire