Email body translation fails
Permalink
My Norwegian translation fails for the standard email concrete/mail/validate_user_email.php and the email sent then contains the default English text.
The email subject and other translations work OK, which means something is complete wrong in my email body translation.
The body section is the following:
$body = t("Welcome to %s!
Please click the following link to activate your user account:
%s
Best regards,
%s", $site, View::url('/login', 'callback', 'concrete', 'v', $uHash), $site);
The po content opened in plain text is the following:
msgid ""
"Welcome to %s!\n"
"\n"
"Please click the following link to activate your user account:\n"
"\n"
"%s\n"
"\n"
"\n"
"Best regards,\n"
"%s"
msgstr ""
"Velkommen til %s!\n"
"\n"
"Følg denne linken for å aktivere brukerkontoen din:\n"
"\n"
"%s\n"
"\n"
"\n"
"Med vennlig hilsen\n"
"%s"
The email subject and other translations work OK, which means something is complete wrong in my email body translation.
The body section is the following:
$body = t("Welcome to %s!
Please click the following link to activate your user account:
%s
Best regards,
%s", $site, View::url('/login', 'callback', 'concrete', 'v', $uHash), $site);
The po content opened in plain text is the following:
msgid ""
"Welcome to %s!\n"
"\n"
"Please click the following link to activate your user account:\n"
"\n"
"%s\n"
"\n"
"\n"
"Best regards,\n"
"%s"
msgstr ""
"Velkommen til %s!\n"
"\n"
"Følg denne linken for å aktivere brukerkontoen din:\n"
"\n"
"%s\n"
"\n"
"\n"
"Med vennlig hilsen\n"
"%s"
Check that the concrete/mail/validate_user_email.php file is saved using Unix line endings and now with Windows line endings.
The concrete/mail/validate_user_email.php file is saved using Unix line endings.
The translated body text however is not retreived and comes with the English text.
The new lines \n are now also included in the $body setting to make it more clear.
What can be the problem?
The following represents the latest $body setting and the po content:
$body = t("Hi,\n
Welcome to %s!\n
Please click the following link to activate your user account:\n
%s\n
\rBest regards,\r%s", $site, View::url('/login', 'callback', 'concrete', 'v', $uHash), $site);
msgid ""
"Hi,\n"
"Welcome to %s!\n"
"Please click the following link to activate your user account:\n"
"%s\n"
"\rBest regards,\r%s"
msgstr ""
"Hei,\n"
"Velkommen til %s!\n"
"Følg denne linken for å aktivere brukerkontoen din:\n"
"%s\n"
"\rMed vennlig hilsen\r%s"
The translated body text however is not retreived and comes with the English text.
The new lines \n are now also included in the $body setting to make it more clear.
What can be the problem?
The following represents the latest $body setting and the po content:
$body = t("Hi,\n
Welcome to %s!\n
Please click the following link to activate your user account:\n
%s\n
\rBest regards,\r%s", $site, View::url('/login', 'callback', 'concrete', 'v', $uHash), $site);
msgid ""
"Hi,\n"
"Welcome to %s!\n"
"Please click the following link to activate your user account:\n"
"%s\n"
"\rBest regards,\r%s"
msgstr ""
"Hei,\n"
"Velkommen til %s!\n"
"Følg denne linken for å aktivere brukerkontoen din:\n"
"%s\n"
"\rMed vennlig hilsen\r%s"
This issue is now solved.
I returned back to the original $body setting with no new lines \n and then in Poedit typed in the translation. I then realized that Poedit in fact adds 2 \n for the 2 single new lines found from 1 \n in PHP. When the translation was then made, I opened the po file in text editor and edited the original msgid string to what got from Poedit when it comes to these multiple \n.
I returned back to the original $body setting with no new lines \n and then in Poedit typed in the translation. I then realized that Poedit in fact adds 2 \n for the 2 single new lines found from 1 \n in PHP. When the translation was then made, I opened the po file in text editor and edited the original msgid string to what got from Poedit when it comes to these multiple \n.