Search code examples
phpinternationalizationgettext

How to get list of translated languages in app using php gettext


How can I get a list of all languages (translations included with app) included with my project (not a system)?

files are stored in folders:

/lang/en_US.UTF-8/LC_MESSAGES/domain.po
/lang/it_IT.UTF-8/LC_MESSAGES/domain.po

I know I could perform a search on files, but I think there could be a better way of doing it. Manuals and forums are showing possible locales installed ( locale -a ) on a whole system, not a list of translations on the application.

What would be the best way of getting such list?


Solution

  • You have to search the directories. The command locale -a lists locale definitions installed on your system and that has nothing to do with which translations your application installs.

    And, by the way, you should install compiled .mo files, not the .po source files in these directories.