From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10013 Path: news.gmane.org!not-for-mail From: Masanori Ogino Newsgroups: gmane.linux.lib.musl.general Subject: Re: gettext and locale names Date: Mon, 9 May 2016 21:46:50 +0900 Message-ID: References: <20160504213938.GV21636@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1462798821 1819 80.91.229.3 (9 May 2016 13:00:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 May 2016 13:00:21 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10026-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 09 15:00:14 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1azkaY-0008NZ-Nk for gllmg-musl@m.gmane.org; Mon, 09 May 2016 14:47:06 +0200 Original-Received: (qmail 5466 invoked by uid 550); 9 May 2016 12:47:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 5444 invoked from network); 9 May 2016 12:47:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to; bh=mCfJuTga0Wz2dgVIzEqZXq39bEwKV+jaYmSMG9r/9oo=; b=byLwmNuXsa3GLUR57xkut/ktX8g/FJfpD5DjUJFCn3xlgIgiW5knCtl/FHvqX6hmk0 r4rkfhH93WA6jfcnFtXCyVamanZy0eTjBUGnQuAO/QSlWj+0BAy/Sj+H6egqcp31OKI/ iE2aLlr845YpqiWZkQ8hABl7yDnwTRHwMHxi2/FxbdLfeljMqB6DNCeUA2VXT690/gjB azlFv98DBoPPzCFrfNVKjROhTTeYLSD//h4XQJ/HpOwt2JI31UreokHB47RlsFbiaRMC 7MbCKij27Z7lJ+pm/DvYcBNKQkGju9ENQDkIEZWMTh0T0unU6NH86W/zuyKp6g1b6w6P t2uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to; bh=mCfJuTga0Wz2dgVIzEqZXq39bEwKV+jaYmSMG9r/9oo=; b=hGEnMkM7m/tIKiyAxA5Hi6T0+Ncsm6ToUALP9iU0+HEyKUwK7hVyAS7F6jv7t/sEa/ w0cSyIRgpmMMcU18ISLOqV4NoKEC9RKLJ2SVoRWImVV82KT0wijGzavp85AG3Z8RL4gf c/WUhjPhosKtTrmJSpgecnTtl8+18yRvm6zMMBLa/7yumABx9myD7xoSibxN/d8te0k0 2iGHJIMiwu3twl7OD8t47Ak5eZjPbXenXsnf2BiMe5fTHKJJuKEzADPuQlI+h5ebVejf SjP75R4Aztqe8hrxWTfx4jlE9JpqdxzvKUp7ICKodATConCf/flTMyXuUBwlxcxFtfmH oylw== X-Gm-Message-State: AOPr4FXjHGRfrUZuDSRoL0gf30YT0BYW5WJ9yPSYaYyRAXmSd7dXmSHd+QO5I/P+AFptvSB5rRGNiUfkaytvdw== X-Received: by 10.157.37.235 with SMTP id q98mr100805ota.47.1462798010687; Mon, 09 May 2016 05:46:50 -0700 (PDT) Original-Sender: masanoriogino@gmail.com In-Reply-To: <20160504213938.GV21636@brightrain.aerifal.cx> X-Google-Sender-Auth: Z4Oq1345yRMcDTC5s2eXpocVWIA Xref: news.gmane.org gmane.linux.lib.musl.general:10013 Archived-At: 2016-05-05 6:39 GMT+09:00 Rich Felker : > 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@latin, 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@euro or en_GB.UTF-8, when the code receives en_GB.UTF-8@euro? I am unsure whether someone actually uses such locale, but I think it is necessary to discuss such corner cases. -- Masanori Ogino