如何翻译 $this->Time->timeAgoInWords 中的单词?

How to translate words from $this->Time->timeAgoInWords?

这里是 default.po

的一些翻译
/src/Locale/pt_BR/default.po

msgid "{0} minute"
msgid_plural "{0} minutes"
msgstr[0] "minuto"
msgstr[1] "{0} minutos"

msgid "January"
msgstr "Janeiro"
...

正在 input type date 翻译月份,但 $this->Time->timeAgoInWords 未翻译 minute。他们来自不同的域?

是的,它们在不同的域中,cake 域中,月份也在该域中。查看源代码,所有可翻译的核心消息都在该域中。

我建议您使用 I18N shell 提取它们(先备份您现有的翻译 以防您不小心覆盖它们),再简单不过了。

Cookbook Console & Shells > I18N Shell > Generating POT Files