Bonjour,
Voila je rencontre un petit problème avec POedit v2.0.5
Je pars de ZERO c-a-d que je n'ai pas de fichiers POT, je ne cherche pas à modifier un thème wordpress mais bien à créer une traduction pour mon sité codé à la main. Le problème c'est que la version de POedit a bien changé depuis le tuto de grafikart.
Voici mon code PHP, que j'ai plus ou moins récupéré d'un cours que mon ancien prof de dev m'a filé.
<?php
if( !defined( 'CHARSET' ) ) define( 'CHARSET', 'UTF-8' ); // Defines the character encoding
if( !defined( 'ISO_LANGUAGE_CODE' ) ) define( 'ISO_LANGUAGE_CODE', 'fr' ); // Defines the abbreviation for language
if( !defined( 'ISO_COUNTRY_CODE' ) ) define( 'ISO_COUNTRY_CODE', 'FR' ); // Defines the abbreviation for language
if( !defined( 'LOCALE_STRING') ) define( 'LOCALE_STRING', ISO_LANGUAGE_CODE . '-' . ISO_COUNTRY_CODE );
date_default_timezone_set( 'Europe/Paris' ); // Sets the default timezone used by all date/time functions in a script // timezone_identifiers_list() // if( strcmp( date_default_timezone_get(), ini_get( 'date.timezone' ) ) )
mb_internal_encoding( CHARSET ); // Sets/Gets internal character encoding
putenv( 'LC_ALL=' . ISO_LANGUAGE_CODE . '-' . ISO_COUNTRY_CODE ); // Sets the value of an environment variable
setlocale( LC_ALL, LOCALE_STRING ); // Sets locale information for date and time formatting with strftime()
bindtextdomain( 'invia', 'lang' ); // Specifies location of translation tables
textdomain( 'invia' ); // Chooses domain
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0" />
<title>POEDIT</title>
<link rel="stylesheet" type="text/css" href="../../_assets/css/style.css">
</head>
<body>
<h1>POEDIT</h1>
<!--
<p><em></em></p>
<hr />
<h2></h2>
<h3></h3>
<p><em></em></p>
<pre><code class="php"></code></pre>
-->
<?php
$prenom = 'Damien';
echo gettext( 'Hello world !' );
echo '<br>';
printf( _( 'My name is %s !!!' ), $prenom );
echo '<br>';
printf( ngettext( '<p>I have <strong>%d</strong> article</p>', '<p>I have <strong>%d</strong> articles</p>', 3 ), 3 );
?>
</body>
</html>
Le problème c'est qu'à ce stade, je n'ai rien dans le dossier en_US, et surtout que ma page PHP n'est pas du tout traduire malgré le fait que je lui passe les variables fr_FR et que le fichier po existe bien dans le dossier FR.
Voilà je bloque ici et je comprends pas pourquoi.
Merci pour votre aide.