开发者

Fetch all messages from current domain in PHP gettext

开发者 https://www.devze.com 2023-02-05 06:41 出处:网络
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

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"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号