Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!