Thread (11 messages) flat view 11 messages, 4 authors, 2016-06-15

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

From: Peter Krefting <hidden>
Date: 2016-06-15 23:01:51

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 functions for parsing that. It seems 
like it would be pretty straightforward to do so, though.
RFC 5646 is the current specification on language tags, btw.
 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).
Yes, adding the generic fallback is necessary, as "en-US" on the server 
matches a client's "en", but not vice versa. So if you request "en-US" 
and "de" and the server only has "en-GB" and "de", you'd get the 
"de" version.

Debian's website has a nice writeup on the subject: 
http://www.debian.org/intro/cn#howtoset

-- 
\\// Peter - http://www.softwolves.pp.se/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help