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

Issue 7014019: Adding DateTimeFormat class to i18n API. (Closed)

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

Description

Adding DateTimeFormat class to i18n API with following methods: - format - getWeekdays - getMonths - get Eras - getAmPm TEST=Visit i18n.kaziprst.org/datetimeformat.html Committed: http://code.google.com/p/v8/source/detail?r=7967

Patch Set 1 : '' #

Total comments: 1

Patch Set 2 : CHECK -> CHECK_EQ #

Total comments: 15

Patch Set 3 : '' #

Total comments: 4

Patch Set 4 : ReThrow new Date #

Patch Set 5 : Narrow->Abbreviated. Added __ prefix to some private methods. #

Total comments: 12

Patch Set 6 : ascii->utf8. Added narrow and standalone. Added short, medium, long and full to types. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+606 lines, -11 lines) Patch
A src/extensions/experimental/datetime-format.h View 1 2 3 4 5 1 chunk +83 lines, -0 lines 0 comments Download
A src/extensions/experimental/datetime-format.cc View 1 2 3 4 5 1 chunk +381 lines, -0 lines 0 comments Download
M src/extensions/experimental/experimental.gyp View 1 chunk +2 lines, -0 lines 0 comments Download
M src/extensions/experimental/i18n.js View 1 2 3 4 5 7 chunks +98 lines, -11 lines 0 comments Download
M src/extensions/experimental/i18n-extension.cc View 2 chunks +3 lines, -0 lines 0 comments Download
M src/extensions/experimental/i18n-utils.h View 1 2 3 4 5 2 chunks +14 lines, -0 lines 0 comments Download
M src/extensions/experimental/i18n-utils.cc View 1 2 3 4 5 2 chunks +25 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Nebojša Ćirić
http://codereview.chromium.org/7014019/diff/5002/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/5002/src/extensions/experimental/datetime-format.cc#newcode80 src/extensions/experimental/datetime-format.cc:80: ->NumberValue(); Mads: Is this a good way to get ...
9 years, 7 months ago (2011-05-13 18:47:24 UTC) #1
jungshik at Google
http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.h File src/extensions/experimental/datetime-format.h (right): http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.h#newcode37 src/extensions/experimental/datetime-format.h:37: } U_USING_ICU_NAMESPACE is set to 0 for all the ...
9 years, 7 months ago (2011-05-13 23:37:53 UTC) #2
jungshik at Google
BTW, CLDR has 'abbreviated' (e.g. Jan), 'narrow' (e.g. J in English) and 'wide' (e.g. January) ...
9 years, 7 months ago (2011-05-13 23:43:27 UTC) #3
Nebojša Ćirić
I'll take care of the rest on Monday. http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.h File src/extensions/experimental/datetime-format.h (right): http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.h#newcode37 src/extensions/experimental/datetime-format.h:37: } ...
9 years, 7 months ago (2011-05-14 00:11:37 UTC) #4
Mads Ager (chromium)
http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.cc#newcode79 src/extensions/experimental/datetime-format.cc:79: millis = v8::Script::Compile(v8::String::New("eval('new Date()')"))->Run() Since we don't have a ...
9 years, 7 months ago (2011-05-16 07:20:52 UTC) #5
Nebojša Ćirić
http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/8001/src/extensions/experimental/datetime-format.cc#newcode79 src/extensions/experimental/datetime-format.cc:79: millis = v8::Script::Compile(v8::String::New("eval('new Date()')"))->Run() On 2011/05/16 07:20:52, Mads Ager ...
9 years, 7 months ago (2011-05-17 20:40:37 UTC) #6
Mads Ager (chromium)
Bindings part LGTM http://codereview.chromium.org/7014019/diff/10001/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/10001/src/extensions/experimental/datetime-format.cc#newcode84 src/extensions/experimental/datetime-format.cc:84: return v8::ThrowException(v8::Exception::Error( In case of an ...
9 years, 7 months ago (2011-05-18 05:36:35 UTC) #7
Nebojša Ćirić
http://codereview.chromium.org/7014019/diff/10001/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/10001/src/extensions/experimental/datetime-format.cc#newcode84 src/extensions/experimental/datetime-format.cc:84: return v8::ThrowException(v8::Exception::Error( Re-throwing is what I wanted to do. ...
9 years, 7 months ago (2011-05-18 17:50:12 UTC) #8
jungshik at Google
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental/datetime-format.cc#newcode113 src/extensions/experimental/datetime-format.cc:113: const icu::UnicodeString* wide = symbols->getMonths(wide_count); Again, how about 'narrow'? ...
9 years, 7 months ago (2011-05-19 18:24:05 UTC) #9
Nebojša Ćirić
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental/datetime-format.cc File src/extensions/experimental/datetime-format.cc (right): http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental/datetime-format.cc#newcode113 src/extensions/experimental/datetime-format.cc:113: const icu::UnicodeString* wide = symbols->getMonths(wide_count); Narrow was not part ...
9 years, 7 months ago (2011-05-19 20:44:41 UTC) #10
jungshik at Google
9 years, 7 months ago (2011-05-19 21:00:34 UTC) #11
LGTM !!

On 2011/05/19 20:44:41, Nebojša Ćirić wrote:
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> File src/extensions/experimental/datetime-format.cc (right):
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> src/extensions/experimental/datetime-format.cc:113: const icu::UnicodeString*
> wide = symbols->getMonths(wide_count);
> Narrow was not part of the proposed standard, but I added support for it
(now).
> 
> Switched to getMonths(, DtContext...) methods.
> 
> On 2011/05/19 18:24:05, Jungshik Shin wrote:
> > Again, how about 'narrow'? 
> > 
> > More importantly, using getMonths/getShortMonths method, you're returning
> month
> > names of 'context = format' instead of 'context=stand-alone'. (see the ICU
> > source code ( i18n/dtfmtsym.cpp). ICU documentation needs to make it clear.
> I've
> > filed a bug against ICU ( http://bugs.icu-project.org/trac/ticket/8587)
> > 
> > Please, use a version of getMonths accepting 'context' and 'width' : 
> > 
> > getMonths(int32_t & 	count, DtContextType 	context, DtWidthType) 
> > 
> > The same is true of GetWeekDays
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> src/extensions/experimental/datetime-format.cc:265: icu::UnicodeString
short_dt
> = icu::UnicodeString::fromUTF8("short");
> I support all types now. We should state in proposal that those names should
be
> reserved.
> 
> Also, I don't really like , -1, US_INV part of that method. It's not readable
> vs. fromUTF8. It's gone anyways.
> 
> On 2011/05/19 18:24:05, Jungshik Shin wrote:
> > short_dt("short", -1, US_INV);
> > 
> > 
> > is more succinct. 
> > 
> > BTW, wouldn't you just go ahead to support all the types - full, long,
medium
> > and short ?  Perhaps, those not yet standardized can have "v8" prefixes.
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> File src/extensions/experimental/datetime-format.h (right):
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> src/extensions/experimental/datetime-format.h:60: // Get list of months -
narrow
> or wide format.
> On 2011/05/19 18:24:05, Jungshik Shin wrote:
> > In LDML, there are 3 widths for month and weekday names : wide, abbreviated
> and
> > narrow and 2 contexts, format and stand-alone.
> > 
> > ( http://unicode.org/reports/tr35/#Calendar_Elements )
> > 
> >  So, it'd better be made clear that what this function returns is 
> > 
> > stand-alone month names with the width of either abbreviated or wide.
> > 
> > BTW, we don't want to support stand-alone narrow names? 
> > 
> > Narrow names can be useful when you have a small amount of space for menu or
> > checkbox/radio buttons. 
> > 
> > I think it's a good idea to follow the terminology/convention of LDML. 
> > 
> > The same is true of other lists below.
> 
> Done.
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> File src/extensions/experimental/i18n-utils.cc (right):
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> src/extensions/experimental/i18n-utils.cc:60: v8::String::AsciiValue
> ascii_value(value);
> I made it Ut8Value.
> 
> On 2011/05/19 18:24:05, Jungshik Shin wrote:
> > JFYI: For now, all the settings have ASCII values, but if we add 'pattern'
> > (v8pattern) to DateTimeFormatter, 'value' can be non-ASCII, too.
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> File src/extensions/experimental/i18n-utils.h (right):
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> src/extensions/experimental/i18n-utils.h:36: class SimpleDateFormat;
> On 2011/05/19 18:24:05, Jungshik Shin wrote:
> > You don't need to forward-declare SimpleDateFormat here, do you? 
> >  
> 
> Done.
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> File src/extensions/experimental/i18n.js (right):
> 
>
http://codereview.chromium.org/7014019/diff/12007/src/extensions/experimental...
> src/extensions/experimental/i18n.js:162: var dt =
> settings['dateType'].toLowerCase();
> On 2011/05/19 18:24:05, Jungshik Shin wrote:
> > hmm.... I don't think it's a good idea to call toLowerCase() here. V8's
> > toLowerCase is ok as it is now for this use case, but ....
> > 
> > 
> >  I'd rather not accept anything but 'long', 'short' and 'v8full',
'v8medium')
> > because I don't see any reason to be lenient for dateType values. 
> 
> Done.

Powered by Google App Engine
This is Rietveld 408576698