=== xili-language === Contributors: MS dev.xiligroup.com Donate link: http://dev.xiligroup.com/ Tags: theme,post,plugin,posts,page,category,admin,multilingual, bilingual, taxonomy,dictionary,.mo file,.po file,localization, widget, language, international, i18n, l10n, wpmu, multisite Requires at least: 2.9 Tested up to: 3.0 Stable tag: 1.7.0 xili-language provides for a multilingual website an automatic selection of language (.mo) in theme according to the language of current post(s). == Description == **xili-language provides for a bilingual (or multilingual) website an automatic selection of language (.mo) in theme according to the language of current post(s) or page. Theme's behaviour can be fully personalized through hooks and api** * xili-language plugin provides an automatic selection of language in theme according to the language of displayed post, series of posts, page or articles. *If the post is in gaelic, the texts of the theme will be in gaelic if the author checks the post as gaelic and if the theme contains the right .mo file for this target language.* * xili-language select *on the fly* the .mo files present in the theme's folder. * Themes with *localization* can be easily transformed for realtime multilingual sites. * **NEW:** With now WordPress 3.0, the default theme named **twentyten** can be used without php coding for a multilingual site [as shown here](http://multilingual.wpmu.xilione.com). xili-language plugin works on mono or multisite mode. * xili-language is dedicated for theme's creator or webmaster with knowledges in CMS and WP and having (or not) tools to create .mo language files. Through API (hook), the plugin add automatic tools (or links or filters) for sidebar or top menus. Categories or Archives 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. TRILOGY FOR MULTILINGUAL CMS SITE : [xili-language](http://wordpress.org/extend/plugins/xili-language/), [xili-tidy-tags](http://wordpress.org/extend/plugins/xili-tidy-tags/), [xili-dictionary](http://wordpress.org/extend/plugins/xili-dictionary/) * With [xili-tidy-tags](http://wordpress.org/extend/plugins/xili-tidy-tags/), it is now possible to display sub-selection (cloud) of **tags** according language. With [xili-dictionary](http://wordpress.org/extend/plugins/xili-dictionary/) plugin (beta), it is easier to create or update online, via admin UI, the files .mo of each language. * 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. * **Documentation**: A new [table](http://dev.xiligroup.com/?p=1432) summarizes all the technical features (widgets, template tags, functions and hooks) of this powerful plugin for personalized CMS created by webmaster. * Check out the [screenshots](http://wordpress.org/extend/plugins/xili-language/screenshots/) to see it in action. = roadmap = * the readme file is under complete rewritting. * multilingual features tested with new post-type introduced by WP 3.0. will be documented for webmasters (please send an email). = 1.7.0 = * some functions are improved through new hooks (front-page selection). * fixes unexpected rewritting (when permalinks is set) and fixes query of category without languages. * **For developers:** `xiliml_cur_lang_head` filter is now obsolete and replace by `xiliml_curlang_action_wp` - see code source - the mechanism for frontpage (home recent posts list or page) is changed and don't now use redundant queries. * **For developers:** if you use `xili_language_list` hook action to create your own list - verify it if you use page as frontpage because 'hlang' querytag is now obsolete. * **Latest version compatible with WP 2.9.x** = 1.6.0 - 1.6.1 = * Add new features to manage sticky posts ( [see this post in demo website](http://multilingual.wpmu.xilione.com/) ) * Fixes refresh of THEME_TEXTDOMAIN for old WP 2.9.x * Improvements mainly for WP 3.0 * more functions to transform without coding site based on famous new twentyten theme. (article later) * possible to complete top nav menu with languages list for website home selection in two ways. * new functions for developpers/webmasters: `xili_get_listlanguages()`, see source. * example of language's definition (popup) to add new language. * Language list widget: list of available options added (hookable also). * some parts of source rewritten. = xili-language and template tags = * xili-language "*translates*" template tags and permits some variations for webmasters: The most current template tags don't need special work: `wp_list_categories()`, `wp_title()`,... `wp_get_archives` Possible that very special permalinks need to use hook named `xiliml_get_archives_link`. - Sub selection of archives for `wp_get_archives()` with &lang= [see installation notes](http://wordpress.org/extend/plugins/xili-language/installation/). `wp_list_pages()` with optional query tag &lang= * xili-language "*provides*" new template tags (or widgets) to solve issues from WP core or add new features for CMS: `xili_language_list()` - outside loop (sidebar) display the languages of the site (used also by widget) `xiliml_the_category()` - replace the_category() template tag of WP Core improved `xiliml_the_others_posts()` function and theme tag to be used in multilingual category loop and 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. * 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). = Technical infos = **Prerequisite:** Verify that your theme is international compatible (translatable terms like `_e('the term','mytheme')` and no displayed texts 'hardcoded' (example in theme 'default-i18n' of WP). * Based on class and oop - New settings UI according to new rules and style of WP 2.7 (meta_boxes, js) - *ONLY USE WITH Wordpress 2.7 and more* - Hooks (Action, Filter) usable in your functions.php. * Optional improving hooking ways to be compatible with l10n cache of Johan's plugin see line 2200. **CMS:** * Contains features dedicated to multilingual theme's creators and webmasters. **Documentation**: A new [table](http://dev.xiligroup.com/?p=1432) summarizes all the technical features (widgets, template tags, functions and hooks) of this powerful plugin for personalized CMS created by webmaster. * 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 [here](http://dev.xiligroup.com/?cat=480&lang=en_us). * 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/) * unique id for category link hook [see expert's corner posts](http://dev.xiligroup.com/?p=1045) * fixes unexpected like tags metabox added by WP 28 ( see [trac #10437](http://core.trac.wordpress.org/ticket/10437) ). * hooks to define header metas or language attributes in html tag. **More infos and docs** * other texts and more descriptions [here](http://dev.xiligroup.com/xili-language/ "why xili-language ?") = Compatibility = xili-language is compatible with the plugin [xili-dictionary](http://dev.xiligroup.com/?p=312 "why xili-dictionary ?") which is able to deliver .mo files on the fly with the WP admin UI (and .po files translatable by other translators). [xili-dictionary](http://dev.xiligroup.com/xili-dictionary/ "xili-dictionary posts") used a specific taxonomy without adding tables in WP database. xili-language is full compatible with the plugin [xilitheme-select](http://wordpress.org/extend/plugins/xilitheme-select/ "xilitheme-select") to be used with iPhone, iPod Touch or other mobiles. xili-language is compatible with the plugin [xili-tidy-tags](http://dev.xiligroup.com/xili-tidy-tags/ ). xili-tidy-tags lets you create multiple group of tags. That way, you can have a tag cloud for tags in English, another cloud for French tags, another for Spanish ones, and so on. You can also use the plugin for more than multilingual blogs. Basically, you can create any group of tags you want. More informations on the site [dev.xiligroup.com](http://dev.xiligroup.com/ "xiligroup plugins") Check out the [screenshots](http://wordpress.org/extend/plugins/xili-language/screenshots/) to see it in action. == 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 box at the right of the post editing window before publishing. 7. If you are webmaster and want to add lot of personalizations in your theme, visit [expert's corner](http://dev.xiligroup.com/?cat=480&lang=en_us). = 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 your 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. NOTE FOR COMMENT FORM IN WP 3.0: Today with WP3.0, comments form language is based on default language of admin UI and not on theme's language. xili-language solves this features. So you need to add this terms msgid in the .po of your theme for translation used by xili-language. In latest version, xili-dictionary adds this option to avoid tedious copy and paste ! ` Name Email Website Comment You must be logged in to post a comment. Logged in as %2$s. Log out? Your email address will not be published. Required fields are marked * You may use these HTML tags and attributes: Leave a Reply Leave a Reply to %s Cancel reply Post Comment ` = 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 [post](http://dev.xiligroup.com/?p=427 "Transform a theme with localization"). = Browser detection for visitors or authors = To change the language of the frontpage according to the language of the visitor's browser, check the popup in right small box in settings. To change the default language of a new post according to the language of the author's browser, check the popup 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 : `