Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Issue 236001: [Linux] Supports the LANGUAGE environment variable.... (Closed)

Created:
11 years, 3 months ago by James Su
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, tim (not reviewing), Paweł Hajdan Jr.
Visibility:
Public.

Description

[Linux] Supports the LANGUAGE environment variable. This CL adds the support for the LANGUAGE environment variable, which is supported by gettext based applications for specifying a priority list of user prefered locales for UI messages translation. Unlike gettext based applications, which support using different locales for messages translation and other locale categories, like LC_CTYPE, LC_COLLATE, LC_TIME, etc., chromium supports only one application locale for all localization operations. This CL adds the support of specifying the application locale by LANGUAGE env variable, but doesn't make chromium to support above mentioned behavior of gettext based applications. BUG=21080 : chromium doesn't honor locale fallbacks TEST=Launch chrome with LANGUAGE=br:fr_FR:fr, French locale shall be used by chrome, as br is not supported by chrome yet. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=27608

Patch Set 1 #

Total comments: 9

Patch Set 2 : '' #

Total comments: 8

Patch Set 3 : '' #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -14 lines) Patch
M app/l10n_util.cc View 1 2 4 chunks +62 lines, -13 lines 1 comment Download
M app/l10n_util_unittest.cc View 1 2 3 chunks +28 lines, -1 line 1 comment Download

Messages

Total messages: 14 (0 generated)
James Su
11 years, 3 months ago (2009-09-24 13:15:18 UTC) #1
Evan Martin
What about LANG? (I find this stuff really confusing.) We had a user request being ...
11 years, 3 months ago (2009-09-24 15:20:32 UTC) #2
tony
http://codereview.chromium.org/236001/diff/1/2 File app/l10n_util.cc (right): http://codereview.chromium.org/236001/diff/1/2#newcode390 Line 390: std::vector<std::string> langs; Can we just copy the code ...
11 years, 3 months ago (2009-09-24 18:38:40 UTC) #3
James Su
Thanks for your feedback, please see my comments below. The LC_*/LANG variables are still handled ...
11 years, 3 months ago (2009-09-25 01:39:21 UTC) #4
James Su
On 2009/09/24 15:20:32, Evan Martin wrote: > What about LANG? (I find this stuff really ...
11 years, 3 months ago (2009-09-25 01:51:07 UTC) #5
Evan Martin
Thanks for your thoughtful comments. LGTM
11 years, 3 months ago (2009-09-25 02:03:08 UTC) #6
James Su
I just updated the CL to fix a potential security issue. Regards James Su On ...
11 years, 3 months ago (2009-09-25 02:39:39 UTC) #7
tony
http://codereview.chromium.org/236001/diff/5001/5002 File app/l10n_util.cc (right): http://codereview.chromium.org/236001/diff/5001/5002#newcode400 Line 400: if (i->find_first_of(FilePath::kSeparators) != std::string::npos) Can you add some ...
11 years, 3 months ago (2009-09-25 17:05:29 UTC) #8
jungshik at Google
On 2009/09/25 01:51:07, James Su wrote: > On 2009/09/24 15:20:32, Evan Martin wrote: > > ...
11 years, 3 months ago (2009-09-25 18:04:20 UTC) #9
jungshik at Google
thank you for the cl. http://codereview.chromium.org/236001/diff/5001/5003 File app/l10n_util_unittest.cc (right): http://codereview.chromium.org/236001/diff/5001/5003#newcode157 Line 157: EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L"")); On ...
11 years, 3 months ago (2009-09-25 18:04:48 UTC) #10
jungshik at Google
http://codereview.chromium.org/236001/diff/5001/5003 File app/l10n_util_unittest.cc (right): http://codereview.chromium.org/236001/diff/5001/5003#newcode158 Line 158: In addition to the above, the actual case ...
11 years, 3 months ago (2009-09-25 18:36:05 UTC) #11
James Su
Thanks a lot for your feedback. CL updated. James Su http://codereview.chromium.org/236001/diff/5001/5002 File app/l10n_util.cc (right): http://codereview.chromium.org/236001/diff/5001/5002#newcode400 ...
11 years, 3 months ago (2009-09-26 01:05:37 UTC) #12
tony
LGTM http://codereview.chromium.org/236001/diff/11001/11003 File app/l10n_util_unittest.cc (right): http://codereview.chromium.org/236001/diff/11001/11003#newcode164 Line 164: ::unsetenv("LANGUAGE"); Nit: We should probably cache the ...
11 years, 2 months ago (2009-09-28 17:38:46 UTC) #13
jungshik at Google
11 years, 2 months ago (2009-09-28 18:37:33 UTC) #14
lgtm with the brief comment about gettext's behavior added.

http://codereview.chromium.org/236001/diff/5001/5003
File app/l10n_util_unittest.cc (right):

http://codereview.chromium.org/236001/diff/5001/5003#newcode158
Line 158: 
On 2009/09/26 01:05:37, James Su wrote:
> In real life, 'xx' or 'yy' may exist. But it's ok to use them in this test, as
> only the locales listed in above filenames[] array are valid for this test.

As of today, 'xx' and 'yy' are not assigned to any language (in the future, they
may) :-). Anyway, it doesn't really matter.

> 
> On 2009/09/25 18:36:05, Jungshik Shin wrote:
> > In addition to the above, the actual case mentioned in the bug (Breton at
the
> > beginning of the list) may be useful. It's less robust than using 'xx', 'yy'
> > because one day we may support that language (although not so likely). On
the
> > other hand, it's a real-life example.  
> 
>

http://codereview.chromium.org/236001/diff/11001/11002
File app/l10n_util.cc (right):

http://codereview.chromium.org/236001/diff/11001/11002#newcode461
Line 461: // Only fallback to the system locale if LANGUAGE is not specified.
Can you add a comment that we're emulating gettext's behavior of ignoring
LC_{MESSAGES,ALL}/LANG when LANGUAGE is specified? 
The same comment in the unittest would help, too.

Powered by Google App Engine
This is Rietveld 408576698