xili-language 1.7.0 is shipped in other versions : some “howto”

xili-language 1.7.0 is shipped in other versions repository part.

With now WordPress 3.0, the default theme named twentyten can be used without php coding for a multilingual site [as shown here]. xili-language plugin works on mono or multisite mode.

  • some functions are improved through new hooks (front-page selection without source coding for webmasters).
  • if you build your theme, some of your functions need revisions.

Some experiences when updating “old” theme as this running in dev.xiligroup.com

Topnews in dev.xiligroup

Topnews in dev.xiligroup

After upgrading with 1.7.0, the top news is displayed when page is in en_us but not when front-page is in fr_fr… Why ?

As you can read, the top news are drived by some lines in header.php (some here below). The editor have add some custom fields (topnews-xx_xx) to define ID of top news for each language.

$page_front = get_option('page_on_front');
$news_id = get_post_meta($page_front, 'topnews-'.the_curlang(), true);
if ($news_id) {
   $temp_query = $wp_query; $wp_query = null; /* to reset the lang of current wp_query */
   $wp_query = new WP_Query('p='.$news_id);

With xili-language 1.7.0 ‘get_option‘ is now filtered for ‘front-page’. So if current language is defined as in a header, the function get_option('page_on_front'); return the a filtered value equal to the translated page. To recover the french top news, the custom fields topnews-fr_fr for ID must filled in linked page in french of the default front page. (in the previous version, all the custom fields were set in default front-page).
Remember now, when front-page is “page” : no need to use special querytag as hlang as in previous versions to switch between page of each language… it is now automatic…

Question: In this website, the site’s title and the site’s description is translated when changing for english to french, why ?
Answer: With 1.7.0, filters of bloginfo('name') and bloginfo('description') are active inside the plugin (in previous versions, possible via external functions). If .mo file contains the targeted translations, the title and description are translated. xili-dictionary incorporates some features to append the .po file with these infos.

This entry was posted in How to. Bookmark the permalink.