till now I have avoided any locale specific PHP routines in my plugins (as it's done in CMSimple_XH's core), as I'm afraid that might be a problem on shared hosts particularly for multi language sites, because the required locales might not be installed on the server (particularly the UTF-8 locales). This might not be a big problem for formatting date/time (if necessary the names of the 12 months and the 7 days could be localized in the language files). But it is definitely a problem regarding the sorting of strings, as different languages have totally different collation sequences. So using locales seems to be unavoidable for several tasks.
Some plugins already use several locale specific routines and call setlocale() to change the current locale to some user defined setting in the language files. This might lead to unexpected behavior, if two plugins set different locales. So probably setting up the desired locale should be done by CMSimple_XH's core. This way it can even be detected ("system check"), if the chosen locale is available on the server. Unfortunately neither the names of the locales are standardized nor is there a universal possibility to list the installed locales, so users would have to find the right one by some trial and error.
And it seems that setlocale doesn't work on Windows for UTF-8 locales:
Additionally one has to consider the locales used in the browser by JS. E.g. formatting a date on an English site view in a Browser which is set to a German locale will show the German version.http://msdn.microsoft.com/en-us/library/x99tb11d.aspx wrote:If you provide a code page like UTF-7 or UTF-8, setlocale will fail, returning NULL.
Any ideas, suggestions or insights on this topic are very welcome.
Christoph