Category Archives: News

The latest post about xili-language trilogy

xili-language v 2.13: new rules, new features and improvements…

This week, xili-language plugin (and xili-dictionary) were improved and shipped…

  • tested and improved with WP 3.9.1
  • 2nd tab in settings UI reorganized to adjust front side (visitor side).
  • 5th tab to set dashboard side (authoring and various technical settings).
  • includes authoring propagate options previously available only in theme’s class (see new 5th tab in settings UI).
  • WARNING : users of child theme examples (bundled series like twentyten to twentyfourteen-xili) must update and use latest releases now available in github – backup before langs subfolder to keep previous translations –
  • widgets adapted for theme customize appearance screen (WP 3.9+).
  • improved choice in parent/child .mo files priority,
  • try to search local-xx_YY in wp-content/languages/themes (WP_LANG_DIR)
  • improved All content xml export for all authorized CPTs.
  • fixes – returns from developers and webmasters are welcome.
  • code cleanup.

More about .mo

xili-language multilingual plugin, since his creation five year ago, is based on two main things:

  1. the language of post (and custom post) is defined by the custom taxonomy “language”.
  2. the ‘live’ translation of terms is mainly based on .mo file of current theme (like translation in a localized website) of the current language. The plugin choose the right language according the current language assigned to the single displayed post, the home page or a list of posts.

Case of a standalone theme (w/o parent)

With a current theme with textdomain twentyfourteen (without child), for a french context, the file fr_FR.mo is loaded. (and if created by xili-dictionary or by hand with poEdit, the local-fr_FR.mo).
If the files are not found in a sub-folder of the theme, if, available in subfolder wp-content/languages/themes, the files twentyfourteen-fr_FR.mo and twentyfourteen-local-fr_FR.mo are loaded.
Be aware about that:
if a term or sentence (msgid) and his translation (msgstr) are in the fr_FR.mo and in the local-fr_FR.mo, the translation of local-fr_FR.mo has priority. It is a good thing if you are not satisfied by the translation delivered by the theme’s author!
local-xx_YY.mo currently contains translations of terms et sentences from the website itself (title, date format, categories,…).

Case of child and parent themes:

By default, only the .mo files availables in child theme are loaded.
To help translation strategy and versioning, it is now possible to use also files from parent theme languages folder. xili-language is able the define how will be done the merging between child and parent files.
As in above case, a local file is loaded from the current (here child) theme and has full priority.
For the other files (child and parent), you can define the priority, child or parent… By example, if you don’t want to modify the parent .mo files, so define child files as a priority.

The form is inside the screen under the 4th tab of xili-language settings.

merging .mo files option
merging .mo files option

xili-language version 2.11 shipped

Latest release (2.11) of xili-language shipped today.

Some new things for theme’s developers:

A conditional function – is_xili_curlang():
/**
* Test the current language of displayed page.
*
* @since 2.11
* use for other function elsewhere
* @param "" for undefined, slug of tested language alone or an array list
* @return true or false
*/
function is_xili_curlang( $lang = false ) {

This function is also usable in plugin xili-postinpost widget.

The oldest function of xili-language – the_curlang() – is improved and now is able to return the desired property of current language. Useful for choosing condition of part display according language.
/**
* Return the current language of theme.
*
* @since 0.9.7
* @updated 2.11.0
* use by other function elsewhere
* @param slug, iso, full name, alias, charset, hidden, count
*
* @return by default the slug of language (used in query).
*/
function the_curlang( $by = 'slug' ) { // soon obsolete
return xili_curlang( $by );
}
function xili_curlang( $by = 'slug' ) {

More available preset languages in list:

Now using list provided by jetpack, an almost complete list of languages is available with english name, native name and more…
In the list, if the native name is followed by a *, the language is not associated with wp_locale (an official language managed by WP.)

xili-dictionary version 2.6 shipped

xili-dictionary extension is shipped (2.6) and include now plugin language file management.
With taxonomy “Origin”, msgid and msgstr are assigned to the target plugin and it is easy to import terms in dictionary and to create, update language files of the target plugin.

xili-dictionary analyse header of plugin’s sources and this two items ‘Text Domain’ and ‘Domain Path’. If author omits to define them, xili-dictionary try to specify them according language files yet available in plugin’s folder.

M.