Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] helpfiles: Also accept 'UTF-8' as an encoding name.



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Are you sure you didn't mean (/(^en)|\./i) ?  It's really OK for the
> "en" to appear anywhere?

There are so many "standards" for locale names that I really do not know
what is the best: For instance, for the similar "de" (which might
perhaps also be checked) there are besides de_* also fy_DE and hsb_DE on
a Debian installation at my institute (though I do not know what
they mean).
On the other hand, you are right that e.g. ca_ES@valencia
should perhaps not be matching... Perhaps something like
/((^|[^a-z])(en|de))|\./i
is better?
Anyhow, all these fallbacks are a poor choice anyway.

> And wouldn't you want to prefer something that contains "en"
> to somethimg that was found previously but has "."?

It is easy to add further distinctions with

} elsif(($choice < 2) && (/.../)) { # second-to-worst fallback
  $lc_ctype = $_;
  $choice = 2;
} elsif(($choice < 1) && (/.../)) { # worst fallback
  $lc_ctype = $_;
  $choice = 1;
}

(and increasing the previous assignments of $choice correspondingly:
The idea is that $choice is measuring the quality of the "best"
match so far).
However, I am not sure whether this really makes sense and what
is reasonable to put into /.../:
As mentioned, probably none of the fallbacks is ideal, anyway.



Messages sorted by: Reverse Date, Date, Thread, Author