.po Datei für Standard CakePHP libs Übersetzungen
-
11-10-2019 - |
Frage
Wie die Übersetzungen für CakePHP libs Dateien von default.po Datei
hinzufügen
zum Beispiel
- Monate Name
- Tag Name
- timeAgoInWords
ich versuche, Strings in den default.po manuell
aber jedes Mal wenn ich es von default.pot aktualisieren (mit poedit)
die Saiten sind weg.
Bitte helfen Sie mir, es zu lösen
es wird eine Fein Lösung zu finden, durch separate .po-Datei mit
Lösung
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
Andere Tipps
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.