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

Issue 6901141: Change v8Locale to match proposal - constructor is different and I've added (Closed)

Created:
9 years, 7 months ago by Nebojša Ćirić
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Change v8Locale to match proposal - constructor is different (takes settings object, not a plain string) and I've added derive method to it. Added comments to i18n.js methods and properties, and util functions to check settings and locale validity. Added LanguageMatcher class until ICU gets C implementation (in progress, but late for our current deadline). I added TODO to remove LanguageMatcher code. TEST=Visit http://i18n.kaziprst.org/locale.html. Committed: http://code.google.com/p/v8/source/detail?r=7768

Patch Set 1 #

Patch Set 2 : strcpy->snprintf #

Total comments: 46

Patch Set 3 : snprintf->OS::SNPrintF + Jungshik's comments #

Patch Set 4 : VS found two compile problems. Fixed #

Total comments: 12

Patch Set 5 : Final cleanup #

Unified diffs Side-by-side diffs Delta from patch set Stats (+522 lines, -189 lines) Patch
M src/extensions/experimental/experimental.gyp View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M src/extensions/experimental/i18n.js View 1 2 2 chunks +119 lines, -55 lines 0 comments Download
M src/extensions/experimental/i18n-extension.cc View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
M src/extensions/experimental/i18n-locale.h View 1 2 3 1 chunk +14 lines, -7 lines 0 comments Download
M src/extensions/experimental/i18n-locale.cc View 1 2 3 4 1 chunk +53 lines, -113 lines 0 comments Download
A src/extensions/experimental/language-matcher.h View 1 2 3 4 1 chunk +95 lines, -0 lines 0 comments Download
A src/extensions/experimental/language-matcher.cc View 1 2 3 4 1 chunk +239 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Nebojša Ćirić
9 years, 7 months ago (2011-04-30 00:40:51 UTC) #1
Mads Ager (chromium)
Bindings part LGTM
9 years, 7 months ago (2011-05-02 07:54:40 UTC) #2
jungshik at Google
looks good overall, but need some minor fixes noted below. http://codereview.chromium.org/6901141/diff/11/src/extensions/experimental/i18n-locale.cc File src/extensions/experimental/i18n-locale.cc (right): http://codereview.chromium.org/6901141/diff/11/src/extensions/experimental/i18n-locale.cc#newcode89 ...
9 years, 7 months ago (2011-05-02 19:57:23 UTC) #3
jungshik at Google
http://codereview.chromium.org/6901141/diff/11/src/extensions/experimental/i18n-locale.cc File src/extensions/experimental/i18n-locale.cc (right): http://codereview.chromium.org/6901141/diff/11/src/extensions/experimental/i18n-locale.cc#newcode61 src/extensions/experimental/i18n-locale.cc:61: } else if (locale_id->IsString()) { perhaps, ASCII-ness has to ...
9 years, 7 months ago (2011-05-02 20:00:14 UTC) #4
Nebojša Ćirić
All done. Also snprintf didn't look like it would work cross platform so I used ...
9 years, 7 months ago (2011-05-02 22:44:01 UTC) #5
jungshik at Google
LGTM with minor changes below. http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental/i18n-locale.cc File src/extensions/experimental/i18n-locale.cc (right): http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental/i18n-locale.cc#newcode77 src/extensions/experimental/i18n-locale.cc:77: GetBestMatchForRegionID(result.icu_id, region, region_id); shouldn't ...
9 years, 7 months ago (2011-05-03 20:04:04 UTC) #6
jungshik at Google
LGTM with minor changes below.
9 years, 7 months ago (2011-05-03 20:05:08 UTC) #7
Nebojša Ćirić
9 years, 7 months ago (2011-05-03 20:38:59 UTC) #8
http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
File src/extensions/experimental/i18n-locale.cc (right):

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
src/extensions/experimental/i18n-locale.cc:77:
GetBestMatchForRegionID(result.icu_id, region, region_id);
I've assigned empty string to region id in case of failure.

On 2011/05/03 20:04:05, Jungshik Shin wrote:
> shouldn't you act on the return value here? If failed, perhaps return
Undefined
> or leave region_id empty?

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
src/extensions/experimental/i18n-locale.cc:94: "%s", user_locale.getCountry());
On 2011/05/03 20:04:05, Jungshik Shin wrote:
> nit: 'return true' here and get rid of "else" below? 

Done.

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
File src/extensions/experimental/language-matcher.cc (right):

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
src/extensions/experimental/language-matcher.cc:94:
CompareToSupportedLocaleIDList(locale_id->ToString(), &match);
On 2011/05/03 20:04:05, Jungshik Shin wrote:
> Perhaps, you can check the return value and skip if it's a failure. 

Done.

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
src/extensions/experimental/language-matcher.cc:116: }
On 2011/05/03 20:04:05, Jungshik Shin wrote:
> How about this? 
> 
> if (CompareToSupportedLocaleIDList(...) && match.score >= kThresold)  ... 
> 

Done.

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
src/extensions/experimental/language-matcher.cc:124: // with little data.
DateFormat variant returns well populated Locales only.
On 2011/05/03 20:04:05, Jungshik Shin wrote:
> The above comment is specific to Chrome's ICU build.  Perhaps, this is better:
> 
> Depending on how ICU data is built, locales returned by
> Locale::getAvailableLocale() are not guaranteed to support  DateFormat,
> Collation and other services.  We can call getAvailableLocale() of all the
> services we want to support and take the intersection of them all, but using
> DateFormat::getAvailableLocales() can do in practice. 

Done.

http://codereview.chromium.org/6901141/diff/11001/src/extensions/experimental...
src/extensions/experimental/language-matcher.cc:171: input_locale.getName(),
result);
On 2011/05/03 20:04:05, Jungshik Shin wrote:
> If we just want to throw away the return value, there's no point of returning
a
> boolean, no?  
> Perhaps, you can change the above to 
> 
> return BuildLocaleName(.....); 
> 
> Then, a caller can decide what to do. see above.

Done.

Powered by Google App Engine
This is Rietveld 408576698