[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#345639: nl_langinfo(YESEXPR) ignores LANGUAGE, no apparent workaround

[Tollef Fog Heen]
> Either that, or make sure YESSTR/NOSTR (from I18N::Langinfo) are
> usefully populated and use those.  (They seemed generally not to be
> based on the discussion on #debian-devel yesterday).

It's not clear to me whether YESSTR/NOSTR are supposed to be
single-letter abbreviations, or whole words, since the locales I have
installed don't include them.  So if you want to print a localised
version of [y/N] or [Y/n], you might have to truncate those strings, as
well as convert to uppercase/lowercase.

Both trunctation and case-conversion are quite non-trivial, unless
nl_langinfo(CODESET) happens to be a single-byte, stateless character
set (for which the 'char' datatype and the <ctype.h> functions can be
used), like the ISO-8859 family.

Note that I'm assuming C, not Perl.  Dealing in multibyte or
shift-state character sets may be easier in Perl.

[your code simplified slightly]
> $ye = langinfo(YESEXPR);
> $y = langinfo(YESSTR);
> if (! length $y) {
>     for ('a' .. 'z') { if (m/$ye/o) { $y = $_; last } }
> }

This, too, makes assumptions about the character set.  It won't work
too well for Korean or Russian, I expect.


Attachment: signature.asc
Description: Digital signature

Reply to: