git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Yi, EungJun" <semtlenori@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] http: Add Accept-Language header if possible
Date: Wed, 9 Jul 2014 02:18:53 -0400	[thread overview]
Message-ID: <20140709061853.GA6731@sigill.intra.peff.net> (raw)
In-Reply-To: <CAFT+Tg8HZTsbWK2WHHg_q04LY5Vm7cjfNkfHGBEdbKjf1==rKw@mail.gmail.com>

On Wed, Jul 09, 2014 at 02:46:35PM +0900, Yi, EungJun wrote:

> I agree with you. In fact, I tried to get user's preferred language in
> the same way as gettext. It has guess_category_value() to do that and
> the function is good enough because it considers $LANGUAGE, $LC_ALL,
> $LANG, and also system-dependent preferences. But the function does
> not seem a public API and I don't know how can I use the function in
> Git. So I chose to use $LANGUAGE only.

I did some digging, and I think the public API is setlocale with a NULL
parameter, like:

  printf("%s\n", setlocale(LC_MESSAGES, NULL));

That still will end up like "en_US.UTF-8", though; I couldn't find any
standard functions for parsing that. It seems like it would be pretty
straightforward to do so, though.

>From my brief reading of rfc2616, that should probably become "en-us",
and any time we add "x-y", we may want to add "x" as a fallback (that is
certainly true for English; I don't know about other languages with
dialects).

-Peff

  reply	other threads:[~2014-07-09  6:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 15:54 [PATCH] http: Add Accept-Language header if possible Yi EungJun
2014-07-08 21:52 ` Eric Sunshine
     [not found]   ` <CAFT+Tg-6fR9OJ93TT7ww3x=zYHY=Dh5u-7owgQMBK5o_JKLEaA@mail.gmail.com>
     [not found]     ` <CAPig+cQ05pzU9uVBqS8tBHvB8_3qAtgsPYz1sGhpa0W1CVymqA@mail.gmail.com>
2014-07-11 16:35       ` Yi, EungJun
2014-07-09  5:10 ` Jeff King
2014-07-09  5:46   ` Yi, EungJun
2014-07-09  6:18     ` Jeff King [this message]
2014-07-09 10:46       ` Peter Krefting
2014-07-10 20:10         ` Jeff King
2014-07-11  9:43           ` Yi, EungJun
2014-07-12 10:11           ` Peter Krefting
2014-07-09 10:40 ` Peter Krefting
2014-07-11  9:05   ` Yi, EungJun
  -- strict thread matches above, loose matches on Subject: below --
2015-01-22  7:54 [PATCH v7 1/1] " Junio C Hamano
2015-01-27 15:51 ` [PATCH v8 0/1] " Yi EungJun
2015-01-27 15:51   ` [PATCH] " Yi EungJun
2015-01-27 23:34     ` Junio C Hamano
2015-01-28  6:15       ` Junio C Hamano
2015-01-28 11:59         ` Yi, EungJun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140709061853.GA6731@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=semtlenori@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).