gettext: Messages not translated. No error message.

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....

gettext: Messages not translated. No error message.

Postby ^rooker » Tue Dec 06, 2016 6:09 pm

Using gettext/poedit to make a PHP project translatable.
I have a working test-code from PHP and Javascript Internationalization using Gettext and Poedit ( When I move that working code to another machine, I suddenly don't get strings displayed translated, but also no error messages.

The target locale was not installed on system.
Even if you provide the translation files, PHP will not switch to a locale which is not installed/configured on the system that your application is running.

In my case, PHP's setlocale() returned 'false' - indicating that I my target locale was missing.
Check if the locale is currently present and active:
Code: Select all
$ locale -a

If not, either uncomment them in "/etc/locale.gen" and then (re-)generate them:
Code: Select all
$ sudo locale-gen

Or rather do it the "Official Debian Way":
Code: Select all
$ sudo dpkg-reconfigure locales

There, make sure that all the languages/locales you're going to use are checked/selected. After pressing "Ok", they will automatically be (re-)generated.

This should do the trick :D
  • 0

Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
Site Admin
Posts: 1446
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Return to Knowledge Base

Who is online

Users browsing this forum: No registered users and 4 guests

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: Bing [Bot] and 37 guests

Reputation System ©'