Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 9 May 2016 21:46:50 +0900
From: Masanori Ogino <masanori.ogino@...il.com>
To: musl@...ts.openwall.com
Subject: Re: gettext and locale names

2016-05-05 6:39 GMT+09:00 Rich Felker <dalias@...c.org>:
> On Wed, May 04, 2016 at 10:05:28PM +0900, Masanori Ogino wrote:
>> Hello,
>>
>> When I played with gettext API, I found that musl searches .mo files
>> with a directory named as current *full* locale names, e.g.
>> en_US.UTF-8. However, we often use shortened names too. Here is a list
>> of those names from those of my machine in /usr/share/locale: de,
>> en_GB, ru_UA.koi8u, sr@...in, etc.
>>
>> Due to this mismatch, we can't get translations with musl's gettext
>> API for applications in wild. Thus, I'm considering to implement
>> locale searching with shortening. Does it make sense?
>
> Yes, I think this makes sense. Before spending time on the code though
> it makes sense to discuss the proposed logic here. What level would
> the search/shortening happen at? __get_locale in locale_map.c? In
> dcngettext.c?
>
> Rich

Sure. I doubt that shortening in __get_locale might be insufficient
since some code may want the full locale name even if there is no
locale data for it. I will dig into the code.

Another problem is the preference of shortened locales. Obviously, the
full locale itself has the highest priority and language-only locales
(e.g. en, de, etc.) do the lowest one. However, which is the preferred
locale, en_GB@...o or en_GB.UTF-8, when the code receives
en_GB.UTF-8@...o?

I am unsure whether someone actually uses such locale, but I think it
is necessary to discuss such corner cases.

-- 
Masanori Ogino

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.