flag as media

xili-language v. 2.15: easiest way to manage flags !

This week, xili-language version 2.15 will be shipped with important new features for webmasters and theme developers.

Even if flags in languages list have their limits(*), before it was necessary to be easy in css to replace name of language in language list (switcher).

(*) a language is currently used in several countries !

Some examples were delivered in the 5 bundled multilingual child theme examples like twenty fourteen xili presented here in live. A new version of each child will be shipped to incorporate these recent features introduced by xili-language 2.15.

With tools provided by the WordPress Core, xili-language plugin introduces:
- a way to assign flag quality to an image added to the media library,
- a way to assign this flag to a language,
- a new interface in Appearance menu to adjust some parameters,
- and an automatic process to generate style lines in webpage header.

Developers will find:
- a new add_theme_support() named ‘custom_xili_flag’,
- new filters to set their custom themes,
- new shortcode to use flag images uploaded in library by the web masters.

Some screenshots:

Below, in the media list, a picture is assigned as a flag (as the second assigned as header image)

flag example

flag example

Below, the screen shows the main option (flag or not flag), the list of available flags uploaded to media library and some very technical lines reserved for skilled and motivated users. For the five bundled themes, these values are provided as template style:

xili-language flag settings

xili-language flag settings

PROS:

  • choice of flags are free, no need to define a name or a type… plugin chooses the good picture uploaded and assigned to a language from the media library.
  • using filters, theme developers can deliver default values and settings.

CONS:

  • more code lines !

xili-dictionary version 2.9 shipped: the path to maturity !

Step by step, xili-dictionary (> 5 years old) reaches maturity. It is possible to manage language files (.po, .pot and .mo) for current theme and plugins.
While using the available items (hook, api, UI items…) in the WP toolbox (and libraries), it is now possible to scan directly the sources of the current theme or a selected plugin. Found translatable items in sources are imported inside the dictionary (with informations and comments given by sources author).

poEdit is a powerful desktop tool for developers. Here, it is possible to work online. On the same screen, it is possible to see the original source text (msgid) and the translations both in multiple languages.
Two ways to see (and select, search or sort) the content of dictionary: a table like WP posts list and a interactive jQuery powered table.

More infos soon…

If you like this plugin, which we are offering for free by the way, we kindly ask you to contribute and make our FAQ and documentation better. Please support us and participate by translating, writing (or improving) blog posts, help and FAQ articles. If you are interested please get in contact with by  using our contact page.

M.

A new plugin to manage attachment and media: xili re/un-attach media

A new plugin  to manage attachment and media files called xili-re-un-attach-media which adds the actions Unattach and Reattach at the Media Library Table list to manage attachments in the File column just after View action.
This plugin is only active in admin (dashboard) side.

Link to [Github by dev.xiligroup].

Here is a zip xili-re-un-attach-media containing the plugin for testing. Please read carefully the readme.txt …

xili-re-un-attach-media is now in WP plugin repository.

Settings Expert for plugins

xili-language version 2.14 shipped !

Step by step improvements are taking place:

xili-language version 2.14 provides:

  1. a new shortcode being able to display parts of content according to the current language,
  2. three new rules to manage translations of terms in 3rd party plugins that are translation ready (can be found at the 3rd tab – settings for expert),
  3. a better management of the custom post type (CPT) and custom taxonomy (CT) – xili-language is closer getting ready to support a multilingual shop system with woo commerce,
  4. at the Posts Edit list – category names are now additionally displayed with a translation according to the current language of the admin dashboard…

Soon more infos in “How to” part…

What new in xili-language 2.13.2 and xili-dictionary 2.7.2 ?

Step by step, updating continues…
Increment of third digit indicates minor fixes, improvements in sources and texts.

XILI-LANGUAGE translation box

XILI-LANGUAGE translation box

Side xili-language (2.13.2) :
- fixes settings for new CPT, (warning in debug mode) if CPT multilingual mode was set in 2.12, refresh the settings
- better selector (msgid for XD), XD again in bar admin,
- widget language file merged in main file of plugin.

dictionary msg list

dictionary msg list

Side xili-dictionary (2.7.2) :
- disable media button,
- subtitle of msg,
- formatted title (based on id with 7 digits)

5e onglet, Réglages édition / traduction

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.
languages-banner-673

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

shortcode

xili-language: a new shortcode revealed !

The latest version of xili-language provides a new shortcode named xili18n.

The short code is usable at the content of a page or post.

The purpose of the short code xili18n is to bring translatable terms inside of a text body. The translation for each language ist stored in the languages .mo file.

What is the goal?

Content can be very rich and complex nowadays (for example a table or form) same counts for specific terms. The idea is creating a clone-able version of a table or form for each language by inserting the shortcode for example at the table header of each column. So you simply need to copy the content into the different languages without translating these again and again.

Here is how the short code is used:

<strong>[xili18n msgid="Edit"]</strong>

The result in English is of course  Edit !

But go to the French or German post to see the result in a foreign language.  ;-)

Question 1: is is possible to define a context ? Yes with param ctxt !

Question 2: is is possible to choose the text domain ? Yes with param textdomain !

Question 3: Limitations in msgid or msgstr ? Yes only html tags like <strong>, <em> and <br> are possible. See the source code of the xili-language plugin for more details.

Tip of the day: import translators comment from php to poEdit

Context

By default poEdit (here version 1.6.4 for Mac OSX 1O.9) forget to import translators comment in po file.
like here

/* translators: added in child functions by xili */
$to_post_column = sprintf (__('The content in %1$s below must be translated in %2$s !', 'twentyfourteen'), $from_lang, $to_lang ) ;

to obtain this result in .po file:

#. translators: added in child functions by xili
#: ../functions.php:408
#, php-format
msgid "The content in %1$s below must be translated in %2$s !"
msgstr "Le contenu %1$s ci-dessous doit être traduit en %2$s !"

After some researches, it seems that a command must be added to the php parser “–add-comments=translators”. No need to modify via terminal the config… just go to preferences of poEdit and the line in php parser config tab:

poedit parsers preferences

poedit parsers preferences

poedit php parser

complete command with –add-comment=…

As in WP codex ‘translators’ is low case !

Enjoy !

M.

How to: A multilingual navigation menu

Preamble

Navigation Menu is a theme feature introduced with Version 3.0. WordPress includes an easy to use mechanism for introducing customized navigation menus into a theme.
The dashboard interface has made great progress for users (and newbies) from version to version.
Inside a theme, a navigation menu appears at a location, currently near the header. A menu has a structure made with menu items to redirect to webpage containing (as WordPress describes them) a static page, a list of posts in a category, of a target date, or resulting of a query…
In dashboard side, we find in “appearance/menu” page, the location settings and how to set the menu with his structure.
Note: A menu structure can be attached to a widget.

In multilingual context on a standalone WordPress install,
for developers, it is possible to create a virtual location for each language (as presented in child theme Twentyfourteen-xili or other previous embedded (bundled) themes of WP install).

A menu location contains
   one menu structure with
      various menus items.

But there are (huge) thousand of themes (free or commercial) following or not following the codex rules of development.

Since 5 years, on the long way to work in the thousands of lines of WP source, it was recently possible to use powerful pieces of code to create menu item like insertion points replaced by navigation list elements.

A multilingual navigation menu with xili-language with menus insertion point.

In the content strategy of the example, we decide that the contents of menu are not similar in each language.
First step: a menu (structure) per language
These structures should not be attached to a location to remain free to be used by menus insertion point.
Second step: a core menu attached to the menu location of the theme.
Third step: a menus insertion point and a language list insertion point inside the core menu.

Limitation: a menu structure associated to an insertion point must not contains another insertion points.

Some screenshots:

English menu w/o location

English menu w/o location

Menus Insertion item

Menus Insertion item before adding to structure

Core menu after insertion

Core menu after insertion