0

I need to translate my site to Tamil. This is my code:

$locale = "ta_IN";

putenv("LANG=".$locale);
setlocale(LC_ALL, $locale);

$domain = "ta_IN";
echo bindtextdomain($domain, "Locale");
bind_textdomain_codeset($domain, 'UTF-8');

textdomain($domain);

echo  _("Username");

And I have create .mo and .po files for the word Username and which is in the /var/www/tamil/Locale/ta_IN/LC_MESSAGES/ta_IN.mo and ta_IN.po, but it is not translating my site.

I have these questions and their accepted answers, but the solutions did not work for me:

Community
  • 1
  • 1
Kvvaradha
  • 732
  • 1
  • 13
  • 28

1 Answers1

0

If you're testing gettext on console (PHP-CLI) and not on a webserver, you have to reset the LANGUAGE environment variable too.

putenv("LANGUAGE=");
Ali Nadalizadeh
  • 2,726
  • 3
  • 22
  • 24