We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

gettext not working on php nginx

Hello,

I have the phalcon incubator in use with gettext as translation adapter. On unix/linux apache php 5.4 it works fine.

I have a ubuntu server running php 5.5+ with nginx and the translation is not working. (see https://95.85.45.122/) The message files are still available and gettext is installed.

My question: Does anybody else having a similar issue with this, is there a solution for this in combination with falcon incubator?



58.4k
edited Mar '14

HI mywebcontent Note path in bindtextdomain

$locality = $this->session->get('language').'.UTF-8';
        $this->session->get('language');
        if (defined('LC_MESSAGES')) {
            setlocale(LC_ALL, $locality); // Linux
        } else {
            putenv("LC_ALL={$locality}"); // windows
        }
        //ho $dir = $_SERVER['DOCUMENT_ROOT'].'/app/lang';

        bindtextdomain('messages','../app/lang');

        /**
         * Tell the application to use this text domain, or messages.mo.
         */
        textdomain('messages');

Test page https://nginx-linuxmaster.rhcloud.com/ and source https://github.com/duythien/blog/blob/master/app/controllers/ControllerBase.php

Thank you, Assuming that other platforms could have similar issues, I also developed a DB version, but your suggestion works for me.