Is there a way to translate the result of the method diffForHumans() to another language on CakePHP 4.3? I’ve been searching and found this:
So this is what I’ve done
- bin/cake i18n extract --extract-core yes
- Modified cake.pot and moved it into resources/locale/es/cake.po
- bin/cake schema_cache clear
- i18n::setLocale(‘es_AR’);
- echo $record-timestamp->diffForHumans();
- Also created a new instance of RelativeTimeFormatter and used diffForHumans
Now, some translations are working as expected, like:
#: ./vendor/cakephp/cakephp/src/Validation/Validator.php:2559
#: ./vendor/cakephp/cakephp/src/View/Form/ArrayContext.php:249
msgid “This field cannot be left empty”
msgstr “Debe completar este campo”
But everything about RelativeTimeFormatter is not:
#: ./vendor/cakephp/cakephp/src/I18n/RelativeTimeFormatter.php:78
#: ./vendor/cakephp/cakephp/src/I18n/RelativeTimeFormatter.php:150
msgid “{0} second”
msgid_plural “{0} seconds”
msgstr[0] “{0} segundo”
msgstr[1] “{0} segundos”
Am I missing something? thanks in advance!