> This way, if the language is russian, the prompt would be:
> "Start nuclear war? (Да/Нет) (Y/N)"
>
> where both "д" and "y" would confirm, and both "н" and "n" would deny.
>
>
> I'm not sure if there are any languages where the positive answer starts
> with a latin "n" or the negative with "y", but in that case, the language
> uses the latin script, and thus probably can be typed even without correct
> keyboard settings (assuming no umlauts or other diacritics on the other
> answer).
>
> Using a romanized version doesn't sound like the best solution to me, since
> that looks ugly and is counterproductive in most cases where the input is
> already working.

IMO the best solution here is to use libc `nl_langinfo(YESEXPR)'
or `rpmatch' similar to what apt-get does with `YnPrompt'.

The expressions match against the first character of a string, e.g.:

LOCALE       YESEXPR    NOEXPR
de_DE.UTF-8  ^[jJyY].*  ^[nN].*
en_EN.UTF-8  ^[yY]      ^[nN]
es_ES.UTF-8  ^[sSyY].*  ^[nN].*
ru_RU.UTF-8  ^[ДдYy].*  ^[НнNn].*

Which is suitable for anything except the danger prompts:

"Yes, I am aware this is a very bad idea"



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to