Fetch all messages from current domain in PHP gettext
There is a gettext() function in PHP to lookup a message in the current domain.
Is there a way to fetch al开发者_开发技巧l messages from current domain?
No, there isn't. The low-level libgettext API doesn't provide a means either.
You might use (and rewrite) the gettext Adapter from Zend_Translate (or php-gettext or gettext.php) to read out a whole gettext message file however.
The PHP documentation says no.
The current domain by definition contains infinite messages, so your question is not so useful. The question "How to enumerate the messages within a particular message catalog?" may be more suitable.
Get translations from .po or .mo file
This is possible on the command line, e.g.
$ msgcat <catalog-name>
...
#: conf/global_settings.py:44
msgid "Arabic"
msgstr "Árabe"
#: conf/global_settings.py:45
msgid "Bengali"
msgstr "Bengalês"
精彩评论