I just installed qTranslate to have multilingual entries. It’s a really good internationalization plugin, I’ve used it on other WordPress installations before with great results.
After installing it with WordPress 3.0.1 though, the date format for posts wasn’t being parsed, showing instead the raw format:
Posted on %e de %B de %Y by johnny
I found a solution for this on the qTranslate forums:
- Edit qtranslate_utils.php, line 143 from this:
$date_parameters[] = '#%#'; $strftime_parameters[] = '%%';
to this:
$date_parameters[] = '#%#'; $strftime_parameters[] = '%';
It seems the extra percentage sign makes it so the percentage sign in the format gets interpreted as literal percentage signs and therefore they don’t get parsed by strftime().
The formatting in Spanish and Catalan isn’t completely fixed though, spurious “02UTC” strings are being added after each date component.
Resources
- Forum post regarding incorrect date format with qTranslate containing solution.
jotter more like.. blog?
it’s a blog is what i’m saying
you have a blog.
is this it
is this jotter…my blog?
it’s your blog. you have one.
Thanks, That helped!
Comenté las líneas144 a 146 y funciona bien para español. espero que sirva .Gracias
De nuevo, tuve que corregir algunas líneas pero creo que de esta manera funciona bien, por cierto es un bug del qtranslate ya que reemplaza los strings donde encuentra los caracteres %d o “d” simplemente , asi que limite esos caracteres para que se pueda tomar los caracteres que se forman de esta forma “%d”, ” d “,”d “,” d”
Estas son las líneas a cambiar en el archivo qtranslate_utils.php
línea 143
[code]
$date_parameters[] = '#%#'; $strftime_parameters[] = '%';
foreach($mappings as $df => $sf) {
//$a = '#(([^%\\\\])'.$df.'|^'.$df.')#';
$a = "#([^%a-z ]".$df."| ".$df." |^".$df. "| ".$df."$)#";
$b = ' ${2}'.$sf;
$date_parameters[] = $a; $strftime_parameters[] = $b;
}
[/code]
Dude! Thanks so much for taking the trouble to document this: your proposed solution worked like a charm. My warm best wishes to you.
Pingback: How to avoid dates look like ‘%A %B %e%q, %Y’ in Wordpress blogs? | Calmarius' website
Merciiiiii he estado buscando esta solución mucho rato!!! Genial
Hola etags, por favor, necesito tu ayuda urgente. He hecho los cambios del codigo como has explicado y se me ha arruinado el archivo “qtranslate_utils.php”. Me sale un aviso que dice: “Parse error: syntax error, unexpected ‘>’ in C:\Inetpub\vhosts\grisconcepte.com\httpdocs\web\wp-content\plugins\qtranslate\qtranslate_utils.php on line 130″ y no me deja hacer nada mas. Tuve la precausion de guardar en txt el codigo original; lo restauré pero sigue sin funcionar. Por favor dime que puedo hacer.
Lo he solucionado. No podia restaurarlo, supondo que porque al pegar el codigo en el Bloc de notas me habia desaparecido el formato y cambiaba el número de cada línea. Abrí el archivo con WordPad y copié desde ahí el codigo para despues pegarlo en el archivo del qTranslater.
Igual te agradeceria si pudieras decirme en que he fallado para que no me funcione el cambio que tu propones.
Gracias
Pingback: wordpress plugin | Pearltrees