Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:30:52+00:00 2026-06-09T17:30:52+00:00

I am currently developping a PHP web app that needs to be available in

  • 0

I am currently developping a PHP web app that needs to be available in French and English. I looked around and found that the Gettext() functionality offers the best performance.

I generated my .pot file with the command

 xgettext PhpFileToTranslate.php -o NameOfTemplateFile.pot

and successfuly generated a .pot file.
I used PoEdit to generate messages.po file and created messages.mo

Here are my server files :

/app
    /locale
        /en_US
              /LC_MESSAGES
              messages.po
              messages.mo
        /fr_FR
              /LC_MESSAGES
              messages.po
              messages.mo
        template.pot

And i set the locale in the php file like this :

$language = $_SESSION['language'];  //session contains 'fr_FR.UTF-8' or 'en_US.UTF-8'
setlocale(LC_ALL, $language);
bindtextdomain('messages', './locale');  
textdomain('messages');

but i only see the label and not the translation…
I tried putting ‘fr_FR’ instead of ‘fr_FR.UTF-8’ and all kinds of strings but it’s not working.

Am I missing something?
My server is Ubuntu 12.04 Server with Apache and php5

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:30:54+00:00Added an answer on June 9, 2026 at 5:30 pm

    To compile your .mo files on linux you need to have the locales installed on the server and on the machine that compiles it. Locales are the languages supported by your OS.

    As stated in this tutorial : http://dev.jimdo.com/archive-old-blog/tutorial-for-the-easy-use-of-gettext-for-internationalization-of-php-apps/
    Verify that you have the locales installed on your linux

    Be sure that the locales you want to use are installed in your linux and that you use the .UTF-8 (you want i18n so please use UTF!):

    # Example for debian
    dpkg-reconfigure locales
    

    —
    To install new locales on linux

    List the languages actually installed on your system:

    locale -a
    

    Example to install fr_FR:

    #List the available i18n locales
    less /usr/share/i18n/SUPPORTED
    

    Install the locale (here fr_FR.utf8)

    locale-gen fr_FR.utf8
    

    Reconfigure the locales on your system

    sudo  dpkg-reconfigure locales
    

    Recompile your .mo file with PoEdit and that should do the trick.
    Make sure you install locales both on server and on your machine compiling .mo files.

    Hope that helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web-page in PHP that needs following functionality: 1. When User
I'm currently developing a Web platform app in HTML and PHP stuff. I have
I am currently building a gallery web application using php. I am currently developping
I am developing an App that will interface with a web server (PHP with
We are developing a web app that enables the end user to place a
I'm new to developing, currently only developed on web, like php,html,css,javascript etc etc. Any
I'm developing a multilingual PHP web application, and I've got long(-ish) texts that I
I'm having this weird thing happen. My Zend Framework (PHP) web application that I
I am currently developing a medium sized web application using PHP and need to
I'm currently developing a web file browser using jquery and php. One of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.