Xili-language : la boite à outils dans une seule table

Dans cette table sont regroupés les widgets, template tags, fonctions et filtre disponibles dans xili-language. (Mars 2015: en cours de finition et complétion à partir de la version précédente qui datait de 2010 😉 ).Bien sûr les meilleurs infos sont dans le source lui-même après la classe xili_language. Il est aussi recommandé d’examiner les sources exemples des thèmes enfant multilingues comme celui-ci même.
Ce regroupement des éléments techniques est destiné aux webmestres avertis et aux développeurs de thèmes.

Toolbox: xili-language plugin for a multilingual website in one table
Name Definition Comment Example Concern
WIDGETS to enrich widget enable themes Theme
Languages list Display the list of available languages Multiple widgets possible. If your theme contains functions that offer widget personalization, the item type must be filled. (see this post)
Widget Languages List
Widget Languages List
Recent comments Display the list of recent comments in current displayed language. This widget was created because the default one cannot be translatable or offer sub-selection in one language.
multiple widgets possible
Widget Recent comments list
Widget Recent comments list
Recent posts Display list of recent posts in a choosen language since v 1.4.0 for WP >2.8
This new widget solves conflicts or issues occuring when WP default widget is present (contains an obscur wp_reset_query). Also a choice of language of this list of recent posts is possible – not necessary the same of the current page. And you can install multiple widgets. Replace WP Recent Widget by this one namedList of recent posts
multiple widgets possible with different languages (fixed or dynamic)
Widget List of recent posts
Widget List of recent posts
TEMPLATE TAGS usable by theme’s designer and webmaster Theme
default parameters:
($post_ID,$before = “This post in”, $separator = “, “, $type = “display”)
in loop display the link of other posts defined as in other languages can be used in theme template in single.php under the title
* example: if(class_exists(‘xili_language’)) xiliml_the_other_posts($post->ID)
(in the example, the default template tag was hooked to display flag – see hooks rows below)
post – page – loop
default parameters:
($before = ‘<span class=”xili-lang”>(‘, $after =’)</span>’)
in loop display the language of the post Useful inside a multilingual category loop. loop, category, search
default parameters:
($before = ‘<li>’, $after ='</li>’, $theoption=”)
outside loop (sidebar) display the languages of the site (used also by widget) When the theme don’t enable widget. Use this template tag to display the list in sidebar or (header and footer) sidebar
default parameters:
($post_ID, $separator = ‘, ‘ ,$echo = true)
replace the_category() tag of WP Core The current template tag the_category is not hookable by plugin. So here the categories list of a post inside loop will be translated according the language of the current post. post – page – loop
default parameters:
Template Tag insertable in search form for sub-selection of a language As in example, this function add a way to limit the search to a target language.
Search form with language selectors
Search form with language selectors

search – sidebar
FUNCTIONS usable by developer with knowledges in php (see php source) CMS
the_curlang() deprecated replaced by xili_curlang()
default parameters:
($format=’%B %d, %Y’,$time = null)
get_cur_language ($post_ID) Return the language of current post in loop see below loop
get_cur_post_lang_dir ($post_ID) Return the lang and dir of language of current post in loop. The example on right uses this tag and the above one. loop
xiliml_get_lang_object_of_post ($post_ID) Return language object of a post. loop
choice_of_browsing_language() Return the language of current browser. visitor’s browser
choice_of_browsing_lang_dir() Return the lang and dir of current browser. visitor’s browser lang and direction
add_again_filter ($filtername,$filterfunction) Activate hooks of plugin in class. Reserved for high level developers – see code of function below
xiliml_get_category_link ($catid = 0) Replace get_category_link to bypass hook from xili_language
xiliml_recent_comments Recent comments – used by xili widget – usable if you need to create your own template tag comments
xiliml_get_language ($lang_nameorslug=””) Return full object of a language
ex_pages_by_lang ($pages, $r) sub selection of pages for wp_list_pages() example to use as hook sidebar
function xiliml_force_loop_lang ($lang_query_tag) functions to change loop’s query tag of language useful for sidebar widgets and latest posts widget – since 1.3.0
Even if the main loop is in one language, in the sidebar, it is possible to “force” the language in another one for the widgets.

Another example :
sidebar, widget
xiliml_add_lang_to_parsed_query () function for filter ‘parse_query’ to authorize lang query tag in custom WP_Query() since 1.4.0
useful for function or plugin that put posts inside post…
loop, custom queries
linked post example of shortcode using plugin functions this code can be inserted in dedicaced functions detectable inside this folder: wp-content/plugins/xilidev-libraries – see this post post content
HOOKS Main functions and template tags of xili-language are modifiable by hooks to have better and adapted CMS behaviour.
It is useful for developer with deep knowledges in php and wp (see end of php source)
add_action (‘xiliml_the_category’,’your_xiliml_the_category’,10,3)
template tag
template tag
template tag
In this example described formerly, the list of languages is enriched by flags:
template tag
Exemple to show translated and original item
wp list categories
header xhtml
add_filter(‘head_language_attributes’,’my_ head_language_attributes’,1,1);
header xhtml
default rules – set curlang in head according rules multilingual behaviour (front, cat, search,…)
More technical hooks and filters inside xili-language
(Read the plugin php source for more infos)
xiliml_single_cat_title_translate used by filter for wp_title() tags – since 1.4.1
xili_nav_lang_list usable to change the automatic insertion of languages list in navigation menu. Example:
xili_nav_page_list usable to change the automatic insertion of sub-selection of pages : see source
OTHER FILTERS Some template tags inside WP core are not fully multilingual and need filters.
Date management and translation are very complicated. Here by using a xili-language function, it is possible to modify the basic behaviour of the current template tag the_time.

Post, Page
Date management and translation are very complicated. Here by using a xili-language function, it is possible to modify the basic behaviour of the current template tag the_modified_time.

Post, Page
This is the date of each comments in the comments loop. Comments
© dev.xiligroup.com 2010 – 2015-03

un site internet multilingue avec WordPress et xili-language