Fragment of code not working as expected:
El viernes, 27 de noviembre de 2015, 13:38:48 (UTC), José Lorenzo escribió:
-- Cake\I18n\I18n::translator('default', 'es_ES', function () {
$package = new Aura\Intl\Package(
'default', // The formatting strategy (ICU)
'default' // The fallback domain
);
$package->setMessages([
'Llegada' => 'foo',
]);
return $package;
});
// Output is es_ES
echo Cake\I18n\I18n::defaultLocale();
// Output is "Llegada" not "foo"
echo __('Llegada');
El viernes, 27 de noviembre de 2015, 13:38:48 (UTC), José Lorenzo escribió:
Did you read this part?http://book.cakephp.org/3.0/en/core-libraries/ internationalization-and- localization.html#creating- your-own-translators
On Tuesday, November 24, 2015 at 3:00:30 PM UTC+1, Aday Talavera wrote:My current and default app locale is "es_ES".
I generated my default.pot using I18n shell and my en_US translations in default.po and default.mo inside en_US folder.
es_ES doesn't have .po and .mo files at all, because the "native language" of the app strings is es_ES.
How can I override a translation in es_ES using I18n translators?
For example, a message like:
__('Hola')
I want to define a custom "array" translator so I can change this string into another:
$translator = ['Hola' => 'Adios'];
__('Adios')
Tried to follow the examples in the book without success.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment