.po file for default cakephp libs translations

本小妞迷上赌 提交于 2019-12-12 18:26:21

问题


How to add the translations for cakephp libs files to by default.po file
for example
- months name
- day's name
- timeAgoInWords

i try to add strings to default.po manually
but everytime i update it from default.pot (using poedit)
the strings are gone.

please help me to solve it
it will fine to find solution by using separate .po file


回答1:


i solve it
- create /app/views/dummy.ctp
- duplicate by coping the translation from cake\libs\view\helpers\time.ctp to dummy.ctp
- and cake i18n will add translations to default.pot




回答2:


You can see the relevant strings for timeAgoInWords at the end of TimeHelper::timeAgoInWords. They're just normal translation strings along the lines of 'year', 'years', 'month', 'months' etc, just put these translations into the general domain .po file.

There's one special case where a full date string may be printed like 'on 18/2/09'. The "on" can be localized by localizing the string 'on %s', but the date format needs to be passed to the timeAgoInWords function:

$this->Time->timeAgoInWords($time, array('format' => __('Y-m-d', true)));

The month names follow the same schema, just add translations for 'January', 'February', etc in your general domain translation file. Not quite sure where Cake outputs the day that would need to be translated though. Please elaborate.



来源:https://stackoverflow.com/questions/4465486/po-file-for-default-cakephp-libs-translations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!