(Refactored from InternationalisationEnhancements)
From
InternationalisationEnhancements:
>but there are security issues with allowing web users to set their own locale variables.
Having recently upgraded to
TWikiRelease01Feb2003, the single most irritating issue of the (-otherwise brilliant) l10n features is that there doesn't seem to be any way of specifying
$useLocale on a per-web basis.
The outcome of this is that when using a non-english locale, a significant number of important links in the
Main and
TWiki webs become broken since plural form wikiwordS don't get linked automatically.
It would make sense if there was a WebPreference variable to define the locale used in that particular web.
--
ConnyBrunnkvist - 09 Feb 2003
... It would be somewhat difficult to do
$useLocale on a per-web basis, because this variable is used in a BEGIN block in various scripts/modules, well before the current web is identified. It should be possible to set the
$siteLocale in a per-web variable, though, but this shouldn't be necessary to fix your problem.
Good to see people are using the
I18N stuff, any feedback is very welcome!
UPDATE: Have just read your report again. This is a bug in the way pluralising is turned off - it should really check for built-in web names (Main and TWiki) first, before turning this off. Search for 'I18N' to find the code in TWiki.pm, it is fairly well commented now.
--
RichardDonkin - 09 Feb 2003
Ok - with the update the answer makes more sense.

I already found the places for where to fix it on my site but .. I still believe that in the long run, a general solution would be something like assign WEBLOCALE per web. That is - canonical not to
$useLocale but rather to
$siteLocale. (actually "
$webLocale ")
--
ConnyBrunnkvist - 16 Feb 2003
Yes, my original answer was made without really reading your comment properly, too busy at the time

I considered doing per web locales, but the problem is that this includes a character set not just a language - if you have different character sets in two webs, it may be impossible to move/copy TWiki pages between the two webs, as some characters may not exist in the new web's charset. In practice, you would have to limit the whole site to one charset - perhaps the solution is to have LANGREG (language + region) set to the locale without charset, e.g.
fr_CA for French Canada. LANGREG would be set to
en_US by default in
TWikiPreferences, ensuring that
TWiki:Main
and
TWiki:TWiki
webs have English pluralisation; it could of course be changed globally where these core webs don't apply or are translated.
The simplest fix (no code) is just to avoid using pluralisation rules in such webs, i.e. refer to
ResetPassword etc. After that, a hard-coded fix that sets pluralisation to on for the Main and TWiki webs seems reasonable (now implemented), until a full LANGREG type solution is possible.
Full multi-locale support will really require UTF-8, so that any language can be supported in any web, while using a single charset.
UPDATE: I've implemented the hard-coded webs fix (including Plugins web) in
TWikiAlphaRelease, i.e. the one leading up to
CairoRelease - see the patch here, or
CVS:lib/TWiki.pm
as of 16 Feb 2003. Also reported in
TWikiRegistrationWrongLinks.
--
RichardDonkin - 16 Feb 2003
When I set $siteLocale = "de_DE\@euro.ISO-8859-15", testenv reports an error that it cannot set the locale. "de_DE.ISO-8859-1" works fine. I tried to understand the siteLocale parsing in TWiki.pm for a while, but still no idea.
--
WolfgangSpraul - 20 Jun 2003
Hi - it's best to start a new page if you have a new question - see
SupportGuidelines, which is the place for this type of thing. Your problem is arguably related to this pluralisation bug, but I don't think it is.
I'm not sure what the '@euro' part is intended to do, but the TWiki code just passes through the entire locale to the Perl
setlocale function, so this should work in Perl as for other tools - the fact that it doesn't indicates that there's a problem in your locale setup. I just looked at the locale parsing and it should work even if '@euro' is included. You might want to try "de_DE.ISO-8859-15" - however, since the Euro symbol isn't a factor in
WikiWords, this may not matter too much.
--
RichardDonkin - 22 Jun 2003
I'm trying to find a discussion of pluralization and related features, but can't. So I'm planting a link here to a new topic
GeneralizingFindElsewhereAndPluralHandling.
--
AndyGlew - 28 Mar 2006