xili-language plugin : release 1.6.0 (compatible WP 3.0)

September 17, 2009 - 09:13 - - This post in spanish , "français"
xili-language - [Update = July 02, 2010 - 10:11]
xili-language provides for a multilingual website an automatic selection of language (.mo) in theme according to the language of current post(s). (ready for WP 3.0 mono or multisite (wpmu)

Description

Logo xili-languageLogo xili-language

xili-language plugin provides an automatic selection of language in theme according to the language of one post. xili-language use on the fly the .mo files present in the theme’s folder.

Themes with localization can be easily transformed in multilingual site.
It is dedicaced for theme’s creator or webmaster with knowledges in CMS and WP and having tools to create .mo language files. The plugin add automatic tools (or links or filters) for sidebar or top menus. Categories lists are translated also. xili-language provides also series of functions which can be hooked in the functions.php file of the theme that you create i.e. for a multilingual cms like website.
With xili-tidy-tags plugin [here], it is now possible to display sub-selection (cloud) of tags according language. With xili-dictionary plugin (beta), it is easier to create online via admin UI the files .mo of each languages.
xili-language plugin does not create addition tables in the database. xili-language simply makes proper use of the taxonomy tables and postmeta table offered by WordPress to define language and link items between them. Because xili-language plugin does not modify deeply the post edit UI, it is possible to use iPhone / iPod Touch WordPress app to prepare and draft the post.

New !

Documentation : A new table summarizes all the technical features of this powerful plugin for personalized CMS created by webmaster. 

1.6.1

* sticky posts are now managed (see demo multisite)

1.5.5 compatible also with WP 3.0-beta

* incorporate automatic detection of theme domain for WP 3.0 and his new default theme ‘twentyten’
* remains compatible for previous versions WP 2.9.x
* Tests were started with recent WP 3.0-alpha. Very few modifications were necessary.
* Rename two filters (as manage_edit_columns) for compatibility with filters renamed (as manage_posts_columns) by WP3.0. Incorporate new posts edit UI modifications of WP3.0.
* improved template_tags : xiliml_the_category, xiliml_the_other_posts (see source doc)
Contact us to test…
* can be tested with WP 3.0-beta multisite mode (WPMU) – contact-us for more docs.

1.4.1

* Browser’s window title now translated for categories (wp_title()). Option in post edit UI to auto-search linked posts in other languages – see this post.
* New option to adapt the home query according rules defined by chief editor. If home page loop is filled by most recent posts (via index or home.php), formerly, by default xili-language is able to choose the theme’s language but not to sub-select the loop (without php coding). Now when checking in Settings ‘Modify home query’ – no need to be a php developer.
* New widget for recent posts (able to choose language). This new widget solves conflicts or issues occuring when WP default widget is present (contains an obscure wp_reset_query – tracs #12320). 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 Posts Widget by this one named – List of recent posts -

1.3.x

* New functions to change and restore loop’s language query-tag (see functions table).
* Better dashboard post UI to create linked post: from one post, it possible to create linked post in another language and the links are prefilled. Just need to save draft to save the links between root and translated posts filled by authors.
Add a new linked post in other languageAdd a new linked post in other language
* fixes lost languages’s link when trash or untrash (WP 2.9.1).

1.2.1

Admin UI : fixes some directories issues for (rare) xamp servers – Some improvements in post edit UI.
Full tests with lastest wp 2.9.1. New admin UI localization joined (RU – © see header of xili-language-ru_RU.po)

1.1.8, 1.1.9

Intermediate release
Optional improve hooking ways to be compatible with l10n cache of Johan’s plugin see line 2200. Automatic detection of theme_text_domain and languages (.mo) sub-folder in theme’s folder.
New Special Sidebar BoxMore infos in Settings UI Special sidebox.
Fixes title of wp_get_archives links with current permalinks. Possible that very special permalinks need to use hook named xiliml_get_archives_link.

This release 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. A post explaining these improvements can be found in this post . Since 1.1.8, xili-language is also tested with future wordpress 2.9-rare.

1.1

improve function and theme tag «  xiliml_the_others_posts() »
(this template tag displays list of links of linked posts in other languages – by example in subtitle)

  1. to be used in multilingual category loop and
  2. by option (array) to return an array of linked posts in other languages (useful for CMS webmasters) (array of lang and id ) – the id is easily transformable in permalink with function get_permalink() when using this array.
    IMPORTANT : if this function was previously hooked for your theme, it works but you must review the hooking function of your functions.php to include new array option (see plugin code).
1.0

This version 1.0 to salute WordPress 2.8. and some adds : new ways to choose language of home page through a popup in settings page. Ready to have more customized functions in a specific folder (and not only in functions.php of current theme). Reserved to theme’s designers…

0.9.9.6

Multiple Languages List WidgetMultiple Languages List Widget
xili-language list widget is now « multiple » ready. If the theme contains more than one sidebar, it is possible to adapt the list of languages for each sidebar. Designers of theme will be happy to find a way to change html tags of list.
More… a new item is added in widget : Type. This option offers a way to select type of languages list.
Enrichable through hooks and your function in functions.php, the available default option « typeone » deliver a list (without the selected language) and the link when in categories pages go a subselection in this language and this category.
See this post to enrich your list with flags or other behaviours depending which part of website is displayed (front-page, categories, search….)

Tested with wordpress 2.8-beta2-11509

A technical post

A new post about template tags here

0.9.9.5

php doc enhanced, link to modify linked posts in post edit UI
link to edit directly post in other languagelink to edit directly post in other language

compatible with old server in php4 !?
0.9.9.4
New widget for recent comments that can subselect those for current language. (a function `xiliml_recent_comments()` is also available if you want to create a template tag with resulting objects array). Sub selection of archives for `wp_get_archives()` with &lang= : see installation notes.

If frontpage is a page, select correlated page according language see Other notes.
0.9.9.3
sub selection of pages for `wp_list_pages()` with &lang=, some fixes (other posts, options when activate,…)
Example 1 :

wp_list_pages('title_li=&lang='.the_curlang() );

will display only pages of current lang
Example 2 :

wp_list_pages('title_li=&setlang=0&lang='.the_curlang() );

will display pages of current lang AND pages with lang undefined (polyglot pages).

and soon examples how to install selected rss as visible here in the left sidebar.

0.9.9.2

fixe class of metabox has-right-sidebar for 2.8 – some other admin UI sizing, W3C – improved template-tag default function `xiliml_the_other_posts()` display (if you had hook it in previous version, verify the hook of your functions.php, see php code lines 1314, 1650).

0.9.9

now provides infos about **text direction** *ltr* ou *rtl* of languages (arabic, hebraic,…) of theme and of each post in loop see note [direction in installation](http://wordpress.org/extend/plugins/xili-language/installation/). Soon more infos and demos for designers if multilingual theme. Some fixes (thanks to Jacob about QuickEdit UI bug when post update).

Installation

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.

See this post about template tags here

SPECIAL NOTE FOR VERSION >= 1.5.0 and WP 3.0

Nothing to do in functions.php : only verify that the theme is localizable and functions.php contains a function load_theme_textdomain(); and that the theme’s folder contains .mo files (in root or a sub-folder) for each languages of your website. « twentyten » default WP theme is compatible.

Plugin is backward compatible for theme of monosite. But if you upgrade, it is better to restore you theme with default load_theme_textdomain();. Delete lines concerned by constants THEME_TEXTDOMAIN and languages sub-folder THEME_LANGS_FOLDER. NOTE FOR THEMES DESIGNER : If your theme is compatible both for newest (>3.0-apha) and older versions, add some conditional lines.

SPECIAL NOTE FOR VERSION >= 1.5.0 and WP 2.9.x

Example with ‘fusion’ theme that offers localization:

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

Example with a theme theme that offer localization but not permit automatic detection (no terms with domain inside index.php) : replace

function init_language(){
    load_theme_textdomain('thedomain', get_template_directory() . '/lang');
}

by

function init_language(){
    if (class_exists('xili_language')) {
        define('THEME_TEXTDOMAIN','thedomain');
    } else {
       load_theme_textdomain('thedomain', get_template_directory() . '/lang');  
    }
 
}

see the [recent post](http://dev.xiligroup.com/?p=427 « Transform a theme with localization »).

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.8 beta

Today, xili-language is ‘compatible’ with ‘nightly’ of next WP release.

F. A. Q.

What about WPMU and the trilogy ?

xili-language, xili-tidy-tags, xili-dictionary

Since WP 3.0-alpha, if multisite is activated, the trilogy is now compatible and will include progressively some improvements dedicaded especially for WPMU context. Future specific docs will be available for registered webmasters. Contact us.

How to see post or page ID in dashbord ?

Reveal IDs for WP Admin is an efficient plugin found in WP repository.

Are the default rules (functions) of xili-language plugin hookable ?

Yes, by theme’s developers. In plugin’s php script, all is documented and the hooks can be added in functions.php file of the theme. Here one example to create a languages list with flag as here in left sidebar.

Where can I see websites using this plugin ?

dev.xiligroup.com (« why xili-language ? »)
and
www.xiliphone.mobi (« a theme for mobile ») also usable with mobile as iPhone.

JacobandEric informs that these two websites are powered by xili-language :
http://terranovasite.com/blog/
http://altitude-blog.com/

Screenshots

1. an example of wp-content/themes folder of a theme with localization files (.mo)
an example of wp-content/themes folderan example of wp-content/themes folder
2. the admin settings UI
the admin settings UIthe admin settings UI
3. the language setting in post writting UI
the language setting in post writting UIthe language setting in post writting UI
4. coding extract with ‘international’ text in ‘xiliphone’ theme
coding extract with 'international' text in 'xiliphone' themecoding extract with 'international' text in 'xiliphone' theme
5. Admin Tools UI – pre-set default language of author according his browser’s language.
Admin Tools UI - pre-set default language of author according his browser's language.Admin Tools UI - pre-set default language of author according his browser's language.
6. xili-tidy-tags : Admin Tools UI – see this compatible plugin to group tags according languages
xili-tidy-tags : Admin Tools UI - see this compatible plugin to group tags according languagesxili-tidy-tags : Admin Tools UI - see this compatible plugin to group tags according languages
7. xili-dictionary : Admin Tools UI – list of translated terms
xili-dictionary : Admin Tools UI - list of translated termsxili-dictionary : Admin Tools UI - list of translated terms

Other Notes

What happens if frontpage is a page ?

Before publishing an ‘how-to‘, since 0.9.9.4, the plugin incorporates now features that are formerly possible through the hookable functions of xili-language. The page frontpage must have her clones in each other languages. As for posts, if the user’s browser is not in the default language, xili-language will display the page in the corresponding language if set by the editor. Be patient, a detailled post will arrive soon…

The first beta releases was for theme’s creator or designer.

See also the other posts about xili-language here.

and the [WordPress plugins forum].

Download

The current version is available in the WordPress Plugins Directory repository.

 
 
xili-language: posts series for experts
  1. xili-language plugin : release 1.6.0 (compatible WP 3.0)
  2. Q&A about xili-language plugin, release 1.1
  3. xili-language : hooks, filters, class and so on...
  4. From a theme with localization to a multilingual theme with xili-language : technical and general notes.
  5. xili-language - 1.4.1 - new libraries
  6. Xili-language toolbox in one table
  7. xili-language and the time
  8. xili-language : Affichage des dates et heures
 
 
 
xili-language: posts series for authors
  1. xili-language plugin : release 1.6.0 (compatible WP 3.0)
  2. xili-language: a helpful shortcode
  3. [updated] Publishing in multiple languages. Benefits, tips and tricks with wordpress and xili-language plugin.
 
 
Tags: , , ,
21 Comments »
  1. Can you explain « automatic » selection of language ?

    Comment by Calitinilo — June 04, 2009 @ 19:31

  2. Instead some other multilingual site, with xili-language, all the post in different language are in the SAME wordpress database. No need to do two or more databases. After setting the plug-in, when you create a post, you have only to check the language of the created post. And when a visitor read this post, the theme (with basic rules) will be in the same language as the post language by automatically selecting the .mo file attached to the theme.
    M.

    Comment by admin — June 04, 2009 @ 19:37

  3. Hey guys I have a question for you… i’m trying to install wordpress through wordpress’ admin panel and I’m getting the following error:

    ‘Parse error: parse error in D:\wamp\www\wordpress\wp-content\plugins\xili-tidy-tags\xili-tidy-tags.php on line 1486′.

    Line 1486 is the last line of the file… nothing wrong there.. I looked the whole file and I can’t spot anything wrong with the code… here is what I’m using, PHP: 5.3.0.

    Any help appreciated ;)

    Comment by Giannis — July 17, 2009 @ 19:34

  4. Hello Giannis !

    I am not sure but

    Try to erase & in both instantiations at the end

    $xili_tidy_tags = new xili_tidy_tags (false, false);

    $xili_tidy_tags_cloud_widgets = new xili_tidy_tags_cloud_multiple_widgets ();

    Also :

    When the error is at the end…. it is often when a control flow (if { or }…. is not correct … is php 5.3 more rigourous !

    Thanks for your observations

    Comment by admin — July 17, 2009 @ 19:52

  5. Hi once again! I tried what you suggested but with no luck ;/

    I also rolled back to PHP 5.2.0 and got a « unexpected $end » as you said. the thing is that I scanned again the whole file, I used Aptana and xDebug and I cant find the parse error… I also did this:

    I erased the first class ‘xili_tidy_tags’ from the file and I managed to install the plugin correctly, so I suppose that the problem is somewhere in that class.

    Has anybody else faced the same kind of trouble?

    Thank you

    Comment by Giannis — July 18, 2009 @ 0:15

  6. You are the first who describe that pb with PHP 5.2 and 5.3 on his server… Here I test on PHP 5.2.6 (mamp local server) and xiligroup online server (php 5.2.10) and one client use it on PHP4 (it is why the instantiation used =& code)… read you email for other texts…

    Comment by admin — July 18, 2009 @ 10:06

  7. Hello, how to force on demand lang=en_us to deduce a theme en_us.php? And on demand
    ? lang=en_rus to use other theme.

    Comment by DEHuCKA — August 12, 2009 @ 15:09

  8. Our other plugin xilitheme select is able to select a theme according the browser of the device (here mobile). (http://dev.xiligroup.com/?cat=395&lang=en_us) – It will be note very difficult to do a language theme select but do you think it will be a good idea ?
    How many users ask this ?

    Michel of dev.xiligroup

    Comment by xiligroup dev — August 28, 2009 @ 10:43

  9. 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!!

    Comment by Ildikó — January 21, 2010 @ 2:28

  10. Thanks for your question. I visit your site and see that your use only page (and not post) to fill your bilingual site… To engage an efficient dialog, I will open a forum discussion here.
    Michel
    dev.xiligroup team

    Comment by xiligroup dev — January 21, 2010 @ 8:21

  11. Hi there

    few questions if you can direct me:
    1.how do i make the mo.files?
    2.what plugin you used in your website to make the tabs in the post?

    thanks

    Comment by yoav — January 31, 2010 @ 4:03

  12. 1) two ways to build .mo files from .po files : a) on desktop computer, poEdit app is good on all OS (I use it on MacOsX), b) on WP itself, install xili-dictionary plugin which is able to build .po file and .mo file.
    2) The Tabs : It is not yet a stand alone plugin – As you can see in js source, the tabs javascript is SimpleTabs from Harald Kirschner modified for mootools by Daniel Sturm and us.
    Hope that help you !
    M for dev.xiligroup.com

    Comment by xiligroup dev — January 31, 2010 @ 9:34

  13. thank you . i will start by testing the xili-dict’ plugin.

    Comment by yoav — January 31, 2010 @ 17:49

  14. Thanks a lot for this pluging, i was using gengo but is out and i couldn’t update my wordpress because wasn’t compatible but with this one… bye bye gengo!! welcome xili-language and WordPress 2.9.2

    Comment by Anonyme — March 20, 2010 @ 3:40

  15. Hi, I am very new about WordPress. I Installed it at http://www.it.ranabd.com but now totally can’t see. for your kind info before I installed language switcher. I forgot to uninstall it. Now I can’t see my website. please advice me.

    Comment by Masud — March 31, 2010 @ 13:42

  16. This error occurs because your theme is not international or international complient…

    The next version (1.4.2a available now) fixes this issues.

    It is the opportunity to remind that

    1) the theme must prepared BEFORE plugin activation
    2) test with theme fusion or arlite from digitalnature – that are ready

    Comment by xiligroup dev — March 31, 2010 @ 15:20

  17. I think I find a bug:

    DEFAULTSLUG is set by calling $this->get_default_slug() which in turn calls get_terms(‘language’).

    However, ‘language’ terms are only registered in set_when_plugin_loaded() which is not called until ‘init’ action is called which is way after DEFAULTSLUG is already set.

    The result is DEFAULTSLUG will always be ‘en_US’. This causes all posts that are not selected with a language displayed in English.

    Just FYI.

    Comment by Stephen — April 28, 2010 @ 23:14

  18. I will do some tests to be sure that I have good understood your observations… I’ll keep you informed.
    [update]
    The version 1.5.3 fixes the described issue.
    Again, recovering the previous behaviour, when the language of the post is not set, the language of the theme is the default language of admin UI set in config.php. (if no special hook and « Select language of the home page » is « software defined »…
    Michel
    dev.xiligroup.com

    Comment by xiligroup dev — April 29, 2010 @ 8:01

  19. Thanks for fixing the bug. One question: is this plugin supposed to also change the default .mo file? The widgets in my side bar don’t seem to be affected by it like the posts.

    Comment by Stephen — April 30, 2010 @ 4:55

  20. if your site is bilingual (by example en_US and zh_TW), in your theme folder, you must have two .mo files en_US.mo and zh_TW.mo. To complete these two files (or only the non default zh_TW if theme is coded in english), you must use poEdit software or better xili-dictionary (see doc here and review in WP plugin repository) to add the words of titles of widgets or other terms of your theme. Why ? because files delivered with themes only contain basic terms of the theme design and not the terms of your site (category) or widget.
    I guess that you read php, so I think, you will be able to understood translation technics (gettext) with .po (text) and .mo (runtime version)…
    Hope that help you

    Comment by xiligroup dev — April 30, 2010 @ 8:26

Citations :

  1. xiligroup dev » Extension xili-language : version 0.9.9.4

RSS feed for comments on this post. | TrackBack URI

Leave a comment