App-I18N
view release on metacpan or search on metacpan
lib/App/I18N.pm view on Meta::CPAN
### Generate locale and mo file for php-gettext or anyother gettext i18n app:
parse strings from `.` path and use --locale (locale directory structure):
$ cd app
$ po parse --locale .
this will generate:
po/app.pot
please modify the CHARSET in po/app.pot.
... modify CHARSET ...
create new language file (po file and mo file) in locale directory structure:
$ po lang --locale en
$ po lang --locale zh_TW
this will generate:
po/en/LC_MESSAGES/app.po
po/en/LC_MESSAGES/app.mo
po/zh_TW/LC_MESSAGES/app.po
po/zh_TW/LC_MESSAGES/app.mo
(you can use --podir option to generate those stuff to other directory)
... do translation here ...
if you use mo file , you might need to update mo file.
$ po update --locale
eg:
-project (master) % po update --mo --podir locale
Updating locale/zh_TW/LC_MESSAGES/project.po
Updating locale/zh_TW/LC_MESSAGES/project.mo
9 translated messages, 53 untranslated messages.
Note that if you have `po` or `locale` directory exists, then it will be the default po directory.
And `locale` directory will enable `--locale` option.
## Show Translation Status
$ po status
Translation Status:
en_US: [ ] 0% (0/8)
zh_TW: [====== ] 12% (1/8)
=head2 Auto Translation
Auto translate via Google Translate REST API:
Default backend is google translate REST API, This will translate zh\_TW.po file and translate msgid (en\_US)
to msgstr (zh\_TW):
$ po auto zh_TW --from en_US
$ po auto zh_CN --from en_US --to zh_CN
$ po auto zh_CN --from en_US --overwrite --prompt
$ po auto --backend google-rest --from en\_US --to zh\_TW
=cut
( run in 1.689 second using v1.01-cache-2.11-cpan-ceb78f64989 )