Re: [PATCH] http: Add Accept-Language header if possible

2015-01-28 Thread Yi, EungJun
I agree that a list of char* is enough for language_tags. Thanks for your review and patch. I'll apply your patch and send v9. On Wed, Jan 28, 2015 at 3:15 PM, Junio C Hamano wrote: > On Tue, Jan 27, 2015 at 3:34 PM, Junio C Hamano wrote: >> Yi EungJun writes: >> >>> + >>> + sprint

Re: [PATCH] http: Add Accept-Language header if possible

2015-01-27 Thread Junio C Hamano
On Tue, Jan 27, 2015 at 3:34 PM, Junio C Hamano wrote: > Yi EungJun writes: > >> + >> + sprintf(q_format, ";q=0.%%0%dd", decimal_places); >> + >> + strbuf_addstr(buf, "Accept-Language: "); >> + >> + for(i = 0; i < num_langs; i++) { >> + if (

Re: [PATCH] http: Add Accept-Language header if possible

2015-01-27 Thread Junio C Hamano
Yi EungJun writes: > +static void write_accept_language(struct strbuf *buf) > +{ > + /* > + * MAX_DECIMAL_PLACES must not be larger than 3. If it is larger than > + * that, q-value will be smaller than 0.001, the minimum q-value the > + * HTTP specification allows. See > +

[PATCH] http: Add Accept-Language header if possible

2015-01-27 Thread Yi EungJun
From: Yi EungJun Add an Accept-Language header which indicates the user's preferred languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. Examples: LANGUAGE= -> "" LANGUAGE=ko:en -> "Accept-Language: ko, en;q=0.9, *;q=0.1" LANGUAGE=ko LANG=en_US.UTF-8 -> "Accept-Language: ko, *;

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-12 Thread Peter Krefting
Jeff King: If that is the case, though, I wonder if we should actually be adding it as a git-protocol header so that all transports can benefit (i.e., we could be localizing human-readable error messages in upload-pack, receive-pack, etc). That would be very nice, thre is a lot of language mix

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-11 Thread Yi, EungJun
2014-07-12 1:24 GMT+09:00 Eric Sunshine : > On Fri, Jul 11, 2014 at 5:22 AM, Yi, EungJun wrote: >> 2014-07-09 6:52 GMT+09:00 Eric Sunshine : + grep "^Accept-Language: ko; q=1.000, en; q=0.999, \*; q=0.001" actual >>> >>> Do you want to \-escape the periods? (Or maybe use 'grep -F'

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-11 Thread Yi, EungJun
2014-07-11 5:10 GMT+09:00 Jeff King : > On Wed, Jul 09, 2014 at 11:46:14AM +0100, Peter Krefting wrote: > >> Jeff King: >> >> >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 wil

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-11 Thread Yi, EungJun
2014-07-09 19:40 GMT+09:00 Peter Krefting : > Yi EungJun: > > >> Example: >> LANGUAGE= -> "" >> LANGUAGE=ko -> "Accept-Language: ko; q=1.000, *; q=0.001" >> LANGUAGE=ko:en -> "Accept-Language: ko; q=1.000, en; q=0.999, *; q=0.001" > > > Avoid adding "q=1.000". It is redundant (the default for an

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-10 Thread Jeff King
On Wed, Jul 09, 2014 at 11:46:14AM +0100, Peter Krefting wrote: > Jeff King: > > >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; > > And it

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-09 Thread Peter Krefting
Jeff King: 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; And it only yields the highest-priority language, I think. I couldn't find any standard func

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-09 Thread Peter Krefting
Yi EungJun: Example: LANGUAGE= -> "" LANGUAGE=ko -> "Accept-Language: ko; q=1.000, *; q=0.001" LANGUAGE=ko:en -> "Accept-Language: ko; q=1.000, en; q=0.999, *; q=0.001" Avoid adding "q=1.000". It is redundant (the default for any unqualified language names is 1.0, and additionally there ha

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-08 Thread Jeff King
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 sys

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-08 Thread Yi, EungJun
2014-07-09 14:10 GMT+09:00 Jeff King : > On Wed, Jul 09, 2014 at 12:54:06AM +0900, Yi EungJun wrote: > >> From: Yi EungJun >> >> Add an Accept-Language header which indicates the user's preferred >> languages defined by 'LANGUAGE' environment variable if the variable is >> not empty. >> >> Example

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-08 Thread Jeff King
On Wed, Jul 09, 2014 at 12:54:06AM +0900, Yi EungJun wrote: > From: Yi EungJun > > Add an Accept-Language header which indicates the user's preferred > languages defined by 'LANGUAGE' environment variable if the variable is > not empty. > > Example: > LANGUAGE= -> "" > LANGUAGE=ko -> "Accep

Re: [PATCH] http: Add Accept-Language header if possible

2014-07-08 Thread Eric Sunshine
On Tue, Jul 8, 2014 at 11:54 AM, Yi EungJun wrote: > From: Yi EungJun > > Add an Accept-Language header which indicates the user's preferred > languages defined by 'LANGUAGE' environment variable if the variable is > not empty. > > Example: > LANGUAGE= -> "" > LANGUAGE=ko -> "Accept-Language:

[PATCH] http: Add Accept-Language header if possible

2014-07-08 Thread Yi EungJun
From: Yi EungJun Add an Accept-Language header which indicates the user's preferred languages defined by 'LANGUAGE' environment variable if the variable is not empty. Example: LANGUAGE= -> "" LANGUAGE=ko -> "Accept-Language: ko; q=1.000, *; q=0.001" LANGUAGE=ko:en -> "Accept-Language: ko;