xili-language.php and language files to the /wp-content/plugins/ directory,_e('the term','mytheme') and no text hardcoded - language_attributes() template_tag).With the cost of 50 lines more, plugin now detect automatically (if theme is good) the theme_text_domain and languages (.mo) sub-folder. It not mandatory to declare the two constats (but compatible with previous settings).
Only encapsule the load_theme_textdomain() like in that example for a theme named fusion:
if (!class_exists('xili_language')) { // class in not (!) present...
load_theme_textdomain('fusion', get_template_directory() . '/lang');
}
In the functions php file of the theme : replace by commenting load_theme_textdomain line //load_theme_textdomain('mythemename'); by a define define('THEME_TEXTDOMAIN','mythemename'); //second text must be used in theme texts with _e( , ) or __( , ) where 'mythemename' is 'kubrik' in default international theme.
Another example with fusion theme that offer localization :
replace
function init_language(){
load_theme_textdomain('fusion', get_template_directory() . '/lang');
}
by
function init_language(){
if (class_exists('xili_language')) {
define('THEME_TEXTDOMAIN','fusion');
define('THEME_LANGS_FOLDER','/lang');
} else {
load_theme_textdomain('fusion', get_template_directory() . '/lang');
}
}
see the recent post.
To change the language of the frontpage according to the language of the visitor's browser, check the button in right small box in settings.
Examples for theme's designer of functions to keep text direction of theme and of current post :
<?php
$themelangdir = ((class_exists('xili_language')) ? the_cur_lang_dir() : array ()) ; ?>
<div class="inside <?php echo $themelangdir['direction'] ?>">
...
example in loop :
<?php while (have_posts()) : the_post();
$langdir = ((class_exists('xili_language')) ? get_cur_post_lang_dir($post->ID) : array());
?>
<div class="story <?php echo $langdir['direction'] ?>" >
minimal example in css :
.rtl {direction: rtl; text-align:right !important; font-size:130% !important;}
.ltr {direction: ltr; text-align:left !important;}
Caution : multilingual theme with both ltr and rtl texts needs a rigourous structure of the css !
Archives tags is a very complex template tag in his background and not very easy source hookable. So we decided to add few features : by adding query in vars of the function, it will be possible to display a monthly list of archives for a selected language - wp_get_archives('..your.vars..&lang=fr_fr') - or the current the theme language - wp_get_archives('..your.vars..&lang=') -. The displayed list of links will be translated and link restrited to display only archives of this language.
Today, xili-language is 'compatible'.




