GETTEXT enabled but not working


  • | 278 points

    Hi,

    Four hours I'm trying to make working php_gettext but it's not working. It is correctly enabled (I use Php7.1 and tried with php7) but still not working, my code is :

    //LANGUAGE SET SELECTOR
    define('SESSION_LOCALE_KEY', 'ix_locale');
    define('DEFAULT_LOCALE', 'es_ES');
    define('LOCALE_REQUEST_PARAM', 'lang');
    define('WEBSITE_DOMAIN', 'messages');
    if (array_key_exists(LOCALE_REQUEST_PARAM, $_REQUEST)) {
    $current_locale = $_REQUEST[LOCALE_REQUEST_PARAM];
    $_SESSION[SESSION_LOCALE_KEY] = $current_locale;
    } elseif (array_key_exists(SESSION_LOCALE_KEY, $_SESSION)) {
    $current_locale = $_SESSION[SESSION_LOCALE_KEY];
    } else {
    $current_locale = DEFAULT_LOCALE;
    }
    putenv("LC_ALL=$current_locale");
    setlocale(LC_ALL, $current_locale);
    setlocale(LC_NUMERIC, 'en_US');
    $pathh = dirname(FILE);
    bindtextdomain(WEBSITE_DOMAIN, $pathh);
    bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8');
    textdomain(WEBSITE_DOMAIN);

    Someone can help ?

    Thanks !!!


  • administrators
    | 68677 points

    @Harold-May : What is the error?
    Any image? such as an image about phpinfo() that shows gettext is enabled?


  • | 278 points

    Aqui esta el phpinfo : https://ibb.co/cqXcmF


  • administrators
    | 68677 points

    Got it. I'll test and get back to you.


  • administrators
    | 68677 points

    @Harold-May: It's a problem with your PHP code:
    $pathh = dirname(FILE);
    should be:

    $pathh = dirname(__FILE__);
    

  • | 278 points

    Hi,

    I put it this way but when i copied my code the double _ have been deleted, so this isn't the cause ... :(


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.