in reply to Locale::Maketext::Lexicon and plural forms

ngettext
Locale::gettext
Locale::Messages
  • Comment on Re: Locale::Maketext::Lexicon and plural forms

Replies are listed 'Best First'.
Re^2: Locale::Maketext::Lexicon and plural forms
by zwon (Abbot) on Mar 24, 2011 at 00:50 UTC

    These modules have their own problems unfortunately. They require to set LC_MESSAGES which mean that error messages in web-server error log also will be localised and I certainly don't want that. Also it looks like I can set LC_MESSAGES only once per process, and I need to be able to use different locales for every request. No, the last statement is actually wrong.

      Are you sure that there won't be problems with using the process locale in a web server setting? For example, if users A and B are being served by the same Apache process, A is an English user and B is a Russian user, and B's request changes the process' locale before A's request finishes; isn't it possible that A would then get a page back in the wrong language? I know this is a problem in PHP ( http://php.net/manual/en/function.setlocale.php ), and I know that POSIX 2008 implemented a workaround via uselocale ( http://www.manpagez.com/man/3/uselocale/ ).

        I'm sure that there will be problems. That's exactly the reason why I prefer Locale::Maketext to various wrappers around gettext.