Localization woes - Included *.pot files incomplete?

Hello, I am currently working on a localization of FreePBX into Japanese.

I used the .pot files that were included in the FreePBX 2.11 distro released on 7/31 . However, even after translating all the strings included in these files, creating .po files, compiling them into .mo files, and then placing them in the correct directory, I run into trouble.

I can switch the FreePBX web interface into the new language, but many portions of the UI remain untranslated.

Looking through the modules’ php code (which is what the .pot files are supposed to be generated from via xgettext), it is clear that the strings are there, it is just not included in the .pot files included in the distro.

None of the other included translations seem to be complete either (switching to German only shows a couple of phrases in German while the rest remain in English).

I would like to try and iron this out. I know that there is a script in /usr/src/freepbx-2.11.0/update_i18n.sh which is supposed to poll .php code for strings and update the .pot files, but is this script working and/or up to date? Inside the script it changes directory to ./amp_conf/htdocs/admin/modules/ and scans there for translatable strings, but the number of modules listed here seems to be nowhere near the total number included in /var/www/html/admin/modules

Getting lost here trying to find out what the correct way of going about this is…

Also, the localization info at http://www.freepbx.org/v2/wiki/I18n seems to be out of date. /var/www/html/admin/views/freepbx_admin.php doesn’t exist, although the part “Testing your Translation” makes reference to this.

I am willing to help where possible but since this is my first localization I am a bit of a newb here. Has anyone else experienced similar issues and/or found a solution?

As FreePBX continue to evolve it’s possible that the .pot files aren’t as up to date as they should be. This could be because we’ve rewritten modules, fixed misinformation, fixed spelling/grammar mistakes, or just haven’t updated them in a while. Since I’m sure there is information that is currently out of date, it’s definitely something that we need to get better at updating to assist those who rely on it, as is the case here.

Now let’s get to answering your questions. The update_i18n.sh script is still functional and works to generate the .pot files. However it currently will generate them for every single module, with an the exception of core (as core’s translations reside in admin/i18n/amp.pot). I have a modified version of the script that here thats been hacked up to handle core as well as allow users to generate .pot files for individual modules rather than having to do them all at once which needs more testing before getting checked in.

Now as for the documentation, most of the documentation is still valid but the language options have been moved to /var/www/html/admin/views/menu.php. I’ve since moved the documentation to our new wiki (where all our new documentation is being done as we retire the old outdated documentation such as the documentation you found) and updated the parts that stuck out. It’s possible there are more areas that need to be cleaned up, and if that’s the case let me know. You can find the updated documentation at http://wiki.freepbx.org/display/DC/Translating+FreePBX.

Bryan, thanks for your response. I understand that it needs more testing, but would you mind sharing that script with me?

Sure, I’ll post here as soon as possible, however please note it may be after ITExpo as we are putting on FreePBX World.

Hey Bryan - quick bump to see if you had a moment to upload the script? Appreciate your help.

My apologies on the delay. You can grab the script I was working on by going to http://upgrades.freepbxdistro.org/files/update_i18n.sh. I tested it briefly but let me know if there are any issues I didn’t uncover.

Thanks for posting the link to the script! I gave it a shot and it works wonderfully for the modules. The same problems are still there with regard to localization, but your script seems to be simpler than what came before. Looking over the comments in the script you refer to “framework”, assuming you mean what is called the core here and ends up in amp.pot?

Am I correct in assuming this is OK for what’s in the modules directory but not ready for amp.pot?

The core module itself doesn’t have an i18n directory as it actually puts it’s translations into framework at this time (which is /var/www/html/admin/i18n on CentOS), which is why the name becomes amp.pot. Does this help clarify it? Has the documentation helped at all?

Hi Bryan, I updated the find command in the script because not all strings that need to be translated are necessarily in the base directory modules/{modulename}/ - some modules with multiple pages like OSS Endpoint Manager have PHP files in directories like “views” and such, and those PHP files need to be scanned by gettext too.

I changed the line

find ${modules%%/}/*.php | xargs xgettext --no-location --from-code=UTF-8 -L PHP -o ${modules%%/}/i18n/${rawname%%/}.tmp --keyword=_ -


find . -wholename “./${modules%%/}/*.php” | xargs xgettext --no-location --from-code=UTF-8 -L PHP -o ${modules%%/}/i18n/${rawname%%/}.tmp --keyword=_ -

I am still going through everything and submitting bugs, trying to see what the cause of the different instances of incomplete localization is along the way. This change helped me knock out a few more English-only spots.

By the way, what’s the best way to get further script updates to you?

Well darn, that change I made seems to help with some of the modules with directory nested PHP files, but it also ruined the ability to generate amp.pot for the main stuff because you can’t use “./…” and stuff like that in the -wholename argument for find… this is gettin’ messy.

Racking my brain for some kind of manipulation of the “find” command that will give us the best of both worlds…

I sent you a private message with some direct contact information for me which should help us keep the script up to date. I’ll also try to get an impromptu git repo up that will allow us to continue to move the current language tools forward.

I recommend exploring the possibilities of https://poeditor.com as localization tool. It is very useful and open source-friendly.


We use weblate now. No need for a po editor.