zwon has asked for the wisdom of the Perl Monks concerning the following question:

Hello everybody!

I'm looking for the tool to implement internationalisation support for a website and so far it seems like Locale::Maketext::Lexicon is the way to go except one problem -- it doesn't have support for plurals out of the box and I couldn't find any ready solution for this problem. So before I start working on my own solution I want to ask the monks if I missed the existing one. There's a quant function provided by Locale::Maketext, but it is not good enough even for English, and not suitable for Slavic languages at all. So what I missing is ngettext(3) functionality. Considering that module seems quite popular, I hope that somebody has already found workaround and is willing to share his wisdom. The examples of the messages I have problem with:

  • Comment on Locale::Maketext::Lexicon and plural forms

Replies are listed 'Best First'.
Re: Locale::Maketext::Lexicon and plural forms
by Anonymous Monk on Mar 23, 2011 at 19:10 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/ ).