Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Translation cakephp not working

I'm trying to implement a translation in Cakephp but isn't working and don't show me any erros.

I have this HTML in a element

<a href="/sites/pages/servicos" target="_blank">
    <span class="title">Serviços</span>
    <div class="description"><?php __('o que fazemos') ?></div>
</a>

In App Controller inside beforeFilter():

Configure::write('Config.language', 'eng');

In my folder locale/eng/LC_MESSAGES/default.po I have this:

msgid "o que fazemos"
msgstr "What we do"

But isn't working... Thanks

like image 760
Igor Martins Avatar asked Apr 29 '15 14:04

Igor Martins


2 Answers

I think you're just forgot "echo"

<?php echo __('o que fazemos'); ?>
like image 138
Mato Avatar answered Dec 02 '22 19:12

Mato


Have you correctly generated the i18n files with the ./cake i18n command?

Use PoEdit to edit your translate files, instead of doing it by hand if you've done so.

http://poedit.net/

like image 38
JazzCat Avatar answered Dec 02 '22 18:12

JazzCat