Archive of published posts on March, 2006

Back home

Setup di PolyglotPolyglot’s setup

03/15/2006

Hi all, here’s a small tutorial to setup Polyglot in WordPress.
It’s very easy to do this: you have to get Polyglot from here, unpack the archive and put the files into WordPress’s plugins directory. Now you can activate this plugin from the plugin administration page, and start up to write a multilanguage post.
How? Simply using the lang_xx and /lang_xx tags to enclose the text, in the title and in the body of the post.
A very simple example:

Title: <lang_it> Vino </lang_it><lang_en> Wine </lang_en>
Body: <ang_it> Vino rosso</lang_it><lang_en> Red wine </lang_en>

now it’s enough to bring some modification is to the template ones of the sidebar that to the template ones of the single one post so that in before the languages available appear (than, if selected will apply the language to the blog), and in the second appears the small flag of the languages available for the single post.

Here’s my settings

sidebar.php

1
2
3
4
5
6
7
<li>
   <?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>
<li><h2> Lingue </h2><ul>
<?php if(function_exists('polyglot_list_langs')){
   polyglot_list_langs(false);
}?></ul>

single.php

1
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a><?php if(function_exists('lp_other_langs')) {lp_other_langs(' ',' ', ' ', ' ', ' ');}?></h2>

The last thing that I have made is to modify the file polyglot.php in order to personalize the plugin; here one snippet of mine:

polyglot.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Default language version - used when proper language version of the text is not present
$polyglot_settings['default_lang'] = 'it';

//You can define your own translations of language shortcuts

//$polyglot_settings['trans']['cs'] = 'česky';
//$polyglot_settings['trans']['de'] = 'deutsch';
$polyglot_settings['trans']['en'] = 'english';

$polyglot_settings['trans']['it'] = 'italiano';
//$polyglot_settings['trans']['nl'] = 'nederlands';
//$polyglot_settings['trans']['sv'] = 'svenska';


//Which language versions you offer for the whole web - use the proper ISO codes!
//$polyglot_settings['knownlangs'] = array('cs','en','sv');
$polyglot_settings['knownlangs'] = array('it','en');

//if there should be shown flags instead of names of languages
$polyglot_settings['use_flags'] = true;

And this is all, simple and clear.

Alla prox

3 Comments

Test per plugin PolyglotPolyglot plugin test

03/8/2006

Simple english post. I’m testing Polyglot plugin, for multilanguage posts.

No Comments