Plugin Directory

xili-language

  1. Upload the folder containing xili-language.php and language files to the /wp-content/plugins/ directory,
  2. Verify that your theme is international compatible - translatable terms like _e('the term','mytheme') and no text hardcoded -
  3. define domain name of your theme - see note at end list below,
  4. Activate the plugin through the 'Plugins' menu in WordPress,
  5. Go to the dashboard settings tab - language - and adapt default values if necessary by adding your languages in the catalog. You can set the order (1,2,3...) of the series. (used in language_attributes() template_tag).
  6. Modify each post by setting (checking) the language flag in xili-language sub-windows at the right of the editing window before publishing.

SPECIAL NOTE FOR VERSION >= 1.1.9

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'); 
}

NOTE

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.

Browser detection

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.

text direction, since 0.9.9

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 selection

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.

Wordpress 2.9-rare

Today, xili-language is 'compatible'.

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus (1 reporting)

100%
100,1,1 100,1,1
100,2,2 100,1,1
100,1,1
100,1,1

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(3 ratings)