Bonjour et bienvenue;
Le
[MOD] Multi-Language support for any text fonctionne sur 4images 1.7.4, mais il est vrai que la mise en oeuvre est fastidieuse (autant que mon post, comme vous n'allez pas tarder à le constater).
Il s'agit en effet de fournir au script une fonction multilangage, qui concerne le nom des images, vignettes et catégories, ainsi que leur description, sans oublier le clickstream, les menus déroulants, les tags "alt" des images et vignettes, le titre du site, autant dans la partie visible que dans la partie administration.
J'ai fait un test que j'ai mis en ligne
ici, chez mon fournisseur d'accès, Free. Le fait que safe mode soit activé ne semble pas affecter le MOD.
Je ne me suis pas occupé de la section "commentaires" ni des "mots-clés", seulement des interfaces site et adminsitration.
Sur une installation toute fraîche de 4images 1.7.4, j'ai appliqué ces deux MODS:
Pour le deuxième MOD, ma langue par défaut étant le français, j'ai remplacé dans le code fourni par V@no pour le fichier
includes/page_header.php:
(preg_match("/english/i",$folder)
par
(preg_match("/french/i",$folder)
Voici la liste des fichiers
PHP qui ont dû être modifiés:
- categories.php
- details.php
- member.php
- top.php
- includes/functions.php
- includes/page_header.php
- admin/categories.php
- admin/checkimages.php
- admin/home.php
- admin/images.php
- admin/index.php
- admin/thumbnailer.php
- admin/validateimges.php
Il se peut que je sois passé à côté de quelque chose, mais cela a l'air de vouloir marcher. Voici ci-après les modifications à apporter au code:
Trouver ( pour moi à la ligne 77):
"cat_description" => format_text($cat_cache[$cat_id]['cat_description'], 1, 0, 1),
et remplacer par:
"cat_description" => multilang(format_text($cat_cache[$cat_id]['cat_description'], 1, 0, 1)),
Trouver ( pour moi à la ligne 65):
$image_name = format_text($image_row['image_name'], 2);
et remplacer par:
$image_name = multilang(format_text($image_row['image_name'], 2));
puis ( ligne 179 ):
$next_image_name = format_text($next_prev_cache[$next_image_id]['image_name'], 2);
à remplacer par:
$next_image_name = multilang(format_text($next_prev_cache[$next_image_id]['image_name'], 2));
puis encore ( ligne 202 ):
$prev_image_name = format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
à remplacer par:
$prev_image_name = multilang(format_text($next_prev_cache[$prev_image_id]['image_name'], 2));
et enfin ( ligne 529 ):
$clickstream .= $image_name."</span>";
doit être remplacé par:
$clickstream .= multilang($image_name)."</span>";
Trouver ( pour moi à la ligne 309 ):
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".format_text($image_row['image_name'], 2)."</a>".$config['category_separator'];
et remplacer par:
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".multilang(format_text($image_row['image_name'], 2))."</a>".$config['category_separator'];
puis ( ligne 314 ):
"image_name" => format_text($image_row['image_name'], 2),
à remplacer par:
"image_name" => multilang(format_text($image_row['image_name'], 2)),
puis ( ligne 338 ):
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".format_text($image_row['image_name'], 2)."</a>".$config['category_separator'];
à remplacer par:
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".multilang(format_text($image_row['image_name'], 2))."</a>".$config['category_separator'];
puis ( ligne 427 ):
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".format_text($image_row['image_name'], 2)."</a>".$config['category_separator'];
à remplacer par:
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".multilang(format_text($image_row['image_name'], 2))."</a>".$config['category_separator'];
puis ( ligne 668 ):
$msg .= $lang['image_add_success'].": <b>".format_text(stripslashes($image_name))."</b> (".$new_name.")";
à remplacer par:
$msg .= $lang['image_add_success'].": <b>".multilang(format_text(stripslashes($image_name)))."</b> (".$new_name.")";
puis ( ligne 681 ):
"image_name" => format_text(stripslashes($image_name)),
à remplacer par:
"image_name" => multilang(format_text(stripslashes($image_name))),
puis ( ligne 722 ):
"cat_name" => ($cat_id != 0) ? format_text($cat_cache[$cat_id]['cat_name'], 2) : get_category_dropdown($cat_id),
à remplacer par:
"cat_name" => ($cat_id != 0) ? multilang(format_text($cat_cache[$cat_id]['cat_name'], 2)) : get_category_dropdown($cat_id),
puis ( ligne 725 ):
"image_name" => format_text(stripslashes($image_name), 2),
à remplacer par:
"image_name" => multilang(format_text(stripslashes($image_name), 2)),
puis enfin ( ligne 726 ):
"image_description" => format_text(stripslashes($image_description), 2),
à remplacer par:
"image_description" => multilang(format_text(stripslashes($image_description), 2)),
Trouver ( pour moi à la ligne 77 ):
$register_array['image_rating_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
et remplacer par:
$register_array['image_rating_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 78 ):
$register_array['image_rating_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_rating_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 86 ):
$register_array['image_rating_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
à remplacer par:
$register_array['image_rating_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".multilang(format_text($top_list[$i]['cat_name']))."</a>";
puis ( ligne 116, c'est long, pas vrai? ):
$register_array['image_votes_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_votes_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 117 ):
$register_array['image_votes_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_votes_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 125 ):
$register_array['image_votes_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
à remplacer par:
$register_array['image_votes_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".multilang(format_text($top_list[$i]['cat_name']))."</a>";
puis ( ligne 155 ):
$register_array['image_hits_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_hits_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 156 ):
$register_array['image_hits_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_hits_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 164 ):
$register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
à remplacer par:
$register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".multilang(format_text($top_list[$i]['cat_name']))."</a>";
puis ( ligne 194 ):
$register_array['image_downloads_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_downloads_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis ( ligne 195 ):
$register_array['image_downloads_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
à remplacer par:
$register_array['image_downloads_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".multilang(format_text($top_list[$i]['image_name']))."</a>" : multilang(format_text($top_list[$i]['image_name']));
puis enfin ( ligne 203 ):
$register_array['image_downloads_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
à remplacer par:
$register_array['image_downloads_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".multilang(format_text($top_list[$i]['cat_name']))."</a>";
Bon, je vais boire un bon café et je reviens pour la suite.