- Statut : non résolu
- Ce sujet contient 34 réponses, 5 participants et a été mis à jour pour la dernière fois par
Jean-Marc, le il y a 18 années et 7 mois.
-
AuteurMessages
-
22 juin 2006 à 2 h 03 min #447965
Salut à toutes et à tous,
Devant refaire au complet un site pour une association en Belgique, je me dis que WordPress serait idéal, surtout que, comme en Belgique il y a 2 langues officielles, je me dis qu’il serait bien de faire un site trilingue (Français, Néerlandais et anglais pour les visiteurs étrangers qui sont quand-même assez nombreux à ce qu’on me dit).
J’ai vu des sites avec des petits drapeaux et j’ai constaté que le texte change de langue, mais pas toujours le thème.
Comment fait-on pour que tout change de langue (textes, thèmes, WordPress lui-même (pour les dates et le reste des « détails »)) ?
Enfin, je suis à chercher des thèmes avec des fichiers .mo car je suppose que ça va être indispensable et que créer un thème localisé de toutes pièces ne doit pas être un jeu d’enfant. Si qqn sait où en trouver …Pour les plugins, j’ai trouvé une discussion où Xavier explique comment on localise. Je vais essayer et voir si je m’en sors.
Merci de vos z’avis z’avisés,
Jean-Marc23 juin 2006 à 14 h 51 min #575790J’avance, mais il me reste encore des questions sans réponse.
Avec polyglot et la localisation du thème, j’arrive à avoir la grande majorité du site qui change de langue.
toutefois, il me reste à trouver le moyen de traduire les catégories. Si qqn sait comment on fait …
De même, les dates ne sont traduites qu’à moitié. L’ordre des choses (jour, mois, année, etc …) se met à sa place, mais tout reste ne français. Je n’arrive pas à trouver comment traduire mercredi en woensdag ou wednesday selon la langue chosie. Je suis sur qu’il doit y avoir moyen de trouver qqch mais je n’y arrive pas, aussi je fais appel à l’équipe … 😉
Allez donc faire une petit tour sur le site et dites moi ce que vous en pensez (http://www.crorb.org/wordpress)Merci de vos z’avis z’avisés,
Jean-Marc23 juin 2006 à 23 h 31 min #575791Ca m’intéresserait de savoir comment on utilise le plugin Polyglot… je dois un peu bête… j’ai pas tout compris… (et pourtant j’ai essayé)
25 juin 2006 à 22 h 01 min #575792Il existe une nouvelle version : polyglot 2. Sans doute est-elle simplifiée, parce que je n’ai pas eu de difficulté réelle à arriver à ce que vous pouvez voir sur le site http://www.crorb.org/wordpress.
Cette version de polyglot permet aussi, via un cookie, de se souvenir de la langue du site chez le visiteur pour rouvrir le site dans la même langue la fois suivante. Et même, via la langue du browser, de s’imaginer la langue dans laquelle afficher à la première ouverture.J’ai téléchargé polyglot 2 ici : http://fredfred.net/skriker/index.php/polyglot
Ensuite j’ai modifié le php comme expliqué sur la page de téléchargement, soit :
$polyglot_settings[‘default_lang’] = ‘fr’;
C’est la langue par défaut de ton site pour quand un visiteur y vient la première fois
$polyglot_settings[‘trans’][‘en’] = ‘english’;
$polyglot_settings[‘trans’][‘de’] = ‘deutsch’;
$polyglot_settings[‘trans’][‘nl’] = ‘nederlands’;
$polyglot_settings[‘trans’][‘fr’] = ‘français’;Et les lignes suivantes déterminent les textes à afficher pour les traductions (quand tu n’utilises pas les drapeaux)
$polyglot_settings[‘knownlangs’] = array(‘fr’,’nl’,’en’);
Ce sont les langues que tu veux sur ton site.
$polyglot_settings[‘use_flags’] = true;
(si tu mets true, tu vois les drapeaux. si tu mets false, tu vois les textes. Par défaut : false)
$polyglot_settings[‘time_format’][‘en’] = ‘g.i a’;
$polyglot_settings[‘time_format’][‘nl’] = ‘G:i’;
$polyglot_settings[‘time_format’][‘fr’] = ‘G:i’;
$polyglot_settings[‘date_format’][‘en’] = ‘Y-m-d’;
$polyglot_settings[‘date_format’][‘nl’] = ‘j F Y’;
$polyglot_settings[‘date_format’][‘fr’] = ‘j F Y’;Ceci est supposé faire modifier les dates suivant les langues. En fait, la position de chaque partie de la date se met à jour, mais les noms des jours et des mois restent en fr, dans mon cas.
$polyglot_settings[‘wplang’][‘ar’] = ‘ar’;
$polyglot_settings[‘wplang’][‘bg’] = ‘bg_BG’;
$polyglot_settings[‘wplang’][‘cs’] = ‘cs_CZ’;
$polyglot_settings[‘wplang’][‘cy’] = ‘cy’;
$polyglot_settings[‘wplang’][‘da’] = ‘da_DK’;
$polyglot_settings[‘wplang’][‘de’] = ‘de_DE’;
$polyglot_settings[‘wplang’][‘el’] = ‘el’;
$polyglot_settings[‘wplang’][‘eo’] = ‘eo’;
$polyglot_settings[‘wplang’][‘es’] = ‘es_ES’;
$polyglot_settings[‘wplang’][‘fa’] = ‘fa’;
$polyglot_settings[‘wplang’][‘fi’] = ‘fi_FI’;
$polyglot_settings[‘wplang’][‘fr’] = ‘fr_FR’;//fr_BE
$polyglot_settings[‘wplang’][‘hu’] = ‘hu_HU’;
$polyglot_settings[‘wplang’][‘it’] = ‘it_IT’;
$polyglot_settings[‘wplang’][‘ja’] = ‘ja_JP’;
$polyglot_settings[‘wplang’][‘ko’] = ‘ko’;
$polyglot_settings[‘wplang’][‘nb’] = ‘nb_NO’;//nn_NO
$polyglot_settings[‘wplang’][‘nl’] = ‘nl_NL’;
$polyglot_settings[‘wplang’][‘pl’] = ‘pl_PL’;
$polyglot_settings[‘wplang’][‘pt’] = ‘pt_BR’;
$polyglot_settings[‘wplang’][‘ru’] = ‘ru_RU’;
$polyglot_settings[‘wplang’][‘sk’] = ‘sk’;
$polyglot_settings[‘wplang’][‘sq’] = ‘sq’;
$polyglot_settings[‘wplang’][‘sr’] = ‘sr_CS’;
$polyglot_settings[‘wplang’][‘sv’] = ‘sv_SE’;
$polyglot_settings[‘wplang’][‘zh’] = ‘zh_CN’;Ceci défini les nom des fichiers .mo pour les langues utilisées. J’y ajouté le nl parce qu’il n’existait pas dans la liste et que donc la traduction ne se faisait pas vers le nl.
Enfin, j’ai enlever les
et
pour que les drapeaux se mettent l’un à côté de l’autre et pas l’un en dessous de l’autre, avec des points de li.
La fonction modifiée devient :function polyglot_list_langs($flags=false){
global $polyglot_settings,$wp_query;
$clean_uri = polyglot_uri_cleaner($_SERVER[‘REQUEST_URI’]);
if(!$polyglot_settings[‘use_helpers_in_uri’]){
$uri_helper = »;
}
else {
$uri_helper = « {$polyglot_settings[‘uri_helpers’][‘lang_pref’]}/ »;
}
foreach($polyglot_settings[‘knownlangs’] as $value){
if ( $value==$polyglot_settings[‘lang_pref’] ) {
$highlight = « language_item current_language_item »;
} else {
$highlight = « language_item »;
}
echo » <a>« . (($flags) ? « <img /> » : get_trans($value)) . »</a>« ;
}
}A ce que j’ai vu sur le site du créateur, on pourrait écrire le nom des catégories avec les balises de langues, mais chez moi il supprime les balises quand il sauve dans la bdd. Donc quand je retourne sur le site, au lieu d’avoir le nom de la catégorie dans la langue choisie, j’ai les trois noms dans toutes les langues.
En allant ajouter les balises directement dans la bdd via phpmyadmin, ça passe. Mais comme ce n’est pas moi qui serai rédacteur, je ne trouve pas le système idéal. Une autre solution proposée est de localiser les noms des catégories. Là encore, le rédacteur ca devoir aller jouer dans le .po et devra avoir un poedit pour recompiler puis repousser le tout sur le serveur. Vraiment repoussant pour le rédacteur basique, et vraiment risqué pour le site qui, selon, ne mettra pas longtemps à ne plus fonctionner du point de vue des langues.
Enfin, lorsque je suis dans l’archive, il me met les 3 noms pour le nom de catégorie. Là aussi je pense qu’il y aurait une petite modif à faire.En résumé, polyglot peut-être pas mal pour un site statique, mais pour un site mis à jour régulièrement …
Quoi qu’il en soit, ça me paraît vraiment une bonne base et un bon départ.Si qqn trouve le moyen de localiser les catégories directement dans l’admin, je suis preneur.
Je suis aussi preneur d’un moyen pour que les noms des mois, des jours etc se traduisent aussi.Jean-Marc
29 juin 2006 à 11 h 39 min #575793merci, pour ton tutos, trop cool mais j’ai un dernier prob, c’est que sur mon site…www.dbmacity.com…tout apparait comme il le faux mais une fos que je clique sur un floag ca plante , je pense qu’il manque des .mo mais ou je vais les mettre..
merci d’avance..
29 juin 2006 à 13 h 47 min #575794Salut,
J’ai été me promener sur ton site et je n’ai rien vu de spécial. Tout fonctionne parfaitement.
Mais comme ce poste parle de polyglot et que je n’ai vu aucune traduction possible, je me dis que tu as désactivé le plugin. Pour voir ce qui ne va pas, il faudrait que tu le réactives.
Pour les .mo, tu as les .mo « d’origine » (pour WP lui-même) qui sont dans wp-includes/languages et les .mo pour traduire ton thème qui doivent se trouver dans ton thème. Si tu veux traduire des plugins, tu fais des .mo pour eux aussi.Jean-Marc
29 juin 2006 à 14 h 08 min #575795oups c’est vrais que ce n’etais pas pratique, voila c’est mis
donc a l’activation de poliglot dan les plugins wordpress j’ai ca :
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-admin/plugins.php on line 15
apres sur mon site j’ai …
Not Found
The requested URL /lang-pref/it/ was not found on this server.Apache/1.3.36 Server at http://www.dbmacity.com Port 80
merci de m’aide
Ps j’ai mis les .mo dans le theme…
quand je me deconnecte de wordpress admin j’ai
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-login.php on line 9
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-includes/pluggable-functions.php on line 337
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-includes/pluggable-functions.php on line 338
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-includes/pluggable-functions.php on line 339
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-includes/pluggable-functions.php on line 340
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-includes/pluggable-functions.php on line 288
29 juin 2006 à 23 h 32 min #575796Salut,
Not Found
The requested URL /lang-pref/it/ was not found on this server.Il semble que la langue de préférence définie dans polyglot.php soit l’italien. Vérifie si tu as bien un it_IT.mo dans ton répertoire de thème.
Si ce n’est pas l’italien que tu veux, change ton polyglot.php pour avoir une langue dont tu as les .mo dans ton répertoire.
Pour les autres erreurs, il te faudrait l’aide de qqn d’autre. Selon moi c’est plus un pbl avec WP, peut-être créé par polyglot ou par ton thème.
Désactive polyglot, mets un autre thème puis réactive polyglot. Si tu as toujours les mêmes messages, ce n’est pas du côté du thème qu’il faut chercher.
Ensuite, essaye d’installer ou de désactiver et réactiver un autre plugin et vois si tu as toujours le même genre de messages, auquel cas il faudrait chercher dans WP, ou bien désactiver polyglot et l’enlever complètement du serveur (Tu le mers qq part sur ton disque dur pour le remettre par la suite si ce n’est pas lui le problème). Si une fois que polyglot est enlevé, tu n’as plus de messages avec un autre plugin qui générait les mêmes messages, c’est que c’était polyglot le problème.Tiens nous au courant de la suite, et de la solution si tu la trouves.
Jean-Marc
30 juin 2006 à 8 h 29 min #575797Donc : j’ai remis les langues .mo dasn TOUT les repertoire…renommer lang-pref: ca ne marche pas
j’ai desactiver le plugin ca remarche apparement c’estun problème du ploginbref…c’est la merde..je le desactive.. et basta
j’ai toujours le messgae dêrreur.. seulement avec le plugin polyglot.
Warning: Cannot modify header information – headers already sent by (output started at /home.1/d/b/m/dbmacity/www/wp-content/plugins/polyglot.php:1) in /home.1/d/b/m/dbmacity/www/wp-admin/plugins.php on line 15
30 juin 2006 à 16 h 19 min #575798Salut,
En cherchant ton pbl, j’ai eu le même chez moi. Je ne dis pas que ce n’est pas polyglot, je n’en sais rien, et en effet, si tu n’as plus le problème lorsque tu l’enlèves, il est fort probable que ce soit lui qui cause un problème avec WP.
Par contre, ce que j’ai remarqué c’est que cette erreur vient toujours quand le fichier du plugin que j’active est codé en utf-8. Je me demande pas pourquoi ça ne marche pas. Je n’en sais rien. C’est juste un constat que je fais. Lorsque je passe le fichier en ansi et que mets les codes html pour les caractères accentués, le problème disparaît.
Cela dit, ce n’est pas parce que c’est comme ça chez moi que ce sera comme ça pour toi.
A part ça, pour moi polyglot fonctionne bien. Tu peux le voir sur le site que je suis en train de développer (http://www.crorb.org/wordpress/).
Je dirais peut-être qu’il a qq problèmes, mais je n’irais pas jusqu’à dire que c’est de la merde. Une maladie de jeunesse tout au plus, selon moi. Mais ceci n’est que mon avis.Jean-Marc
30 juin 2006 à 22 h 32 min #575799je ne dis pas que c’est de la merde mais bon , c’est chiant…
peut tu me donner ton fichier polyglot.php ou mettre ta config sur ton post, comme ca j’essaye de le mettre dans ma BDD et je te dis …
merci.
1 juillet 2006 à 1 h 36 min #575800Voici le polyglot que j’utilise.
J’ai juste fais quelques transformations pour avoir les drapeaux l’un à côté de l’autre et pas l’un en dessous et de l’autre et pour pouvoir traduire les noms des jours et des mois.
<?php
/*
Plugin Name: Polyglot
Plugin URI: http://fredfred.net/skriker/index.php/polyglot
Description: Plugin that helps you make your Wordpress powered web completely multilingual. With full support of multiple time and date formats, localization of your RSS feeds and, of course, publishing your posts and pages in any number of languages. Inspired by <a href="http://www.noprerequisite.com/language_picker/">Language Picker</a>. For more information, comments or questions visit the <a href="http://fredfred.net/skriker/index.php/polyglot">Polyglot’s homepage</a>.
Version: 2.0
Author: Martin Chlupac
Author URI: http://fredfred.net/skriker/
Update: http://fredfred.net/skriker/plugin-update.php?p=198
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
*/
// Default language version – used when proper language version of the text is not present or the visitor’s prefered language is unknown
$polyglot_settings[‘default_lang’] = ‘fr’;
//You can define your own translations of language shortcuts
$polyglot_settings[‘trans’][‘en’] = ‘english’;
$polyglot_settings[‘trans’][‘de’] = ‘deutsch’;
$polyglot_settings[‘trans’][‘nl’] = ‘nederlands’;
$polyglot_settings[‘trans’][‘fr’] = ‘français’;
$polyglot_settings[‘trans’][‘cs’] = ‘česky’;
$polyglot_settings[‘trans’][‘it’] = ‘italiano’;
$polyglot_settings[‘trans’][‘sv’] = ‘svenska’;
//Which language versions you offer for the whole web – use the proper ISO codes!
$polyglot_settings[‘knownlangs’] = array(‘fr’,’nl’,’en’);
//set to ‘true’ if there should be shown flags instead of names of languages
$polyglot_settings[‘use_flags’] = true;
//list of ISO codes and their image represantations (flags).
//all flags can be found in ‘polyglot_flags’ directory
$polyglot_settings[‘flags’][‘en’] = ‘gb.png’;
$polyglot_settings[‘flags’][‘de’] = ‘de.png’;
$polyglot_settings[‘flags’][‘nl’] = ‘nl.png’;
$polyglot_settings[‘flags’][‘fr’] = ‘fr.png’;
$polyglot_settings[‘flags’][‘cs’] = ‘cz.png’;
$polyglot_settings[‘flags’][‘it’] = ‘it.png’;
$polyglot_settings[‘flags’][‘sv’] = ‘se.png’;
//time format for each language
//if not set – default WP time format is used
$polyglot_settings[‘time_format’][‘en’] = ‘g.i a’;
$polyglot_settings[‘time_format’][‘de’] = ‘G:i’;
$polyglot_settings[‘time_format’][‘nl’] = ‘G:i’;
$polyglot_settings[‘time_format’][‘fr’] = ‘G:i’;
$polyglot_settings[‘time_format’][‘cs’] = ‘G.i’;
$polyglot_settings[‘date_format’][‘en’] = ‘Y-m-d’;
$polyglot_settings[‘date_format’][‘de’] = ‘j. F Y’;
$polyglot_settings[‘date_format’][‘nl’] = ‘j F Y’;
$polyglot_settings[‘date_format’][‘fr’] = ‘j F Y’;
$polyglot_settings[‘date_format’][‘cs’] = ‘j. n. Y’;
/*path to the plugin directory
don’t forget trailing slash if you are changing this value
*/
$polyglot_settings[‘path_to_flags’] = get_bloginfo(‘wpurl’).’/wp-content/plugins/polyglot_flags/’;
//if you use WP older than 1.5 you must use this:
//$polyglot_settings[‘path_to_flags’] = get_bloginfo(‘url’).’/wp-content/plugins/’;
//default text that is shown when the proper language version of the post is missing and even the default language version is not there
// use $polyglot_settings[‘text_is_missing_message’] = »; if you want to turn it off.
$polyglot_settings[‘text_is_missing_message’] = ‘[lang_en]Sorry, but this post is not available in English[/lang_en][lang_fr]Désolé mais cet article n’a pas été traduit en français.[/lang_fr]’;
//———————-advanced———————————————————————–
//Should be printed where xx stands for ISO code of current language?
$polyglot_settings[‘print_meta’] = false;
// Name of the cookie – default:’wordpress_lang_pref’.$cookiehash
$polyglot_settings[‘lang_pref_cookie’] = ‘wordpress_lang_pref’.$cookiehash;
/*
Should Polyglot attempt to dynamically change the WP locale
setting based on user’s prefered language? Note, for this to work
.mo files must be renamed to match the name specified in $polyglot_settings[‘wplang’] array
but you don’t have to rename anything in most cases as there is already list of current WP versions present.
*/
$polyglot_settings[‘lang_change_locale’] = TRUE;
/*
To use permalinks for other languages set this to « true ».
You probably don’t have to do anything else if you have « index.php » in your permalink structure.
In some cases it doesn’t work smoothly with re-writing rules specified in .htaccess file – then you have to add some rules to that file manually.
For more info check: http://www.google.com/search?hl=en&q=mod_rewrite
*/
$polyglot_settings[‘lang_rewrite’] = true;
/**
This should stay turned off unless you had problems with rules in your .htaccess file and you have edited them manually.
*/
$polyglot_settings[‘i_have_manually_edited_my_htaccess_file’] = false; //change this only if you know what you are doing!
/**
There are some helpers added (/lang/, /lang-pref/) by default to the url to help Polyglot distinguish between language code and short post slug.
These can be turned off. But don’t turn them off unless you have a good reason to do that.
*/
$polyglot_settings[‘use_helpers_in_uri’] = true;
/**
If you want to use these helpers but you want to change them – do that here:
*/
$polyglot_settings[‘uri_helpers’][‘lang_view’] = ‘lang’;
$polyglot_settings[‘uri_helpers’][‘lang_pref’] = ‘lang-pref’;
/*
The xx from [lang_xx] will be translated according to this table to the $locale/WPLANG variable in WP. It also suggests the name of the .mo file.
Add your language or change it as you need.
*/
$polyglot_settings[‘wplang’][‘ar’] = ‘ar’;
$polyglot_settings[‘wplang’][‘bg’] = ‘bg_BG’;
$polyglot_settings[‘wplang’][‘cs’] = ‘cs_CZ’;
$polyglot_settings[‘wplang’][‘cy’] = ‘cy’;
$polyglot_settings[‘wplang’][‘da’] = ‘da_DK’;
$polyglot_settings[‘wplang’][‘de’] = ‘de_DE’;
$polyglot_settings[‘wplang’][‘el’] = ‘el’;
$polyglot_settings[‘wplang’][‘eo’] = ‘eo’;
$polyglot_settings[‘wplang’][‘es’] = ‘es_ES’;
$polyglot_settings[‘wplang’][‘fa’] = ‘fa’;
$polyglot_settings[‘wplang’][‘fi’] = ‘fi_FI’;
$polyglot_settings[‘wplang’][‘fr’] = ‘fr_FR’;//fr_BE
$polyglot_settings[‘wplang’][‘hu’] = ‘hu_HU’;
$polyglot_settings[‘wplang’][‘it’] = ‘it_IT’;
$polyglot_settings[‘wplang’][‘ja’] = ‘ja_JP’;
$polyglot_settings[‘wplang’][‘ko’] = ‘ko’;
$polyglot_settings[‘wplang’][‘nb’] = ‘nb_NO’;//nn_NO
$polyglot_settings[‘wplang’][‘nl’] = ‘nl_NL’;
$polyglot_settings[‘wplang’][‘pl’] = ‘pl_PL’;
$polyglot_settings[‘wplang’][‘pt’] = ‘pt_BR’;
$polyglot_settings[‘wplang’][‘ru’] = ‘ru_RU’;
$polyglot_settings[‘wplang’][‘sk’] = ‘sk’;
$polyglot_settings[‘wplang’][‘sq’] = ‘sq’;
$polyglot_settings[‘wplang’][‘sr’] = ‘sr_CS’;
$polyglot_settings[‘wplang’][‘sv’] = ‘sv_SE’;
$polyglot_settings[‘wplang’][‘zh’] = ‘zh_CN’;
//============================================STOP EDITING HERE! (unless you know what you are doing)=====================================
//=====================================HOOKS=====================================
add_filter(‘the_time’,’polyglot_the_time’,10,2);
add_filter(‘get_comment_time’,’polyglot_comment_time’);
add_filter(‘the_date’,’polyglot_the_date’,10,4);
add_filter(‘get_comment_date’,’polyglot_comment_date’);
add_filter(‘the_category_rss’,’__’,1);
add_filter(‘the_content’, ‘polyglot_filter_with_message’,1);
add_filter(‘the_title’, ‘polyglot_filter’,1);
add_filter(‘wp_list_pages’, ‘polyglot_filter_htmlentities’,1);
add_filter(‘single_post_title’, ‘polyglot_filter’,1);
add_filter(‘the_content_rss’, ‘polyglot_filter’,1);
add_filter(‘the_excerpt’, ‘polyglot_filter’,1);
add_filter(‘comment_text’, ‘polyglot_filter’,1);
add_filter(‘bloginfo’, ‘polyglot_filter’,1,1);
add_filter(‘list_cats’,’__’,1);//we register standard gettext function
add_filter(‘the_category’,’polyglot_translate_the_category’);
add_action(‘wp_head’,’polyglot_wp_head’);
add_action(‘init’,’polyglot_init’,1);
/*
You probably have to incerase the length of ‘cat_name’ column in MySql table ‘categories’ in your DB to be able to use this.
‘cat_name’ is by default just 55 characters long.
*/
add_filter(‘the_category’, ‘polyglot_filter_htmlentities’,1);
add_filter(‘list_cats’, ‘polyglot_filter_htmlentities’,2);
add_filter(‘sanitize_title’, ‘polyglot_sanitize_title’, 1);
add_filter(‘polyglot_filter’,’polyglot_filter’);
//here we try to guess which language user wants
//========================================
$polyglot_settings[‘lang_pref’] = polyglot_get_users_pref_lang();//we don’t know anything about the user’s preferred language yet but we can get it from his browser
//—————————————————————————-
/*
This function processes the requested URI and filters it before the rest of the WP gets it
*/
function polyglot_init() {
global $polyglot_settings,$locale;
$content = $_SERVER[‘REQUEST_URI’];
$languages = implode(‘|’,$polyglot_settings[‘knownlangs’]);
if(!$polyglot_settings[‘use_helpers_in_uri’]){
$find = array(
« /^(.*)/($languages)/?(.*)$/i »
);
}
else {
$find = array(
« /^(.*)/{$polyglot_settings[‘uri_helpers’][‘lang_pref’]}/($languages)/?(.*)$/i »,
« /^(.*)/{$polyglot_settings[‘uri_helpers’][‘lang_view’]}/($languages)/?(.*)$/i »
);
}
$replace = array( », »);
if (preg_match($find[0], $content, $matches)) {
$content = $matches[1] . « / » . $matches[3];
$_GET[‘lang_pref’] = $matches[2];
}
if ($polyglot_settings[‘use_helpers_in_uri’] && preg_match($find[1], $content, $matches)) {
$content = $matches[1] . « / » . $matches[3];
$_GET[‘lang_view’] = $matches[2];
}
$_SERVER[‘REQUEST_URI’]= $content;
$_SERVER[‘PATH_INFO’] = preg_replace($find,$replace,$_SERVER[‘PATH_INFO’]);
$_SERVER[‘PHP_SELF’] = preg_replace($find,$replace,$_SERVER[‘PHP_SELF’]);
//let’s check if user has chosen the preferred language
if ( isset($_GET[‘lang_pref’]) ) {
$_GET[‘lang_pref’] = strtolower($_GET[‘lang_pref’]);
if( in_array($_GET[‘lang_pref’],$polyglot_settings[‘knownlangs’]) ){
setcookie($polyglot_settings[‘lang_pref_cookie’], $_GET[‘lang_pref’], time() + 30000000, COOKIEPATH);
$polyglot_settings[‘lang_pref’]=$_GET[« lang_pref »];
}
}
//or he wants to see the post in the certain language
elseif( isset($_GET[‘lang_view’])){
$polyglot_settings[‘lang_pref’] = strtolower($_GET[‘lang_view’]);
}
//or at least has the cookie with some value
elseif( isset($_COOKIE[$polyglot_settings[‘lang_pref_cookie’]]) ) {
$polyglot_settings[‘lang_pref’] = strtolower(trim($_COOKIE[$polyglot_settings[‘lang_pref_cookie’]]));
}
/**
This part should be removed but for some reason it’s needed on some installations:(
*/
/*if($polyglot_settings[‘lang_rewrite’] && !$polyglot_settings[‘i_have_manually_edited_my_htaccess_file’]){
if(preg_match(‘//lang/(..)/i’,$_SERVER[‘REQUEST_URI’],$matches)){
$polyglot_settings[‘lang_pref’]=$matches[1];
}
if(preg_match(‘//lang-pref/(..)/i’,$_SERVER[‘REQUEST_URI’],$matches)){
$polyglot_settings[‘lang_pref’]=$matches[1];
setcookie($polyglot_settings[‘lang_pref_cookie’], $polyglot_settings[‘lang_pref’], time() + 30000000, COOKIEPATH);
}
}*/
/*
If the Polyglot is supposed to change the global language settings then… let’s do that!
*/
if ($polyglot_settings[‘lang_change_locale’]){
$polyglot_foo = ( isset($polyglot_settings[‘wplang’][$polyglot_settings[‘lang_pref’]]) ) ? $polyglot_settings[‘wplang’][$polyglot_settings[‘lang_pref’]] : $polyglot_settings[‘lang_pref’];
if (!defined(‘WPLANG’)){//just try
define(‘WPLANG’, $polyglot_foo);
}
if($locale != $polyglot_foo){
$locale = $polyglot_foo;
load_default_textdomain();
include(ABSPATH . WPINC . ‘/locale.php’);
}
}
return;
}
/**
Useful function when you want to generate new links with lang-pref settings. You must get rid of the old stuff!
*/
function polyglot_uri_cleaner($txt){
global $polyglot_settings;
$search = array(
« /{$polyglot_settings[‘uri_helpers’][‘lang_view’]}/../?/i »,
« /{$polyglot_settings[‘uri_helpers’][‘lang_pref’]}/../?/i »,
« /(?|&)lang_view=../i »,
« /(?|&)lang_pref=../i »,
« /^(.*index.php)/$/i »
);
$replace = array( », », », »,’$1′);
if(!$polyglot_settings[‘use_helpers_in_uri’]){
$search[] = « //(« .implode(« | »,$polyglot_settings[‘knownlangs’]). »)/?/i »;
$replace[] = »;
}
$txt = preg_replace ( $search, $replace, $txt);
return $txt;
}
//—————————————————————————-
function polyglot_knownlangs(){
global $polyglot_settings;
return $polyglot_settings[‘knownlangs’];
}
function polyglot_translations(){
global $polyglot_settings;
return $polyglot_settings[‘trans’];
}
//—————————————————————time functions ————————
function polyglot_date($d = », $time = »){
global $polyglot_settings;
if($d == » && isset($polyglot_settings[‘date_format’][$polyglot_settings[‘lang_pref’]])){
$d = $polyglot_settings[‘date_format’][$polyglot_settings[‘lang_pref’]];
}
if(strpos($time, ‘-‘)){//trick to find you if we’ve got « mysql time » or unix timestamp
$time = mysql2date($d, $time);
}
else{
$time = date($d,$time);
}
return $time;
}
function polyglot_time($d = », $time = »){
global $polyglot_settings;
if($d == » && isset($polyglot_settings[‘time_format’][$polyglot_settings[‘lang_pref’]])){
$d = $polyglot_settings[‘time_format’][$polyglot_settings[‘lang_pref’]];
}
if(strpos($time, ‘-‘)){//trick to find you if we’ve got « mysql time » or unix timestamp
$time = mysql2date($d, $time);
}
else{
$time = date($d,$time);
}
return $time;
}
function polyglot_comment_time($time) {
global $comment,$polyglot_settings;
if( isset($polyglot_settings[‘time_format’][$polyglot_settings[‘lang_pref’]]) ){
$d = $polyglot_settings[‘time_format’][$polyglot_settings[‘lang_pref’]];
$comment_date = $comment->comment_date;
$time = mysql2date($d, $comment_date);
}
return $time;
}
function polyglot_the_time($time,$d = »){
global $post,$polyglot_settings;
if( isset($polyglot_settings[‘time_format’][$polyglot_settings[‘lang_pref’]]) && $d== »){
$d = $polyglot_settings[‘time_format’][$polyglot_settings[‘lang_pref’]];
$time = $post->post_date;
$time = mysql2date($d, $time);
}
return $time;
}
function polyglot_comment_date($time) {
global $comment,$polyglot_settings;
if( isset($polyglot_settings[‘date_format’][$polyglot_settings[‘lang_pref’]]) ){
$d = $polyglot_settings[‘date_format’][$polyglot_settings[‘lang_pref’]];
$comment_date = $comment->comment_date;
$time = mysql2date($d, $comment_date);
}
return $time;
}
function polyglot_the_date($the_date, $d = », $before = », $after = »){
global $post,$polyglot_settings;
if( isset($polyglot_settings[‘date_format’][$polyglot_settings[‘lang_pref’]]) && $d== » && $the_date!= » ){
$d = $polyglot_settings[‘date_format’][$polyglot_settings[‘lang_pref’]];
$the_date = $post->post_date;
$the_date = $before.mysql2date($d, $the_date).$after;
}
return $the_date;
}
//———————————————-
function polyglot_get_lang(){
global $polyglot_settings;
return $polyglot_settings[‘lang_pref’];
}
function get_trans($lang){
global $polyglot_settings;
if(IsSet($polyglot_settings[‘trans’][$lang]))
return $polyglot_settings[‘trans’][$lang];
else
return $lang;
}
function polyglot_wp_head(){
global $polyglot_settings;
if($polyglot_settings[‘print_meta’]){
echo « »;
}
}
function polyglot_filter_htmlentities($content, $category = null){
$content = preg_replace(« /<(/){0,1}lang_(..)>/i », « », $content);
return polyglot_filter($content);
}
/**
Very simple test if the $lang version is present in the text.
*/
function polyglot_lang_exists($lang, $content){
return ( !(strpos($content, « ») === false) || !(strpos($content, « [lang_$lang] ») === false) );
}
function polyglot_list_langs($flags=false){
global $polyglot_settings,$wp_query;
$clean_uri = polyglot_uri_cleaner($_SERVER[‘REQUEST_URI’]);
if(!$polyglot_settings[‘use_helpers_in_uri’]){
$uri_helper = »;
}
else {
$uri_helper = « {$polyglot_settings[‘uri_helpers’][‘lang_pref’]}/ »;
}
foreach($polyglot_settings[‘knownlangs’] as $value){
if ( $value==$polyglot_settings[‘lang_pref’] ) {
$highlight = « language_item current_language_item »;
} else {
$highlight = « language_item »;
}
echo » <a>« . (($flags) ? « <img /> » : get_trans($value)) . »</a>« ;
}
}
/*
Original function in WP doesn’t work properly:(
*/
function polyglot_trailingslashit($uri){
if($uri{strlen($uri)-1} != ‘/’)
return $uri.’/’;
else
return $uri;
}
/**
The core function of the plugin. Selects only one language version from the passed text.
*/
function polyglot_filter($text, $lang = ») {
global $polyglot_settings;
if($lang == »){$lang = $polyglot_settings[‘lang_pref’];}
$text = preg_replace(« /[(/){0,1}lang_(..)]/i », « », $text);//fix for [lang_xx]
$text = preg_replace (‘/<p>()</p>/i’, »$1″,$text);//fix for <p></p>
$text = preg_replace (‘/()/i’, »\1″,$text);//adds lang_all to all other stuff that is not enclosed in lang_xx tags
$text = preg_replace (‘/()/i’, »\1″,$text);
$text = ».$text. »;
if (preg_match_all ( ‘//’, $text , $match, PREG_PATTERN_ORDER)) {
if (isset($polyglot_settings[‘lang_pref’]) && polyglot_lang_exists($polyglot_settings[‘lang_pref’],$text)){
//lets try to get proper language version
$text=str_replace(« », » »,$text);//we don’t want just lang_pref parts but also lang_all parts
$text=str_replace(« », » »,$text);
$find = « /(?s)(.*?)/ »;
preg_match_all ( $find, $text , $match, PREG_PATTERN_ORDER);
$text = implode( »,$match[1]);
}
elseif(polyglot_lang_exists($polyglot_settings[‘default_lang’],$text)){
//or at least the default language
$text=str_replace(« », » »,$text);
$text=str_replace(« », » »,$text);
$find = « /(?s)(.*?)/ »;
preg_match_all ( $find, $text , $match, PREG_PATTERN_ORDER);
$text = implode( »,$match[1]);
}
else {
//all untranslated stuff
$text=str_replace(« », » »,$text);
$text=str_replace(« », » »,$text);
$find = « /(?s)(.*?)/ »;
$replace = « »;
$text = preg_replace($find,$replace,$text);
}
}
return str_replace(array(« », » »),array( », »),$text);
}
/**
Handy shortcuts of polyglot_filter function for direct use in the templates
*/
function p__($text){
return polyglot_filter($text);
}
function p__e($text){
return polyglot_filter($text);
}
/**
Does the same as polyglot_filter but shows the message that informs visitor that selected language version is not available
*/
function polyglot_filter_with_message($text){
global $polyglot_settings;
$text = trim(polyglot_filter($text));
if($text == »){
$text = polyglot_filter($polyglot_settings[‘text_is_missing_message’]);
}
return $text;
}
/*function safe_link(){
global $post;
$permalink = get_settings(‘home’) . ‘/’ . get_settings(‘blogfilename’) . ‘?’;
if ($post->post_status == ‘static’)
$permalink .= ‘page_id’;
else
$permalink .= ‘p’;
$permalink .= ‘=’.$post->ID;
return $permalink;
}*/
/**
Prints out the list of other language versions contained in the current post.
*/
function polyglot_other_langs($none=’none’, $before=’<ul>‘, $after=’</ul>‘, $pre=’<li>(‘, $afters=’)</li>‘){
global $polyglot_settings, $post;
if(!$polyglot_settings[‘use_helpers_in_uri’]){
$uri_helper = »;
}
else {
$uri_helper = « {$polyglot_settings[‘uri_helpers’][‘lang_view’]}/ »;
}
$content = $post->post_content;//fred
$before = polyglot_filter($before);
$after = polyglot_filter($after);
$pre = polyglot_filter($pre);
$afters = polyglot_filter($afters);
$other_langs = polyglot_filter($none);
if (preg_match_all ( ‘/[|]]/’, $content , $match, PREG_PATTERN_ORDER)) {
$match = array_unique($match[1]);
$other_langs = $before;
foreach ($match as $lang){
if ($polyglot_settings[‘lang_pref’] != $lang) {
$foo = ($polyglot_settings[‘use_flags’] ) ? « <img /> » : get_trans($lang);
$other_langs .= « $pre<a>{$foo}</a>$afters »;
}
}
if($other_langs != $before)//to avoid empty <ul></ul>
$other_langs .= $after;
else
$other_langs = $none;
}
echo $other_langs;
}
/**
Prepares text for slug
*/
function polyglot_sanitize_title($text){
global $polyglot_settings;
$text = polyglot_filter($text, $polyglot_settings[‘default_lang’]);
return $text;
}
//————code from ‘translate categories’ plugin———–
function polyglot_translate_callback($matches){
return $matches[1].__($matches[2]).$matches[3];
}
/**
Not very nice way how to tranlate category name:(
It uses standard gettex function __ and works only when we have the category name in the .mo file!
*/
function polyglot_translate_the_category($text){
return preg_replace_callback(‘/(<a>]*>)(.*?)(</a>)/i’,’polyglot_translate_callback’,$text);
}
//—————————————————————————
function polyglot_get_users_pref_lang(){
GLOBAL $polyglot_settings;
$deflang = $polyglot_settings[‘default_lang’];
# An advanced PHP Language Detection Script
# by Fibergeek (fibergeek @ codegurus.be)
#
# This script is a modification to a script I found via google
#
# 2003-12-18 – Version 1 (I added…)
# – you can now also specify the country code in the $knowlangs array
# – extraction of the country code ($country)
# – I fully documented the code
#
# 2004-01-07 – Version 2 (I added…)
# – you can now make $knowlangs NULL (the script will set to array to all known languages (ISO-639))
#
# NOTE : for those using Brion’s script, I renamed $lastquality to $quality
#
# Found at URL : http://mail.wikipedia.org/pipermail/wikitech-l/2002-October/001068.html
# Assumed creator : Brion VIBBER (wikitech-l@wikipedia.org)
# HTTP reference : RFC 2616 – ftp://ftp.isi.edu/in-notes/rfc2616.txt
# ==================================================================================================
# TODO
# You need to add the 2 lines to your source code, and change the content of them of course ;-)
# ==================================================================================================
#$polyglot_settings[‘knownlangs’] = NULL; // default to all known languages (ISO-639)
#$deflang = NULL; // there is no default language
#
#$polyglot_settings[‘knownlangs’] = array(‘en-us’, ‘en-uk’, ‘en’, ‘nl’); // We know : English (US & UK) and Dutch
#$deflang = ‘en-uk’; // In case of an error, we default to English UK
# ==================================================================================================
# INFORMATION
# The following variables are returned by this program
# $lclist : the full list with the languages accepted by the client’s browser
# $lctag : the tag we are supporting (includes the country code if any)
# $quality : the quality
# $lang : the language code
# $country : the country code (if any)
#
# The following variables are used by this program (and may be overwritten if you use them also!)
# $langtag
# $qvalue
# $eachbit
# $tmppos
# $tmplclist
# $tmplctag
# $tmptagarray
# ==================================================================================================
# ==================================================================================================
# THE SCRIPT
# ==================================================================================================
# Check that $knowlangs is an array!
# NOTE : the list is taken from this URL : http://www.w3.org/WAI/ER/IG/ert/iso639.htm
if(!is_array($polyglot_settings[‘knownlangs’]))
{
if(is_string($polyglot_settings[‘knownlangs’]) || is_object($polyglot_settings[‘knownlangs’]) || $polyglot_settings[‘knownlangs’] != NULL)
die(« Fibergeek’s PHP Language Detection Script : You need define $polyglot_settings[‘knownlangs’] as an array or as NULL!<br>n »);
$polyglot_settings[‘knownlangs’] = array(‘aa’, ‘ab’, ‘af’, ‘am’, ‘ar’, ‘as’, ‘ay’, ‘az’, ‘ba’, ‘be’, ‘bg’, ‘bh’, ‘bi’, ‘bn’, ‘bo’, ‘br’, ‘ca’, ‘co’, ‘cs’, ‘cy’, ‘da’, ‘de’, ‘dz’, ‘el’, ‘en’, ‘eo’, ‘es’, ‘et’, ‘eu’, ‘fa’, ‘fi’, ‘fj’, ‘fo’, ‘fr’, ‘fy’, ‘ga’, ‘gd’, ‘gl’, ‘gn’, ‘gu’, ‘ha’, ‘he’, ‘hi’, ‘hr’, ‘hu’, ‘hy’, ‘ia’, ‘ie’, ‘ik’, ‘in’, ‘is’, ‘it’, ‘iw’, ‘ja’, ‘ji’, ‘jw’, ‘ka’, ‘kk’, ‘kl’, ‘km’, ‘kn’, ‘ko’, ‘ks’, ‘ku’, ‘ky’, ‘la’, ‘ln’, ‘lo’, ‘lt’, ‘lv’, ‘mg’, ‘mi’, ‘mk’, ‘ml’, ‘mn’, ‘mo’, ‘mr’, ‘ms’, ‘mt’, ‘my’, ‘na’, ‘ne’, ‘nl’, ‘no’, ‘oc’, ‘om’, ‘or’, ‘pa’, ‘pl’, ‘ps’, ‘pt’, ‘qu’, ‘rm’, ‘rn’, ‘ro’, ‘ru’, ‘rw’, ‘sa’, ‘sd’, ‘sg’, ‘sh’, ‘si’, ‘sk’, ‘sl’, ‘sm’, ‘sn’, ‘so’, ‘sq’, ‘sr’, ‘ss’, ‘st’, ‘su’, ‘sv’, ‘sw’, ‘ta’, ‘te’, ‘tg’, ‘th’, ‘ti’, ‘tk’, ‘tl’, ‘tn’, ‘to’, ‘tr’, ‘ts’, ‘tt’, ‘tw’, ‘uk’, ‘ur’, ‘uz’, ‘vi’, ‘vo’, ‘wo’, ‘xh’, ‘yo’, ‘zh’, ‘zu’);
}
# Initalisation of the default variables
if(isset($HTTP_SERVER_VARS))
$lclist = trim($HTTP_SERVER_VARS[‘HTTP_ACCEPT_LANGUAGE’]); # PHP running from a server
else
$lclist = trim($_SERVER[‘HTTP_ACCEPT_LANGUAGE’]); # PHP 5.0 when the old server variables disabled
$lctag = $deflang;
$tmppos = strpos($lctag, ‘-‘);
$quality = 0.0;
if($tmppos == FALSE or $tmppos == NULL)
{
$lang = $deflang;
if($deflang == NULL)
$country = NULL;
else
$country = »;
}
else
{
$lang = substr($lctag, 0, $tmppos);
$country = substr($lctag, $tmppos + 1);
echo « lang sub = $lang »;
}
#
$langtag = ‘((?:[a-zA-Z]{1,8})(?:-[a-zA-Z]{1,8})*)’;
$qvalue ='(0(?:.[0-9]{1,3})?|1(?:.0{1,3}))’;
$eachbit = ‘^’ . $langtag . ‘(?:;q=’ . $qvalue . ‘)?(?:,s*)?(.*)$’;
#
$tmplclist = $lclist;
# The loop
while(strlen($tmplclist))
{
if(preg_match(« /$eachbit/ », $tmplclist, $tmptagarray)) # requires 3.0.9
{
# Extract data from the tag list
$tmplctag = $tmptagarray[1];
$tmpquality = $tmptagarray[2];
if(strlen($tmpquality) == 0)
$tmpquality = 1;
$tmplclist = $tmptagarray[3];
# Find the tag in our $polyglot_settings[‘knownlangs’] array (this search includes the country code if set)
if(in_array($tmplctag, $polyglot_settings[‘knownlangs’]) and $tmpquality > $quality)
{
# Extract the language & quality
$lctag = $tmplctag;
$lang = $tmplctag;
$country = »;
$quality = $tmpquality;
}
else
{
# Not found, does the tag include a country code?
$tmppos = strpos($tmplctag, ‘-‘);
if($tmppos FALSE)
{
# OK, the tag includes a country code but it’s not in the $polyglot_settings[‘knownlangs’] array, let’s extract the language and look it up
if(in_array(substr($tmplctag, 0, $tmppos), $polyglot_settings[‘knownlangs’]) and $tmpquality > $quality)
{
# Extract the language, country & quality
$lctag = $tmplctag;
$lang = substr($tmplctag, 0, $tmppos);
$country = substr($tmplctag, $tmppos + 1);
$quality = $tmpquality;
}
}
}
}
else
{
# There was an error, abort the loop
break;
}
}
return $lang;
}//get_users_pref_lang()
//=========================== WIDGET CODE============================
function widget_polyglot_init() {
if ( !function_exists(‘register_sidebar_widget’) )
return;
function widget_polyglot($args) {
extract($args);
$options = get_option(‘widget_polyglot’);
$title = $options[‘title’];
$listtype = $options[‘listtype’] ? true : false ;
echo $before_widget . $before_title . polyglot_filter($title) . $after_title . ‘<br /><ul class="language_item">‘;
echo polyglot_list_langs($listtype) . ‘</ul>‘;
echo $after_widget;
}
function widget_polyglot_control() {
// Get our options and see if we’re handling a form submission.
$options = get_option(‘widget_polyglot’);
if ( !is_array($options) )
$options = array(‘title’=>__(‘Language’), ‘listtype’=> »);
if ( $_POST[‘polyglot-submit’] ) {
// Remember to sanitize and format user input appropriately.
$options[‘title’] = strip_tags(stripslashes($_POST[‘polyglot-title’]));
$options[‘listtype’] = $_POST[‘polyglot-listtype’];
update_option(‘widget_polyglot’, $options);
}
// Be sure you format your options to be valid HTML attributes.
$title = htmlspecialchars($options[‘title’], ENT_QUOTES);
$listtype = $options[‘listtype’];
echo ‘<p style="text-align:right"><label for="polyglot-title">Title: </label></p>‘;
echo ‘<p style="text-align:right">Display as: <label for="polyListtypeText">normal list</label>
<label for="polyListtypeFlags">flags list</label></p>‘;
echo »;
}
function widget_polyglot_style() {
?>
li#polyglot ul li:before, .language_item li{content: » »;list-style-type:none;display:inline !important;padding: 2px !important;margin: 0 !important;}
<?php
}
register_sidebar_widget('Polyglot', 'widget_polyglot');
register_widget_control('Polyglot', 'widget_polyglot_control', 300, 90);
if ( is_active_widget('widget_polyglot') )
add_action('wp_head', 'widget_polyglot_style');
}
// Run our code later in case this loads prior to any required plugins.
add_action('plugins_loaded', 'widget_polyglot_init');
//================================Backward Compatibility=============================
function lang_picker_respect_more($text){return polyglot_filter($text);}
function lang_picker($text) {return polyglot_filter($text);}
function lp_other_langs($none='none', $before='<ul>‘, $after=’</ul>‘, $pre=’<li>(‘, $afters=’)</li>‘){return polyglot_other_langs($none, $before, $after, $pre, $afters);}
?>Pour que les jours et les mois se traduisent, il faut aussi ajouter cette ligne en haut du fichier locale.php (dans wp-includes), comme ceci :
<?php
global $weekday, $weekday_initial, $weekday_abbrev, $month, $month_abbrev;
// Date and Time
// The Weekdays
$weekday[0] = __('Sunday');
$weekday[1] = __('Monday');
$weekday[2] = __('Tuesday');
$weekday[3] = __('Wednesday');
…1 juillet 2006 à 7 h 41 min #575801bien alor, j’ai mis exactement ton polyglot.php…et ca ne marche pas j’ai toujours le meme message
1 utilise tu le sidebars widgets comme plugin afin de placer ton polyglot ?
2 peut tu me donner l’emplacement ou tu met polyglot, moi je le met dans/www/wp-content/plugins/
et les fichier flag dans
/www/wp-content/plugins/polyglot_flag
pourrais tu faire un essais avec un autre theme
ou a tus mis la variante qui dis « http://www.crorb.org/wordpress/index.php/lang-pref/fr/
parce que j’ai l’impression que ca bloque sur lang-prf
ton wordpress est le 2.0.3 ?
merci de tout ton aide..
1 juillet 2006 à 9 h 12 min #575802Parfois le plus simple c’est de créer 3 blogs… différents… plus long à la mise en place… mais une fois que c’est fait…
sinon il existe :
http://www.stilglog.com/wordpress-plugins/basic-multilingual/http://www.scotthough.com/wordpress-translate/
http://ml_multilingual.code-in-design.de/
http://www.bueltge.de/wp-site-uebersetzen/48/
Si on peut avoir des retours ^^
1 juillet 2006 à 10 h 48 min #575803Il y a aussi yammyamm qui a l’air très abouti, mais j’ai eu des difficultés à le faire fonctionner. Je n’arrivais pas à avoir la fenêtre des catégories. Mais peut-être était-ce un problème de mon côté. C’est très possible.
Pour celui chez qui il fonctionne, c’est celui qui a l’air le plus simple du côté admin, et du côté utilisateur, c’est parfaitement transparent.Pour les adresses que tu as données, les deux adresses terminant par multilingual amènent à des plugins ressemblant comme des jumeaux à polyglot (en tout cas au niveau des explications de fonctionnement, des variables et de la manière de la définir).
Pour les deux dernières adresses, je n’utiliserais, personnellement, pas ce genre de choses sur un site qui se veut un peu correct. Ces plugins renvoient aux traductions google. Bien sur, lorsqu’on ne parle aucunement la langue de destination, ça peut servir, mais les traductions faites par des machines ne valent pas encore grand chose, selon moi. Mais ici encore, ce n’est que mon avis.
Jean-Marc
-
AuteurMessages
- Vous devez être connecté pour répondre à ce sujet.