Forum Replies Created
-
AuteurArticles
-
Darn You WordPress!! is a very recent post about wishes for wordpress and his core.
Before to answer about the question about coherence or generic design of template tags (with optional echoing).
This recent post is an opportunity to write a short post about our choice of WordPress tools used since more than 4 years as blog or cms.Some arguments :
Open-source, large community, traceability of the developments, Reactivity of the groups, the possibility of concentrating on the fields of website or data models (CMS) – I do not have particular affinity for the fields of the security or mechanics like ajax
an architecture which makes it possible to build light code for visitor’s webside without interface:
Personally I prefer to write a simple number in css to change a color or a width or copy and paste a template tags in a theme file than to open a wysiwyg heavy desktop application to generate a 30 lines HTML file.a good data-model totally open for cms architecture (Instead creating new tables, for some plugins, we use the powerful taxonomies architecture).
A philosophy
On the visitor’s webside,
a broad (infinite) range of possible personalizations: from simple blog to cms corporate or groups website.On the admin (author’s or editor’s) side
Two modes to edit contents (via html or a wysiwg like editor)
On designer’s side – plugin, hook,…
Possible dangers and drifts :
Admin UI :
Client side vs Server side
Client/server versus HTML enriched by Ajax and JS (Excepted iPhone version or unfinished Mars Edit) I am interrogative about the evolution of dashboard and admin UI. Instead to create a powerful client application using the power of the client computer, with a slowdown of flowrate, WP try to recreate an good interface but with the side effects of html and a server shared by lot of users…Revision, Trash… Good, but if settings are not good, database will contains more drafts than public posts.
Flow rate 3G vs Optical or Cable – mobile or high speed: On visitor’s side, the target is again as 10 years ago, the shortest files as possible
Image processing announced in 2.9 – why not ? but what are consequences on servers. Hope that this features will be optional (I think it is better to prepare images before to sent them…)
Contrasts et contradictions:
If we analyse deeply the previous paragraphs, it is visible that it is not easy to choose the good way for further developments or fixing issues…Targets:
End users without knowledge in php, html or css are not identical to general or « WP specific » programmers. The choices must leave open the two ways without closing the other.Upgrading:
Even if I can test the nightly built on a local server, on production server, I wait always the first sub version (i.e 2.8.1)About the code and the source :
What could we expect?
We know that we are a little slave of the history of the product (obsolete functions) but sometime, for a new branch, a new rewritten template tag or a renewed function is better.
Evaluating consequences of a modification is not easy particularly for the innumerable themes or plugins.
But we find again here the advantages of open source… where each developer participates for the whole communauty.coherence, robustness, shortest sources,… Theses properties are well known but must be periodically remembered.
writing conventions: unique ID for dev – avoiding conflicts – naming with unique prefix – are some wished properties or recommandations.
param like string or args in array: passing params in a concatenate string or with an array is very powerful and offers future evolutions or personalization. Instead a template tag (like wp_list_pages), the_tags today don’t allow it…
Example of the template tag – the_tags() – with only display list of tags attached to a post in the loop. (three params)
During analyzing this template tag, you discover a deep stacking like a Russian headstock.
And to create the same function but sub-selecting some tags (ie of a language as in xili-tidy-tags plugin) the function is not ‘as is’ usable. Consequently the extension must contain a new function and the theme’s designer must include this new template tag.Note: a ticket on trac will be soon published with examples. Just need time to prepare and write it.
Michel
dev.xiligroup.comOriginally, 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
[caption id="attachment_1200" align="alignright" width="200" caption="Languages list for localization"][/caption](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
[caption id="attachment_1203" align="alignleft" width="286" caption="The box of translation"][/caption]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
[caption id="attachment_1213" align="alignnone" width="300" caption="Add a reference term in 2 clicks"][/caption]
Just add the term and click add (not need to set language (=default)).
[caption id="attachment_1214" align="alignnone" width="300" caption="To add a translation referring to a term"][/caption]
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
\n" "Language-Team: dev.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)
[caption id="attachment_1228" align="aligncenter" width="300" caption="mo example"][/caption]
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
[caption id="attachment_1230" align="alignright" width="300" caption="Modifying a translated term"][/caption]
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
(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…
xili-dictionary – une extension pour wordpress qui crée et gère un dictionnaire multilingue stocké dans les taxinomies de la base WP. Cette extension gère notamment les fichiers .po et .mo du thème courant qu’il soit international ou multilingue en ‘temps réel‘. Version compatible avec WP 3.0 en mode mono ou multisite.
[tabs-group]
[a-tab tabtitle="Description"]
[caption id="attachment_773" align="alignright" width="128" caption="logo xili-dictionary"][/caption]
xili-dictionary est une extension (compatible avec xili-language) qui crée et gère un dictionnaire multilingue stocké dans les taxinomies de la base WP. Cette extension collecte les termes et mots des catégories (titre, description), du thème courant – expression internationale des fonctions _e(), __() ou _n(). Il est possible de créer et mettre à jour les fichiers .mo du dossier du thème courant international. xili-dictionary est compatible avec l’extension xili-language et l’extension xili-tidy-tags pour des thèmes multilingues ‘live‘.
[/a-tab]
[a-tab tabtitle="Nouveau !"]Version actuelle 1.2.0
voir page en anglais pour plus détail 😉
1.0.0
Cette version reprend l’essentiel de xili-dictionary 0.9.9 mais ne fonctionne que pour les versions 2.8 et suivantes de WordPress. En effet, elle utilise les bibliothèques et classes du dossier POMO présent dans wp-includes.
Les principales nouveautés sont :
– une amélioration de l’interface de saisie,
– la possibilité de créer des traductions au pluriel (msgid_plural),
– la possibilité d’avoir plus d’enrichissement html au sein des lignes traduites.Quelques fonctionnalités sont instables notamment celles de l’importation des termes d’un thème notamment si celui met trop d’espace dans les fonctions __() et _e()
[/a-tab]
[a-tab tabtitle="Installation"]- Télécharger le dossier contenant le fichier xili-dictionary.php et annexes dans le dossier /wp-content/plugins/ ,
- Vérifier que votre thème courant est ‘localisable’ avec des fonctions comme _e(‘the term’,’mytheme’) ou __() et que les textes à traduire ne sont pas codés en dur –
- activer et aller à la page Dictionnaire dans le menu Outils
[/a-tab]
[a-tab tabtitle="Q. R."]Est-ce que la ligne msgid peut contenir des tags html ?
comme ou
Oui, le msgid (la référence) peut en contenir depuis la version 0.9.7.
a good word
peut ainsi être traduit par
un mot exact
Où sont des sites qui utilisent xili-dictionary ?
dev.xiligroup.com ici et http://www.xiliphone.mobi là qui est aussi adapté à l’iPhone.
Quelle est la différence entre la ligne msgid et celle msgtr dans un fichier .po ?
La ligne msgid est égale au premier argument des fonctions _e() or __() qui sont le mot, la phrase de référence (souvent en anglais). msgstr est la traduction dans le fichier de la langue cible : par exemple fr_FR.po pour une fichier français. (le fichier compilé est nommé fr_FR.mo et il est dans le dossier du thème. La langue de référence dans WordPress est en_US. Si quelques termes méritent des adaptations, xili-dictionary peut créer un fichier en_US.mo spécifique qui contiendra uniquement les termes adaptés.
Est-que l’on peut utiliser xili-dictionary sans xili-language pour éditer les fichiers .po ou .mo ?
Oui sous certaines conditions et si les langues sont dans le catalogue par défaut. Il faut aussi indiquer à l’extension l’endroit où sont regroupés les fichiers .mo.
define('THEME_LANGS_FOLDER','/nameoflangfolder'); // in Fusion: /lang
Qu’en est-il de la version WP 2.9 ?
Aujourd’hui, ne fonctionne qu’avec des fichiers .mo or .po avec des couples de lignes msgid msgstr pour thème avec des fonctions comme _e(), __() ou _n() pour la localisation.
[/a-tab]
[a-tab tabtitle="Copies d'écran"][caption id="attachment_1158" align="alignnone" width="300" caption="xili-dictionary : écran d\'admistration"][/caption]
[caption id="attachment_1159" align="alignnone" width="480" caption="xili-dictionnary gère la traduction des pluriels"][/caption]
[caption id="attachment_1160" align="alignnone" width="300" caption="La saisie d\'un terme et de son pluriel"][/caption]
[caption id="attachment_1161" align="alignnone" width="300" caption="Les traductions et les deux (ou plus) pluriels"][/caption]
[/a-tab]
[a-tab tabtitle="Autres infos"]La version 1.2.0 est destinée aux utilisateurs et créateurs de thèmes multilingues pour WP >= 2.9.
Voir aussi le forum dev.xiligroup.
[/a-tab]
[a-tab tabtitle="Téléchargement"]Le catalogue des extensions WordPress :
http://wordpress.org/extend/plugins/xili-dictionary/download/
[/a-tab]
[/tabs-group]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 **
< ?php printf(_n('%d file', '%d file', $number, 'themedomain'),$number) ?>
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.
xili-dictionary is a multilingual dictionary storable in taxonomy and terms to create and translate .po files or .mo files for international themes or live multilingual themes. Now compatible with WP 3.0 both in mono and multisite mode.
[tabs-group]
[a-tab tabtitle="Description"]
[caption id="attachment_773" align="alignright" width="128" caption="logo xili-dictionary"][/caption]
xili-dictionary is a plugin (compatible with xili-language) to build a multilingual dictionary saved in the taxonomy tables of WordPress. With this dictionary, collecting terms from categories (title, description), from current theme – international terms with _e(), __() or _n() functions – , it is possible to create and update .mo file in the current theme folder. xili-dictionary is full compatible with xili-language plugin and xili-tidy-tags plugin.
[/a-tab]
[a-tab tabtitle="New !"]1.2.0
compatibility with child theme and xili-language >=1.8.1
better folder detection1.1.1
fixes some issues (cache update, empty .mo), add some UI features and keep new features from xili-language 1.6.0
add features in differential saving (theme’s mo and other languages saving in each site of multisite mode).
used currently in this demo website.1.0.5
* introduces some improvements specifically for WPMU and management of .mo of theme shared by each site and particular translated file of one site of wpmu.
* now possible to import .pot file if the name of this file is the name of the theme tex domain. (twentyten.pot in twentyten default theme)
* minor modifications for WP 3.0 and WPMU (for tests before future and specific improvements for wpmu 3.0)
* fixes some directories issues in (rare) xamp servers and in theme’s terms import.
* Create .po with empty translations. Helpful if you send the .po file to a translator that uses app like poedit.1.0.2
Now also can be used for international themes (with localization for a monolingual blog or cms) when you want to add or edit a current translation file. See this post.
NEW 1.0.0
The release keeps most of the features and functions of previous 0.9.9 but only works on WP >= 2.8 because uses the powerful POMO libraries now included by WordPress.
and includes now :
– a better admin UI,
– manage plural original and translation (msgid_plural, msgstr[x],…),
– more possible html tags in msgSome features (importing themes words to fill msgid list) are not totally stable (if coding source is crazy – too spacing !)…
[/a-tab]
[a-tab tabtitle="Installation"]- Upload the folder containing xili-dictionary.php and language files to the /wp-content/plugins/ directory,
- Verify that your theme is international compatible – translatable terms like _e(‘the term’,’mytheme’) and no text hardcoded –
- active and visit the dictionary page in tools menu
[/a-tab]
[a-tab tabtitle="F.A.Q."]Is the term msgid may contain words enriched by html tags ?
like or
Yes, since version 0.9.7.
a good word
can be translated by
un mot exact
Where can I see websites using this plugin ?
dev.xiligroup.com here and http://www.xiliphone.mobi here also usable with mobile as iPhone.
What is the difference with msgid and msgtr in .po file ?
The msgid line is equal to the term or sentence hardcoded in the theme functions like _e() or __(). msgstr is the translation in the target language : by instance fr_FR.po for a french dictionary. (the compiled file is fr_FR.mo saved in the theme folder. The root language is in WordPress currently en_US, but with xili-dictionary, it is possible to create a en_US.mo containing the only few terms that you want to adapt.
Is xili-dictionary usable without xili-language to edit .po or .mo file ?
With certain conditions, the language must in the default list and if the language files are not in the root of the current theme, you must add this line in functions.php file of this theme (normally set before xili-language is installed) :
define('THEME_LANGS_FOLDER','/nameoflangfolder'); // in Fusion: /lang
What about WP 2.9 ?
Today works with .mo or .po with singular twin msgid msgstr couple of lines or plural msgid/msgstr and themes with functions like _e(), __() or _n() for localization (‘_n()’ soon in importing from theme).
[/a-tab]
[a-tab tabtitle="Screenshots"][caption id="attachment_1158" align="alignnone" width="300" caption="xili-dictionary: admin settings UI"][/caption]
[caption id="attachment_1159" align="alignnone" width="480" caption="xili-dictionnary manages plural terms"][/caption]
[caption id="attachment_1160" align="alignnone" width="300" caption="Plural term editing"][/caption]
[caption id="attachment_1161" align="alignnone" width="300" caption="Translation with one or more plural"][/caption]
[/a-tab]
[a-tab tabtitle="More infos"]They talk about
Here some links where users talk about xili-dictionary plugin :
in WordPress ForumA topic is open on dev.xiligroup forum –
[/a-tab]
[a-tab tabtitle="Download"]WordPress plugins repository :
http://wordpress.org/extend/plugins/xili-dictionary/download/
[/a-tab]
[/tabs-group]Here, you can find a post where installation of xili-theme is more detailed : here. At the end another link is to download an example of iPhone Theme : example.
Today, dev.xiligroup don’t provide another free theme for iphone as presented in dev.xiligroup.com or http://www.xiliphone.mobi (when visited from an iphone) where we try to use marvelous features of iphone-safari (css, js, etc…).
Hope to find time to do that or, better, a commercial opportunities…
M.
New Post Notification is a simple plugin to send short notification to a choosen email address when a new post is created. Useful for simple forum with only one moderator. This first version was a way to discover rich features of bbPress code and source like in WordPress.
Download the lastest version
in bbpress repository xili-bb-np-notification
or here as file if bbPress server not yet updated :http://plugins-svn.bbpress.org/xili-new-post-notification/tags/0.9.2/
[readme-parser url="http://plugins-svn.bbpress.org/xili-new-post-notification/tags/0.9.2/readme.txt"]
Those who want to test the plugin « cache-translation-object » from Johan must wait the intermediate release 1.1.9 !
This release adds new features dedicated to multilingual theme’s creators and webmasters. Some new php functions, a folder to include functions shared by themes (not necessary to put functions in functions.php of the current theme); example with a shortcode to insert link inside content toward another post in a language. A post explaining these improvements can be found here. Since this release, xili-language is also tested with future wordpress 2.9-rare.
-
AuteurArticles