OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // limitations under the License. | 4 // limitations under the License. |
5 | 5 |
6 #include "src/i18n.h" | 6 #include "src/i18n.h" |
7 | 7 |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 JSObject::SetProperty( | 150 JSObject::SetProperty( |
151 resolved, factory->intl_pattern_symbol(), | 151 resolved, factory->intl_pattern_symbol(), |
152 factory->NewStringFromTwoByte( | 152 factory->NewStringFromTwoByte( |
153 Vector<const uint16_t>( | 153 Vector<const uint16_t>( |
154 reinterpret_cast<const uint16_t*>(pattern.getBuffer()), | 154 reinterpret_cast<const uint16_t*>(pattern.getBuffer()), |
155 pattern.length())).ToHandleChecked(), | 155 pattern.length())).ToHandleChecked(), |
156 SLOPPY).Assert(); | 156 SLOPPY).Assert(); |
157 | 157 |
158 // Set time zone and calendar. | 158 // Set time zone and calendar. |
159 const icu::Calendar* calendar = date_format->getCalendar(); | 159 const icu::Calendar* calendar = date_format->getCalendar(); |
| 160 // getType() returns legacy calendar type name instead of LDML/BCP47 calendar |
| 161 // key values. i18n.js maps them to BCP47 values for key "ca". |
| 162 // TODO(jshin): Consider doing it here, instead. |
160 const char* calendar_name = calendar->getType(); | 163 const char* calendar_name = calendar->getType(); |
161 JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("calendar"), | 164 JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("calendar"), |
162 factory->NewStringFromAsciiChecked(calendar_name), | 165 factory->NewStringFromAsciiChecked(calendar_name), |
163 SLOPPY).Assert(); | 166 SLOPPY).Assert(); |
164 | 167 |
165 const icu::TimeZone& tz = calendar->getTimeZone(); | 168 const icu::TimeZone& tz = calendar->getTimeZone(); |
166 icu::UnicodeString time_zone; | 169 icu::UnicodeString time_zone; |
167 tz.getID(time_zone); | 170 tz.getID(time_zone); |
168 | 171 |
169 icu::UnicodeString canonical_time_zone; | 172 icu::UnicodeString canonical_time_zone; |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 | 958 |
956 void BreakIterator::DeleteBreakIterator( | 959 void BreakIterator::DeleteBreakIterator( |
957 const v8::WeakCallbackInfo<void>& data) { | 960 const v8::WeakCallbackInfo<void>& data) { |
958 delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0)); | 961 delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0)); |
959 delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1)); | 962 delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1)); |
960 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); | 963 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); |
961 } | 964 } |
962 | 965 |
963 } // namespace internal | 966 } // namespace internal |
964 } // namespace v8 | 967 } // namespace v8 |
OLD | NEW |