Mar. 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
-
<li>
-
<?php include (TEMPLATEPATH . ‘/searchform.php’); ?>
-
</li>
-
<li><h2> Lingue </h2><ul>
-
polyglot_list_langs(false);
-
}?></ul>
single.php
-
<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
-
// 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’);
-
-
//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





One Response to “Polyglot’s setup”
Ho cercato di fare quanto tu hai fatto nel tuo con il plugin polyglot, ma purtroppo come mio solito non funziona, ovvero la parte dell’inserimento nella cartella dei plugin quella dell’attivazione è quella dell’inserimento dei tag
Vino Wine
non c’è problema, infatti l’articolo viene fuori senza problema (anche se viene fuori prima quella inglese e non quella italiana), i problemi vengono fuori quando inserisco la modifica alla sidebar.php, inserendo l’istruzione per come tu la dai :
Lingue
mi da un sonoro errore, se elimino la prima parte e cioè questa
nella sidebar.php esce il comando lingue ma non viene fuori il link delle lingue poi ho provato ad inserire nella single.php l’istruzione
” rel=“bookmark” title=“Permanent Link: ”>
ed anche qui non vedo nulla anzi nella index rimane tale e quale a come se non ci fosse poi se clicco sul post mi viene fuori un bel errore a sto punto ti chiedo dove cavolo sbaglio? Mi daresti una mano?
Ciao Sabato
By Sabato on 2007-01-05