Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Bonjour ,
J'ai un gros problème dans zend translate .En fait j'ai créé une fonction dans mon bootstrap : initranslate qui contient les lignes suivantes : protected function _initTranslate()
{
$translate = new Zend_Translate('gettext',APPLICATION_PATH . "/language/fr_FR/LC_MESSAGES/fr.mo","fr");
$registry = Zend_Registry::getInstance();
$registry->set('Zend_Translate', $translate);
$translate->setLocale('fr');
}
mais le probleme c'est que cette methode ne me traduit pas mon layout y compris les menus .Est ce que vous pourriez m'aider s'il vous plait
Hors ligne
Bonjour,
Pourrait-on voir le fichier de layout aussi ?
Hors ligne
oui bien sur voici la partie du code de mon layout qui s'appelle front.phtml et qui se trouve dans application_path/layout/front.phtml:
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php echo $this->headTitle() ?>
<base href="http://<?= $_SERVER['HTTP_HOST']; ?>/" />
<meta name="robots" content="index, follow">
<meta name="keywords" content="">
<meta name="title" content="BTP">
<meta name="author" content="FadelChafai@gmail.com">
<meta name="description" content="">
<meta name="generator" content="">
<link href="./images/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="./css/template.css" type="text/css">
<link rel="stylesheet" href="./css/nivo-slider.css" type="text/css" media="screen">
<link rel="stylesheet" href="./css/messi.min.css" type="text/css" media="screen">
<script type="text/javascript" src="./js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="./js/messi.min.js"></script>
</head>
<body>
<div id="header">
<div id="header_content">
<div id="header_content_left">
<div id="logo"><a href="/">Logo</a></div>
</div><!--header_content_left-->
<div id="header_content_right">
<div id="pub"><a href="/"></a></div>
<div id="menu_top">
<ul id="nav_top">
<li id="nav_top01"><a href="/"><?php echo $this->translate('accueil')?></a></li>
<li id="nav_top02"><a href="/maroc">maroc</a></li>
<li id="nav_top03"><a href="/international">international</a></li>
<li id="nav_top04"><a href="/services-a-import">services à l'import</a></li>
<li id="nav_top05"><a href="/qui-sommes-nous">qui sommes-nous</a></li>
<li id="nav_top06"><a href="/contact">contact</a></li>
</ul><!--nav_top-->
</div><!--menu_top-->
Hors ligne
Bon bah au moins c'est assez simple : tu n'as pas mis les $this->translate('') sur les listes du menu...
Hors ligne
ce n'est pas ça le probleme parceque dans ma version sur localhost que j'ai sur mon poste de dev j'ai deja mis $this->translate('') sur toute la liste et ça marche pas et si tu regarde bien dans la liste j'ai mis un exemple dans la liste : <li id="nav_top01"><a href="/"><?php echo $this->translate('accueil')?></a></li> .
Hors ligne
Dans ce cas, peut-on voir le fichier PO associé pour qu'on ait une idée du contenu de tes traductions ?
Utilises-tu POEdit ?
Hors ligne
oui j'utilise poedit et voici le code de mon fichier en.po :
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-30 16:05-0000\n"
"PO-Revision-Date: 2011-12-30 16:08-0000\n"
"Last-Translator: Fadel <fadelmohamed@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop;translate\n"
"X-Poedit-Basepath: E:\\wamp\\www\\in-morocco\\min\\application\n"
"X-Poedit-Language: English\n"
"X-Poedit-Country: UNITED STATES\n"
"X-Poedit-SearchPath-0: .\n"
#: controllers/ContactController.php:15
msgid "Contact | In Morocco : Land of luxury and travel"
msgstr ""
#: controllers/ContactController.php:23
#: controllers/ResaController.php:43
msgid "<strong>Vous avez une erreur!</strong><br /><br />Merci de remplir les champs obligatoires."
msgstr ""
#: controllers/ContactController.php:35
#: controllers/ResaController.php:55
msgid "<strong>Nous vous remercions d'avoir contacté In Morocco!</strong><br /><br />Nous allons traiter votre demande dans les plus brefs délais.."
msgstr ""
#: controllers/HotelsController.php:21
msgid "Hotels : Land of luxury and travel"
msgstr ""
#: controllers/HotelsController.php:35
msgid " - In Morocco : Land of luxury and travel"
msgstr ""
#: controllers/IndexController.php:25
msgid "In Morocco : Land of luxury and travel"
msgstr ""
#: controllers/ResaController.php:14
msgid "Reservation : Land of luxury and travel"
msgstr ""
#: controllers/ToursController.php:33
msgid "Tours : Land of luxury and travel"
msgstr ""
#: layouts/front/ville.phtml:52
#, fuzzy
msgid "Hotel"
msgstr "Hotels"
#: layouts/front/ville.phtml:58
msgid "Galerie photos"
msgstr "PHOTO GALLERY"
#: layouts/front/ville.phtml:90
msgid "Videos"
msgstr "Videos"
#: layouts/partials/header.phtml:20
#: layouts/partials/header.phtml:68
msgid "Accueil"
msgstr "Home"
#: layouts/partials/header.phtml:24
#: layouts/partials/header.phtml:72
msgid "Maroc"
msgstr "Morocco"
#: layouts/partials/header.phtml:28
#: layouts/partials/header.phtml:76
msgid "Destinations"
msgstr "Destinations"
#: layouts/partials/header.phtml:32
#: layouts/partials/header.phtml:80
msgid "Tours"
msgstr "Tours"
#: layouts/partials/header.phtml:36
#: layouts/partials/header.phtml:84
msgid "Hotels"
msgstr "Hotels"
#: layouts/partials/header.phtml:40
#: layouts/partials/header.phtml:88
#: views/scripts/contact/index.phtml:3
msgid "Contact"
msgstr "Contact"
#: layouts/partials/slide.phtml:2
#: layouts/partials/slide.phtml:4
#: layouts/partials/slide.phtml:5
msgid "Marrakech"
msgstr "Marrakech"
#: layouts/partials/slide.phtml:15
msgid "Ouarzazat"
msgstr "Ouarzazate"
#: layouts/partials/slide.phtml:26
msgid "Essaouira"
msgstr "Essaouira"
#: layouts/partials/slide.phtml:37
msgid "Casablanca"
msgstr "Casablanca"
#: layouts/partials/slide.phtml:48
msgid "Fès"
msgstr "Fez"
#: views/scripts/contact/index.phtml:23
msgid "Civilité"
msgstr "Title"
#: views/scripts/contact/index.phtml:26
msgid "M."
msgstr "M."
#: views/scripts/contact/index.phtml:27
msgid "Mme"
msgstr "Mme"
#: views/scripts/contact/index.phtml:28
msgid "Mlle"
msgstr "Mlle"
#: views/scripts/contact/index.phtml:33
msgid "Nom"
msgstr "Last name"
#: views/scripts/contact/index.phtml:39
msgid "Prenom"
msgstr "First name"
#: views/scripts/contact/index.phtml:45
msgid "Email"
msgstr "Email"
#: views/scripts/contact/index.phtml:51
msgid "Tel"
msgstr "Tel"
#: views/scripts/contact/index.phtml:57
msgid "Votre pays"
msgstr "Country"
#: views/scripts/contact/index.phtml:65
msgid "Message"
msgstr "Comment"
#: views/scripts/contact/index.phtml:72
msgid "Envoyer"
msgstr "Submit"
#: views/scripts/contact/index.phtml:73
msgid "Annuler"
msgstr "Cancel"
#: views/scripts/hotels/index.phtml:2
msgid "Notre sélection"
msgstr ""
#: views/scripts/hotels/index.phtml:14
msgid "Chambres"
msgstr ""
#: views/scripts/hotels/show.phtml:44
msgid "A partir de"
msgstr ""
#: views/scripts/hotels/show.phtml:46
msgid "par chambre/nuit"
msgstr ""
#: views/scripts/hotels/show.phtml:50
msgid "DESCRIPTION"
msgstr ""
#: views/scripts/resa/tours.phtml:3
msgid "Reservation"
msgstr ""
#: views/scripts/resa/tours.phtml:19
#: views/scripts/tours/show.phtml:8
msgid "Code"
msgstr ""
#: views/scripts/resa/tours.phtml:20
#: views/scripts/tours/show.phtml:9
msgid "Nombre de Jours"
msgstr ""
#: views/scripts/resa/tours.phtml:21
#: views/scripts/tours/show.phtml:10
msgid "Prix á partir de"
msgstr ""
#: views/scripts/resa/tours.phtml:70
msgid "Date du tour"
msgstr ""
#: views/scripts/resa/tours.phtml:79
msgid "Adultes"
msgstr ""
#: views/scripts/resa/tours.phtml:81
msgid "Enfants (-12 ans)"
msgstr ""
#: views/scripts/resa/tours.phtml:83
msgid "Bébé(s)"
msgstr ""
#: views/scripts/tours/show.phtml:13
msgid "Réserver"
msgstr ""
#~ msgid "Nos offres"
#~ msgstr "Our offers"
#~ msgid "Bonjour Tout Le Monde!"
#~ msgstr "Bonjour Tout Le Monde!"
Hors ligne
pas de reponse ?
Hors ligne
Dans cette communauté nous sommes tous bénévoles donc on réponds quand on peut... Sinon comme tu peux le voir dans ma signature je peux aussi te proposer des prestations
Je ne vois aucune occurrence de ton fichier /layouts/front.phtml dans ton fichier po... Le problème peut venir de là.
Essaye de revoir les params de poedit
- les .phtml semblent être pris en compte
- le dossier layouts semble être pris en compte
- les this->translate sont-ils pris en compte ?
Hors ligne
Je comprends et j'estime bien ce que vous faites dans cette communauté .par contre j'ai bien modifié mon fichier po et j'ai mis que quelques chaines traduites pour tester mais le problème c'est que cela me traduit seulement mon index.phtml et toujours le layout ne se traduit pas et voici le code de mon fichier.po:
msgid ""
msgstr ""
"Project-Id-Version: Zfbook V1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-09-14 16:43+0100\n"
"PO-Revision-Date: 2008-09-14 16:43+0100\n"
"Last-Translator: Guillaume Ponçon <guillaume.poncon@openstates.com>\n"
"Language-Team: Guillaume & Julien <contact@zf.fr>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Language: English\n"
"X-Poedit-Country: UNITED KINGDOM\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-Basepath: c:/wamp/www/V.0.0/application\n"
"X-Poedit-SearchPath-0: c:/wamp/www/V.0.0/application\n"
"X-Poedit-SearchPath-1: c:/wamp/www/V.0.0/application\n"
"X-Poedit-SearchPath-2: c:/wamp/www/V.0.0/application\n"
#: c:/wamp/www/V.0.0/applicatio/layouts/front.phtml:29
msgid "logo"
msgstr "logo"
#: c:/wamp/www/V.0.0/applicatio/layouts/front.phtml:41
msgid "acceuil"
msgstr "home"
#: c:/wamp/www/V.0.0/applicatio/layouts/front.phtml:45
msgid "maroc"
msgstr "morocco"
#: C:\wamp\www\V.0.0\application/layouts/front.phtml:49
msgid "international"
msgstr "international"
#: C:\wamp\www\V.0.0\application/layouts/front.phtml:53
msgid "services à l\"import"
msgstr "import services"
#: C:\wamp\www\V.0.0\application/layouts/front.phtml:57
msgid "qui sommes-nous"
msgstr "about us"
#: C:\wamp\www\V.0.0\application/layouts/front.phtml:61
msgid "contact"
msgstr "contact"
#: C:\wamp\www\V.0.0\application/views/scripts/index/index.phtml:10
msgid "VENDEUR"
msgstr "SELLER"
#: C:\wamp\www\V.0.0\application/views/scripts/index/index.phtml:12
msgid ""
"PUBLIER VOS PRODUITS OU SERVICES PUBLIER VOS PROMOTIONS ET LOTS CONSULTER "
"LES DEMANDES D\\\"ACHATS"
msgstr ""
"PUBLISH YOUR PRODUCTS OR SERVICES PUBLISH YOUR PROMOTIONS AND LOTS SEE "
"APPLICATIONS PURCHASE"
#: C:\wamp\www\V.0.0\application/views/scripts/index/index.phtml:19
msgid "Acheteur"
msgstr "BUYER"
#: C:\wamp\www\V.0.0\application/views/scripts/index/index.phtml:21
msgid "CONSULTER DES PRODUITS OU SERVICES CONSULTER DES PROMOTIONS ET LOTS"
msgstr "VIEW PRODUCTS OR SERVICES CONSULT PROMOTIONS AND PRIZES"
#~ msgid "accueil"
#~ msgstr "home"
Hors ligne
Merci bcp de vos aides je pense que j'ai trouvé d'ou vient le probleme c'etait a cause d'un menu sous form d'image aui a ete fait par le designer du site .
Amicalement
Hors ligne