homepage Welcome to WebmasterWorld Guest from 54.163.91.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
problem with 2 different locales
omoutop




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

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

 

eelixduppy




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

>> 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?

omoutop




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

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!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved