Hi,
I have a problem with translating texts with gettext(). I’ve used poedit for translating the texts. Most of the strings get translated perfectly from english to finnish, but some multi-line strings that I use for automatic emails fail to translate and just show the english original. I’ve tried many different setlocale etc schemes, clearing the cache and restarting apache. I’m using PHP Version 5.3.3.
Here’s one way I’ve tried setting up the language, locale etc:
[php]$lang = “fi_FI.utf8”; // also tried fi_FI which seems to work identically
putenv(“LC_ALL=$lang”);
putenv(“LANG=$lang”);
//setlocale(LC_ALL, “”);
setlocale(LC_NUMERIC, ‘en_US’); // decimal separator
bindtextdomain(‘messages’, ‘locale/nocache’); // flushes gettext cache
bindtextdomain(“messages”, “locale”);
bind_textdomain_codeset(‘messages’, ‘UTF-8’);
textdomain(“messages”);
[/php]
Here’s some strings:
[php]$subject = _(“Your new eTool account”); // gets translated fine
$message_template = gettext('Hi!
Link to eTool client form for #NAME#
Contact person: #CONTACTPERSON# #EMAIL#
Link: #FORM_URL#
'); // this is the one that doesn’t get translated
$comments = _(‘Comments:’); // gets translated fine
[/php]
Here’s the problem translation from message.po:
#: gettext-test.php:22
#, fuzzy
msgid ""
"Hi! \n"
"\n"
"Link to eTool client form for #NAME#\n"
"\n"
"Contact person: #CONTACTPERSON# #EMAIL#\n"
"\n"
"Link: #FORM_URL#\n"
"\n"
msgstr ""
"Hei! \n"
"\n"
"Linkki eTool asiakaslomakkeeseen asiakkaalle #NAME#\n"
"\n"
"Yhteyshenkilö: #CONTACTPERSON# <#EMAIL#>\n"
"\n"
"Linkki: #FORM_URL#\n"
"\n"
It seems it might have something to do with the problem translation being multi-line, but haven’t been able to find anything useful to help with that. Gettext is supposed to support multi-line translations.