Issue
It's not the first time I set up POEdit to work with CakePHP, but it's the first time I need to translate core strings on a site. Specifically, I need to translate the strings on TimeHelper
's timeAgoInWords()
function. The problem is that all strings in there are encapsulated in __d()
and __dn()
functions (instead of regular __()
, __n()
, etc), which use the translation domain name as the first parameter, instead of the translatable string. So if I tell POEdit to include __d
and __dn
as keywords in the catalog, it thinks "cake" and "cake_dev" are translatable strings.
What's the best way to translate CakePHP's core strings that on the "cake" domain?
You can see the code of timeAgoInWords
here.
Thanks.
Solution
OK, I found the answer hidden here on SO. A combination of this and this other question:
- First, I added the
__d
keyword in the form of__d:2
so it took the second parameter instead of the first. - I also added a
__dn:2,3
keyword. - Then I configured the plural forms (
nplurals=2; plural=n != 1;
) on POEdit in order to make the previous keyword work.
All worked like a charm.
I hope this helps somebody else.
Answered By - luchomolina Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.