localising a text using gettext <p>I have a text in English which i want to convert it into French. </p> <p>The sequence that i followed are as under:</p> <ol> <li>generate all the text using xgettext command in terminal, creating .pot file</li> <li>creating .po file from .pot file</li> <li>creating .mo file from .po file</li> </ol> <p>I have copy the .mo file in "/usr/share/locale/fr/LC_MESSAGES"</p> <p>here is my code for main.c file:</p> <pre><code>int main() { setlocale(LC_ALL,""); bindtextdomain("main","/usr/share/locale"); textdomain("main"); printf( gettext("Hello world\n")); return (0); } </code></pre> <p>When i execute the program the French version of the text is not printed in terminal. What can be the reason for this issue?</p> <p>Here is my fr.po file</p> <pre><code># French translations for GNU main package. # Copyright (C) 2010 THE GNU main'S COPYRIGHT HOLDER # This file is distributed under the same license as the GNU main package. # msgid "" msgstr "" "Project-Id-Version: GNU main 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-12-29 10:14+0530\n" "PO-Revision-Date: 2010-12-29 12:21+0530\n" "Last-Translator: Lenin\n" "Language-Team: French\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n &gt; 1);\n" #: main.c:29 #, c-format msgid "Hello world\n" msgstr "Bonjour tout le monde\n" </code></pre> <p>Here is my call to msgfmt from current directory:</p> <pre><code>msgfmt -c -v -o main.mo fr.po </code></pre>