Forum Replies Created
-
AuteurArticles
-
Thanks for your observations…
– the subselection by group need that the targeted tags belong already to this group (category of tags). The improvement here can be to show all groups so it will be easier to change tags from the targeted group to another group.
– before to paginate the list, the sub-selection by first letter can be efficient because it divide your 200 tags in smaller groups.
I plan to improve soon according these analyzes..
Best regards
16 February 2010 at 17:30 in reply to: [M. à j.] Publier en plusieurs langues : Avantages du couple WordPress, xili-language #1506Un des fondements de l’approche de l’extension xili-language est la conservation de la structure des articles et pages. De plus, quand un visiteur arrive sur le site en provenance d’un moteur de recherche, la langue du contexte (menu, etc) appelé le thème du site est celle de l’article trouvé.
Seules quelques propriétés sont ajoutées à l’article (ou la page)
La première est la langue définie par l’auteur (voir la boite en haut à droite de la copie d’écran çi-dessous)
Les secondes sont celles des liens vers les numéros des articles « traduits ». « traduits » ne veut pas dire qu’il y a une traduction automatique ou exacte mais qu’il peut s’agir d’une adaptation ou d’un résumé dans l’autre langue.
Pour les auteurs, ou les éditeurs il est utile d’avoir un bon navigateur avec tabulation (firefox, safari,…)
Comme exercice, nous allons montrer comment on écrit un article et son pendant dans un autre onglet de la fenêtre du navigateur.
Note 1: Il est recommandé de préparer à l’avance les deux textes dans les deux langues dans un éditeur de texte afin de pratiquer le copier coller.
Note 2: Si les articles existent déjà et sont à affecter et relier, voir à la fin de cet article.Le texte original en anglais :
Remplir le titre, le contenu, l’extrait etc (catégories, mots clés,…). Cocher la langue dans la boite « Langue » et enfin enregistrer le brouillon.
[caption id="attachment_1499" align="aligncenter" width="300" caption="L'article initial en anglais"][/caption](Astuce: N’oubliez pas d’utiliser les qualités de l’interface pour (dé)placer les boites « langue » et « articles liés » en haut à droite.)
L’article traduit / adapté en français
Depuis la version 1.3 de xili-language, il est possible en un seul click de créer l’onglet du nouvel article dans l’autre langue. (Astuce: Afin d’éviter l’ouverture d’une autre fenêtre, utiliser la touche droite de la souris avant de cliquer le lien ‘Ajouter’ et choisisser ‘ouvrir dans un autre onglet’). (Les copies d’écran sont ici d’un wordpress en anglais).
[caption id="attachment_1500" align="aligncenter" width="300" caption="L'article lié en français dans le 2e onglet"][/caption]In the edit window of the new post, just add the french title, observe that link to previous post and language are prefilled or checked and just now click ‘save draft button’. and continue to fill content and excerpt, tags and categories.
Dans cet interface d’écriture de ce nouvel article, saisissez le titre, observez que les liens vers le numéro de l’article originel sont pré-remplis ainsi que sa langue cochée. Cliquer juste sur « Enregistrer brouillon » et continuez à compléter le contenu, l’extrait, mots clés etc.(Astuce: Si vous revenez à l’onglet précédent (donc l’article en anglais), il suffit de sauver à novueau pour voir les modifications dans la boite des « articles liés ». )
[caption id="attachment_1501" align="aligncenter" width="298" caption="L'article lié vient d'être sauvé"][/caption]Voilà, il ne vous reste plus qu’à fignoler et finir les deux articles dans chaque langue avant de les passer en mode relecture puis à les publier tout deux.
Que faire si les articles existent déjà dans les langues différentes ?
1) Cocher pour chacun des articles sa langue dans la boite « Langue de l’article« . Puis sauver ou mettre à jour.
2) Si vous avez relevé les numéros des articles liés dans les autres langues, remplisser les cases correspondantes aux langues dans le tableau de la boite latérale « Articles liés ». Puis sauver ou mettre à jour.
Depuis la version 1.4.1 de xili-language, il existe en option un mécanisme d’auto-recherche pour détecter d’autres articles qui pointent vers celui qui est en cours d’édition. Pour cela, commencez par cocher l’auto-recherche et sauver ou mettre à jour. Si des articles existent, les cases se préremplissent et, après vérification, sauver ou mettre à jour.
Pourquoi l’option n’est pas cochée par défaut ?
Pour éviter des requêtes inutiles. Comme éditeur, cochez la si vous pensez que c’est nécessaire parce que les articles existent.[caption id="attachment_1545" align="aligncenter" width="452" caption="Actions sur des articles existants"][/caption]
[xiliinseries]Cet article est dans la série – xili-language pour les auteurs :[/xiliinseries]
16 February 2010 at 15:16 in reply to: [updated] Publishing in multiple languages. Benefits, tips and tricks with wordpress and xili-language plugin. #1498One of the foundations of the approach of xili-language is the conservation of the structure of posts (article or page). And when a visitor arrive from a search robot, the theme framework will be in the same language of the post’s language.
Only some properties are added to the post.
One is the language of the post set by the author. (see on the top right of pictures below)
The others are link to the similar posts in other languages. « Similar » means that linked posts are not always an exact translation of the original. Sometime it is only a summary or an adaptation.
For the author or editor, it is important to have a good browser with tabs or one large, wide screen or two displays.
As exercise, I will try to illustrate how a post and his translation are published in post edit dashboard of WP.
Note #1: It is better to have prepared before the two texts with a simple text editor and use copy and paste.
Note #2: If it concerns existing posts that need to be checked in specific languages or linked posts, see end of this post.The original in english:
Fill the title, content, excerpt etc.. tags and categories… and check english in post’s language box.
and save it…
[caption id="attachment_1499" align="aligncenter" width="300" caption="the first post in english"][/caption](tip: don’t forget to use UI features and move the boxes on the top right near the title)
The linked post in french:
Since 1.3.0, with one click, it is possible to create a new post in another window of the browser. (tip: use the right mouse button, to open the Add New link in another tab – your desktop will be cleaner).
[caption id="attachment_1500" align="aligncenter" width="300" caption="The linked post in french in second tab"][/caption]In the edit window of the new post, just add the french title, observe that link to previous post and language are prefilled or checked and just now click ‘save draft button’. and continue to fill content and excerpt, tags and categories
(trick: If you go back to the browser’s tab of the original english post, you can save it again, and you will see the changing in linked post box)
[caption id="attachment_1501" align="aligncenter" width="298" caption="The linked post is now saved"][/caption]And now you are able to continue to write the both posts each one in his language if you are yourself bilingual or by copying the draft of the two authors.
What happens when working on existing posts ?
First thing: check his language in Post (page) ‘s language box and save or update.
Second thing: If you know the IDs of linked posts in other languages fill the input inside the small table of Linked posts box and save or update.
And since 1.4.1, useful if the linked posts exist and contain link to this current post, just check ‘auto search’, save or update and when UI is refreshed, the inputs are prefilled with IDs of existing other posts linking to this current. Verify, Save or update.
Why « check » option is not checked as default ?
To avoid unnecessary queries. As Editor, check it only if you decide when it is necessary.[caption id="attachment_1539" align="aligncenter" width="295" caption="Linked posts or pages box in Post Edit UI"][/caption]
[xiliinseries]This post is in series – xili-language for authors :[/xiliinseries]
Afficher la date et l’heure à la volée selon la langue d’un article dans WordPress n’est pas chose aisée. Après quelques recherches dans le code source du coeur WP et en php, quelques voies possibles sont ici :
Sans changer ou ajouter de balises de thèmes (template tags), the_time(), the_modified_time() sont adaptables (via les filtres) par l’extension xili-language.
Les fonctions filtrantes sont placées dans le fichier functions.php du dossier ‘xilidev-libraries‘ à mettre dans la racine du dossier DES plugins (voir cet article).
function xiliml_comment_date($comment_time,$d = '') { /* params no used because php format */ /* the first param is to be as msgid in .po example: %B %d, %Y - %H:%M or %B %d, %Y at %H:%M */ return the_xili_local_time('%B %d, %Y', strtotime(get_comment_time ('m/d/Y H:i'))); /* impossible to use get_comment_date as it is itself filtered*/ } add_filter('get_comment_date','xiliml_comment_date',10,2); function xiliml_date($thetime,$theformat) { /* param no used because php format */ return the_xili_local_time('%B %d, %Y - %H:%M',strtotime(get_the_time('m/d/Y H:i'))); } add_filter('the_time','xiliml_date',10,2); function xiliml_modified_date($thetime,$theformat) { /* param no used because php format */ return the_xili_local_time('%B %d, %Y - %H:%M',strtotime(get_the_modified_time('m/d/Y H:i'))); } add_filter('the_modified_time','xiliml_modified_date',10,2);
De base WordPress utilise la fonction php date() et sa série de formats – http://fr2.php.net/manual/en/function.date.php – and and internal static translation tools.
Dans les fonctions filtrantes, l’extension xili-language utilise le format lié à setlocale. Voir – http://fr2.php.net/manual/en/function.strftime.php –
Si le serveur Apache, le php sont bien configurés, cette voie liée à setlocale fonctionne en temps réel à la volée.
Pour le fichier .po, le msgid contient le format ‘%B %d, %Y – %H:%M‘ et sa traduction en français peut-être %d %B %Y – %Hh%M‘
FAQ
* Pourquoi les fonctions filtrantes sont à l’extérieur du plugin et dans ce dossier xilidev-libraries ?
Parce que le webmestre peut modifier ces fonctions sans que celles-ci soient mises à plat lors d’une mise à jour de l’extension elle-même. (Ne pas oublier la détection de ces fonctions en cochant « Active les fonctions xilidev »)
[caption id="attachment_1486" align="aligncenter" width="298" caption="Active les fonctions xilidev"][/caption]* Pour les paramètres de la fonction the_time() ne sont pas interprétés ?
Parce que leur interprétation en nombre de lignes de code est trop lourde et qu’il est plus simple de changer manuellement le format de date heure.
* Dans la fonction the_time() comment supprimer l’heure ?
Simplement changer ‘%B %d, %Y – %H:%M’ en ‘%B %d, %Y’ .
* Que fait la fonction the_xili_local_time() ?
Cette fonction traduit une date générique et numérique selon le format et la langue de l’article ou selon les règles définies dans le thème.
[xiliinseries]Cet article appartient à la série : xili-language pour les experts[/xiliinseries]
Setting time, on the fly, in current language of the current post is not very easy in WordPress. After some research in core’s source and in php functions, several pathways are available here :
Without changing or adding specific template tags, the_time(), the_modified_time() and other functions are hookable by xili-language.
The « hooking » functions are placed inside the xilidev-libraries (see this post).
function xiliml_comment_date($comment_time,$d = '') { /* params no used because php format */ /* the first param is to be as msgid in .po example: %B %d, %Y - %H:%M or %B %d, %Y at %H:%M */ return the_xili_local_time('%B %d, %Y', strtotime(get_comment_time ('m/d/Y H:i'))); /* impossible to use get_comment_date as it is itself filtered*/ } add_filter('get_comment_date','xiliml_comment_date',10,2); function xiliml_date($thetime,$theformat) { /* param no used because php format */ return the_xili_local_time('%B %d, %Y - %H:%M',strtotime(get_the_time('m/d/Y H:i'))); } add_filter('the_time','xiliml_date',10,2); function xiliml_modified_date($thetime,$theformat) { /* param no used because php format */ return the_xili_local_time('%B %d, %Y - %H:%M',strtotime(get_the_modified_time('m/d/Y H:i'))); } add_filter('the_modified_time','xiliml_modified_date',10,2);
Basically WordPress uses php date() format – http://fr2.php.net/manual/en/function.date.php – and and internal static translation tools.
In the hooking function and in date format translation, the format depending of setlocale is used. See – http://fr2.php.net/manual/en/function.strftime.php –
With this way and if the server is well configured, the live translation of date / time works well.
For the .po file, the msgid format is ‘%B %d, %Y – %H:%M‘ and his translation in french can be ‘%d %B %Y – %Hh%M‘
FAQ
* Why are these hooks inside the xilidev library and not inside the plugin itself ?
Because the webmaster can modify it and the modifications will be not erased when the plugin is updated. (Don’t forget to check (and activate) this library in admin plugin’s UI)
[caption id="attachment_1486" align="aligncenter" width="298" caption="xilidev or gold functions"][/caption]
* Why the parameters of the_time() are not used ?Because they need big translation and lot of lines. So it was better to bypass it and insert more flexible properties.
* In the_time() how to suppress the time ?
Just modify the string ‘%B %d, %Y – %H:%M’ in ‘%B %d, %Y’ .
* What do the function the_xili_local_time() ?
This function inside the plugin translates a generic numeric date according current language of the post or the theme’s live language.
* On my website, I use different patterns inside the_time() depending category or single or… What do you recommend ?
Inside the filter function, add php ‘switch case‘ lines analyzing the $theformat passed (php format) and deliver – according these – the first param of the_xili_local_time() a setlocale format with %. It is indeed easy to choose a result with or without hour:min. After you have defined the list of format, don’t forget to translate them in .po (and .mo) of each language.
[xiliinseries]This posts belong to the series: xili-language for experts[/xiliinseries]
This release xili-language 1.2.1 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. Since this release, xili-language is also compliant with wordpress 2.9.
[caption id="attachment_1120" align="alignright" width="289" caption="Gold functions"][/caption]
Gold functions
In sidebox « Settings », a new check button appears if a folder named xilidev-libraries and containing a functions.php file was present inside your wp/content/plugins/ folder.
If this button is checked, all the functions inside this file was added when plugin is activated. Why it is interesting ? When adding here special filters or actions for hookable template tags of xili-language, you don’t need to copy and paste your functions of one theme to another theme.New functions in core of xili-language
Two new functions was added for developers (since February – 3 new for time display) :
xiliml_get_lang_object_of_post($post_ID)
Return an object containing properties of the language set to the post passed as param (false if the post don’t exist or undefined language) See code for more infos.
xiliml_get_language($lang_nameorslug="")
Return an object containing properties of the language passed as slug (ex fr_fr) or name (ex fr_FR). False if the language doesn’t exist.$result->description
gives the full name of the language set by you in xili-language settings.To illustrate these new features, please find an example of functions.php here containing only two functions to create a shortcode named linkpost.
< ?php /** * shortcode to insert link to post in other languages inside the content * example : [linkpost lang="fr_FR"]link to french similar post[/linkpost] (if title="some text" : title of link is set by replacing title 'A similar post in...') * * *@since 1.2 */ function xiliml_build_linked_posts_shortcode($atts,$content=null) { global $post; $arr_result = shortcode_atts(array('lang'=>'','title'=>''), $atts); extract($arr_result); $language = xiliml_get_language($lang); /* test if lang is available */ if ($language !== false) { $otherpost = get_post_meta($post->ID, 'lang-'.$language->slug, true); } if ($otherpost) { if ('' == $title) { $obj_lang = xiliml_get_lang_object_of_post($otherpost); if (false !== $obj_lang) { $description = $obj_lang->description; $title = __('A similar post in',THEME_TEXTDOMAIN).' '.$description; } else { $title = __('Error with target post #',THEME_TEXTDOMAIN).$otherpost; } } $output = ''.$content.''; /* this link above can be enriched by image or flag */ } else { $output = ''.$content.''; } return $output; } add_shortcode('linkpost', 'xiliml_build_linked_posts_shortcode'); ?>
Please find here a .zip containing the folder « xilidev-libraries » to upload in wp-content/plugins/ directory and this example functions [enriched since Feb 28th, 2010].
[xiliinseries]This posts belong to the series: xili-language for experts[/xiliinseries]
In this table, all the main template tags, functions and hooks are grouped. (under finishing and pending review step). This post will be frequently updated.
This table is a summary of the « technical » features of xili-language plugin and is dedicaced to webmaster and theme’s designer.
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)
sidebar
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
sidebar
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 named – List of recent posts –
multiple widgets possible with different languages (fixed or dynamic)
[caption id="attachment_1537" align="aligncenter" width="207" caption="xili-language widgets: the new \"multiple\" widget to display list of recent posts in a choosen language."][/caption] sidebar
TEMPLATE TAGS
usable by theme’s designer and webmaster
Theme
xiliml_the_other_posts
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
xili_post_language
default parameters:
($before = ‘<span class= »xili-lang »>(‘, $after =’)</span>’)in loop display the language of the post
Useful inside a multilingual category loop.
< ?php the_time(); /*__('F jS, Y','xilidev')*/ echo " - "; if (class_exists('xili_language')) xili_post_language(); ?>loop, category, search
xili_language_list
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)
< ?php _e('Languages','xilidev') ?>
-
< ?php if (function_exists('xili_language_list')) {
xili_language_list('
- ','','siderss'); } ?>
sidebar
xiliml_the_category
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.
< ?php the_tags(__('Tags: ','xiliips'), ', ', '
'); echo " "; _e('Posted in','xiliips'); echo " "; if (class_exists('xili_language')) { xiliml_the_category(get_the_ID(),', '); } else { the_category(', '); } ?> | < ?php edit_post_link(__('Edit','xiliips'), '', ' | '); ?> < ?php comments_popup_link(__('No Comments »','xiliips'), __('1 Comment »','xiliips'), __('% Comments »','xiliips')); ?>post – page – loop
xiliml_langinsearchform
default parameters:
($before= »,$after= »)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.
< ?php _e('Search','xilidev') ?>
search – sidebar
FUNCTIONS
usable by developer with knowledges in php (see php source)
CMS
the_curlang()
theme
the_cur_langs_group_id()
the_xili_local_time
default parameters:
($format=’%B %d, %Y’,$time = null)time
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.
while (have_posts()) : the_post(); $langdir = ((function_exists('get_cur_post_lang_dir')) ? get_cur_post_lang_dir($post->ID) : array()); ?>
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.
< ?php xiliml_force_loop_lang("fr_fr"); if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar top')) : ?>
- ?
- ?
Another example :
< ?php //echo the_curlang(); /* in this case, the widgets are forced as current lang of the theme - useful in home when query tag 'lang' is not defined -*/ xiliml_force_loop_lang(the_curlang()); if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar top')) : ?>
- ?
sidebar, widget
xiliml_restore_loop_lang ()
functions to restore loop’s query tag of language
see above
[caption id="attachment_1480" align="alignleft" width="220" caption="Snapshot of example above"][/caption] 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…
/* example: */ add_action('parse_query','xiliml_add_lang_to_parsed_query'); $r = new WP_Query($thequery); remove_filter('parse_query','xiliml_add_lang_to_parsed_query');
loop, custom queries
SHORTCODE
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 –
([linkpost lang="fr_FR"]Cette page en français[/linkpost])
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)
CMS
xiliml_the_category
add_action (‘xiliml_the_category’,’your_xiliml_the_category’,10,3)
template tag
xiliml_the_other_posts
add_action(‘xiliml_the_other_posts’,’your_xiliml_the_other_posts’,10,3)
template tag
xili_post_language
add_action(‘xili_post_language’,’your_xili_post_language’,10,2)
template tag
xili_language_list
add_action(‘xili_language_list’,’your_xili_language_list’,10,3)
In this example described formerly, the list of languages is enriched by flags:
function my_xili_language_list($before = '
- ', $after ='
',$theoption) { global $wp_query; if ($theoption == 'top') { /* usable in type item in new multiple widget */ $listlanguages = get_terms_of_groups_lite (the_cur_langs_group_id(),TAXOLANGSGROUP,TAXONAME,'ASC'); $a =''; $currenturl = get_bloginfo('siteurl').'/?'; foreach ($listlanguages as $language) { //QUETAG if ($language->slug != 'ar_ar' && $language->slug != 'ar_ma') { $a .= $before ."description,THEME_TEXTDOMAIN)."'>"." slug.".png' alt='' />".$after; } } echo $a; } else { /* the current list in sidebar with category sub selection*/ if (is_category()) { $catcur = xiliml_get_category_link(); $currenturl = $catcur.'&'; } else { $currenturl = get_bloginfo('siteurl').'/?'; } $listlanguages = get_terms_of_groups_lite (the_cur_langs_group_id(),TAXOLANGSGROUP,TAXONAME,'ASC'); foreach ($listlanguages as $language) { if ($language->slug != 'ar_ar' && $language->slug != 'ar_ma') { if ($before=='- ') { if (the_curlang() == $language->slug) { $beforee = '
- '; } else { $beforee ='
- '; } } $a .= $beforee ."description,THEME_TEXTDOMAIN)."'>"." slug.".png' alt='' /> ". __('in '.$language->description,THEME_TEXTDOMAIN) ."".$after; } } if (is_category()) { $currenturl = xiliml_get_category_link(); $a .= $before.""." ".__('in all languages',THEME_TEXTDOMAIN)."".$after; } echo $a; } } add_action('xili_language_list','my_xili_language_list',10,3);
template tag
xiliml_langinsearchform
add_action(‘xiliml_langinsearchform’,’your_xiliml_langinsearchform’,10,2)
sidebar
xiliml_cat_language
add_filter(‘xiliml_cat_language’,’my_rules_for_cat_language’,2,3);
Exemple to show translated and original item
function my_rules_for_cat_language ($content, $category = null, $curlang='') { if (!is_admin()) : /*to detect admin UI*/ $new_cat_name = __($category->name,THEME_TEXTDOMAIN); if ($new_cat_name != $content) : $new_cat_name .= " (". $content .") "; endif else : $new_cat_name = $content; endif; return $new_cat_name; } add_filter('xiliml_cat_language','my_rules_for_cat_language',2,3);
sidebar
wp list categories
content
head_insert_language_metas
add_filter(‘head_insert_language_metas’,’my_head_insert_language_metas’,1,2);
header xhtml
head_language_attributes
add_filter(‘head_language_attributes’,’my_ head_language_attributes’,1,1);
header xhtml
xiliml_cur_lang_head
add_filter(‘xiliml_cur_lang_head’,’my_xiliml_cur_lang_head’,1);
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)
choice_of_browsing_language
xiliml_link_translate_desc
xiliml_single_cat_title_translate
used by filter for wp_title() tags – since 1.4.1
xiliml_getarchives_where
xiliml_getarchives_join
xiliml_modify_querytag
xiliml_taglink_append_lang
xiliml_link_append_lang
xili_nav_lang_list
usable to change the automatic insertion of languages list in navigation menu. Example:
/* tests */ function my_xili_nav_lang_list( $items, $args, $navmenu_check_option ) { if ( $navmenu_check_option == $args->theme_location ) { $end = xili_language_list( '
- ', '
', 'typenav', false ) ; // langs list BEFORE return $end.'- |
'.$items; // class for display none... 1.8.9 } else { return $items; } } add_filter ('xili_nav_lang_list', 'my_xili_nav_lang_list', 10, 3);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.
the_time
add_filter(‘the_time’,’my_date’,10,2);
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. function my_date($thetime,$theformat) { /* param no used because php format */ return the_xili_local_time('%B %d, %Y - %H:%M',strtotime(get_the_time('m/d/Y H:i'))); } add_filter('the_time','my_date',10,2);
Post, Page the_modified_time
add_filter(‘the_modified_time’,’my_modified_date’,10,2);
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. function my_modified_date($thetime,$theformat) { /* param no used because php format */ return the_xili_local_time('%B %d, %Y - %H:%M',strtotime(get_the_modified_time('m/d/Y H:i'))); } add_filter('the_modified_time','my_modified_date',10,2);
Post, Page get_comment_date
add_filter(‘get_comment_date’,’my_comment_date’,10,2);
This is the date of each comments in the comments loop. function my_comment_date($comment_time,$d = '') { /* params no used because php format */ /* the first param is to be as msgid in .po example: %B %d, %Y - %H:%M or %B %d, %Y at %H:%M */ return the_xili_local_time('%B %d, %Y', strtotime(get_comment_time ('m/d/Y H:i'))); /* impossible to use get_comment_date as it is itself filtered*/ } add_filter('get_comment_date','my_comment_date',10,2);
Comments © dev.xiligroup.com
2010
Please use the forum for questions or comments.
[xiliinseries]This posts belong to the series: xili-language for experts[/xiliinseries]
The question
This message keeps popping up, and in firefox, it doesn’t even show the website:
no theme domain in index.phpxili-language plugin : THEME_TEXTDOMAIN UNDEFINED
Before I updated the plugin version, this didn’t happen.
Help!!
First answer
Is the indicated website, the site where the probleme occur ? I note that you use only pages and not posts ? If the theme is localizable, are the lines with THEME_TEXTDOMAIN added in functions.php added as explained in readme.txt or in tabs of xili-language plugin repository. This message occur only if the index.php file don’t contain translatable terms (_e() or __())… Thanks for your information.
M.
At this link, http://www.festum2010.tk/festum-re-union-2010 , I see something yesterday and now nothing. The source don’t show that plugin is active. (no call to css, no call to js)
To test just verify it without plugins using jquery.
About the size of pictures, you choose it and after you adapt the background frame and css file and width and heigth parameters…
Verify also that in shortcode the param frame_id is named as in ids of css ! (read again carefully the mentioned post)
dev.xiligroup team
Before to publish a more detailled post, the solution can be find inside the plugin source as in line #879. Here in tag assign admin page, the plugin display the group (and check the checkbox if belong to group) of each tag :
if (is_object_in_term($tag->term_id,TAXOTIDYTAGS,$groupid))
…Hope to find time to write a good text…
Happy new year,
-
AuteurArticles