How can I extract all translations from a .po or .mo file? I need to create an array of all translations that are inside.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You can use PEAR File_Gettext. The code would then be:
There is a small extraction AWK script in PhpWiki 1.2, called translate.sh. Use that (on Linux).
It greps all .po files and generates a .php array() script.
msgunfmt is a unix tool that reads .mo files and produces a .po file.
I used po2csv to convert the po, then read the csv into php using the
fgetcsv()
function.You can use Zend Translate module from Zend Framework.
or you can use php gettext module, but Zend is much more handy.