Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

problem with 2 different locales



9:49 am on Mar 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

In a project of my company there is a website available in 6 languages. The site sends some emails to customers/members. Every phrase/word is stored in database and all work well in the website. Our main problem appears in emails.

In each email there are daily reports. We use set_locale() to define each language and "show" the day names (months also) to the proper selected language. This works ok.

In some cases there are more than one emails to be send (in 2 different languages) - here we have problem. Every info in email appears correct - texts/translations from database. Day names (and month also) appear only in the first language in both emails. So, if the first email was in german and the second in french, the french email will have everything in french except the day names that will be in german (even though that we execute set_locale again before sending the second email)

so the actual sciprt will look something like:

setlocale(LC_ALL, $german);
// send german email

setlocale(LC_ALL, $french);
// send french email

Each language locale look like: "fr_FR.UTF8"

Why is that? Is this some set_locale bad behavior? How can we prevent/fix this? Thank you for any insight/tips

edit: server runs apache 2 and php4 if you need this info


12:44 pm on Mar 30, 2012 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

>> Each language locale look like: "fr_FR.UTF8"

Is that the return value of each setlocale function? I would first check here to make sure the system isn't returning anything odd.

Also, is this windows or linux?


12:59 pm on Mar 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

yes, at first i checked if i get the proper language.
It works ok
The system is linux.
The problem appears only on day names and month names - i use the set_locale() only for those 2. All other text is stored in database
Further investigation shows the problem to be appear between english-german, english-french, german-french, english-italian, english-russian - still checking a couple more languages
It is not a problem between english-greek!

Featured Threads

Hot Threads This Week

Hot Threads This Month