开发者

php translation

Ok, I'm losing my mind here... I have a webpage and i need to translate it. To test the translation I set up a helloworld-type file to test it, and then I applied the code to the whole page when I was finished. So:

i have a file test.php and it contains:

<?php
$directory = dirname(__FILE__).'/l';
$domain = 'mydomain';
$locale ="hr_HR";

putenv("LANG=".$locale);

setlocale( LC_ALL, $locale);
bindtextdomain($domain, $directory);
textdomain($domain);
bind_textdomain_codeset($domain, 'UTF-8');
echo _("Hello World"); 
?>

The file is located in the d:\xampp\htdocs\ folder

i have a file hr_HR.po and it contains:

msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Text in function
#: test.php:8
msgid "Hello World"
msgstr "TEST"
开发者_开发问答

and it's located in the d:\xampp\htdocs\l\hr_HR\ folder.

Using poedit i was able to make a .mo file out of the .po file...

So everything should be working fine, but it isn't... any help would be appreciated!!!

Thanks in advance!


  • Is gettext installed?
  • Is the PHP module gettext installed?
  • Do the .mo files exist? Is Apache allowed to read them?
  • Is the desired locale installed?
  • Has Apache been restarted?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜