Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
Multi-language support not working on remote host

I have implemented multi-language support in my application using PHP's gettext() function. It's working correctly when testing at localhost, but on remote server there isn't any effect.

I'm using 000webhost that have gettext() support enabled, but when trying to change language there isn't any effect.

I have following file structure

.
+-- locale/
|   +-- en/
|       +-- LC_MESSAGES/
|           +-- messages.mo
|           +-- messages.po
|   +-- sv/
|       +-- LC_MESSAGES/
|           +-- messages.mo
|           +-- messages.po
+-- index.php

and I set language in index like this

if (isset($_GET['lang'])) {
    $lang = filter_var($_GET['lang']);

    switch ($lang) {
        case 'fi':
        case 'en':
        case 'sv':
            setcookie('lang', $lang);
            $_COOKIE['lang'] = $lang;
            break;
    }
}

// I18N support information here
$lang = (isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'fi');
putenv("LANG=" . $lang);
setlocale(LC_ALL, $lang);

// Set the text domain as "messages"
$domain = "messages";
bindtextdomain($domain, "locale");
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);

What would be the difference between localhost and remote server?

Thanks in advance.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda