Re: [fwd] Re: [rt-devel] Language detection bug (from: [email protected])
[email protected] (Andrew Snare) Mon, 10 Feb 2003 11:55:47 +0100
| Newsgroups | perl.i18n |
|---|---|
| Message-ID | <[email protected]> |
At 03:10 PM 7/02/2003 -0900, Sean M. Burke wrote:
>Short story:
>If you have a lexicon for a language form whose tag is "xx-yy", of course
>you're calling it xx_yy.pm. But if there's not already a xx.pm, you
>should make there be one, even if it consists of just "package
>Whatever::xx; use base qw(Whatever::xx_yy); 1;".
>(Or of course you could just mv xx_yy.pm xx.pm.)
Following the reasoning from my earlier post, if xx-yy is available then
it's also a candidate for matching 'xx' if that's all a client asks for. I
understand the problem in choosing between xx-yy and xx-zz, and why the
burden has been shifted onto the client programmer. Maybe it's worth
spitting out a warning if xx-** is found without xx also being present?
(This just makes the requirement more obvious.)
This, incidentally, is a specific version of the problem whereby the client
doesn't send any Accept-Languages header. In this situation all languages
are 'matches'. The same mechanism (if any) should probably resolve this
situation: programmer has to make it explicit, warning if any language is
present and there's no default.
>Incidentally, one that that Locale::Maketext does do, is the reverse: if a
>user accepts en-ca, Locale::Maketext will say "OK, I can also just give
>then en.pm". That is, this accept list:
>Accept-Language: en-CA, es-MX
>is treated as if it were really:
>Accept-Language: en-CA, es-MX, en, es
>
>I suppose I could have easly made it instead work so it would instead read
>it as:
>Accept-Language: en-CA, en, es-MX, es
>I'm not particularly attached to either way; I bet there's theoretical and
>practical arguments both ways. Does anyone have a preference? It's all
>negotiable.
This is arguably wrong. I understand why it's done, and admittedly there's
nothing explicitly saying it's wrong in the RFC. However, the prefix-rule
does appear to be one-way. In logic terms, the prefix rule appears to mean
something like:
xx -> xx-*
That is, xx implies that xx-* is acceptable. However, the reverse
implication is not explicitly stated: xx-* does not imply that xx is
acceptable.
- Andrew