par
linker65 » 08 juil. 2011, 05:52
Bonjour,
je suis entrain de faire un multilangues pour mon site mais je rencontre quelques soucis au niveau de mon charset (? a la place é)
Je vous mets le contenu de mes pages afin de voir si quelqu'un peut m'aider.
index.php
<?php
require("include/decide-lang.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo TXT_ACCUEIL_LANG; ?>" lang="<?php echo TXT_ACCUEIL_LANG; ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
<title><?php echo TXT_ACCUEIL_TITLE; ?></title>
<meta name="description" content="<?php echo TXT_ACCUEIL_DESCRIPTION; ?>" lang="<?php echo TXT_ACCUEIL_LANG; ?>" />
<link rel="stylesheet" href="<?php echo TXT_ACCUEIL_CSS; ?>" type="text/css" media="screen" />
</head>
On peut remarquer que je mets : <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
Voici l'include appelle : "decide-lang.php"
<?php
if ($_GET['lang']=='fr') { // si la langue est 'fr' (français) on inclut le fichier fr-lang.php
include('lang/fr-lang.php');
}
else if ($_GET['lang']=='en') { // si la langue est 'en' (anglais) on inclut le fichier en-lang.php
include('lang/en-lang.php');
}
else { // si aucune langue n'est déclarée on inclut le fichier fr-lang.php par défaut
include('lang/fr-lang.php');
}
?>
Puis voici un petit bout de mes traductions : par exemple fr-lang.php
<?php
// MENU
define('TXT_ACCUEIL_MONCOMPTEMENU', 'Mon Compte');
define('TXT_ACCUEIL_NEWSMENU', 'Nouvautés');
define('TXT_ACCUEIL_EVENEMENTSMENU', 'Événements');
define('TXT_ACCUEIL_FAQMENU', 'Questions/Réponses');
define('TXT_ACCUEIL_SUPPORTMENU', 'Support');
define('TXT_ACCUEIL_FORUMMENU', 'Forum');
// CONTENU PAGE Index.php
//---------------------------------------------------------
// Fin
//---------------------------------------------------------
?>
Par exemple : lors de la mise en ligne : "événements" donnera : "Ãvénements"
Merci par avance.