OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Whether the default settings for the locale should be used, ignoring user
overrides. | 153 // Whether the default settings for the locale should be used, ignoring user
overrides. |
154 bool defaultsForLocale = isRunningLayoutTest(); | 154 bool defaultsForLocale = isRunningLayoutTest(); |
155 return LocaleWin::create(LCIDFromLocale(locale, defaultsForLocale), defaults
ForLocale); | 155 return LocaleWin::create(LCIDFromLocale(locale, defaultsForLocale), defaults
ForLocale); |
156 } | 156 } |
157 | 157 |
158 inline LocaleWin::LocaleWin(LCID lcid, bool defaultsForLocale) | 158 inline LocaleWin::LocaleWin(LCID lcid, bool defaultsForLocale) |
159 : m_lcid(lcid) | 159 : m_lcid(lcid) |
160 , m_didInitializeNumberData(false) | 160 , m_didInitializeNumberData(false) |
161 , m_defaultsForLocale(defaultsForLocale) | 161 , m_defaultsForLocale(defaultsForLocale) |
162 { | 162 { |
163 #if ENABLE(CALENDAR_PICKER) | |
164 DWORD value = 0; | 163 DWORD value = 0; |
165 getLocaleInfo(LOCALE_IFIRSTDAYOFWEEK | (defaultsForLocale ? LOCALE_NOUSEROVE
RRIDE : 0), value); | 164 getLocaleInfo(LOCALE_IFIRSTDAYOFWEEK | (defaultsForLocale ? LOCALE_NOUSEROVE
RRIDE : 0), value); |
166 // 0:Monday, ..., 6:Sunday. | 165 // 0:Monday, ..., 6:Sunday. |
167 // We need 1 for Monday, 0 for Sunday. | 166 // We need 1 for Monday, 0 for Sunday. |
168 m_firstDayOfWeek = (value + 1) % 7; | 167 m_firstDayOfWeek = (value + 1) % 7; |
169 #endif | |
170 } | 168 } |
171 | 169 |
172 PassOwnPtr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale) | 170 PassOwnPtr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale) |
173 { | 171 { |
174 return adoptPtr(new LocaleWin(lcid, defaultsForLocale)); | 172 return adoptPtr(new LocaleWin(lcid, defaultsForLocale)); |
175 } | 173 } |
176 | 174 |
177 LocaleWin::~LocaleWin() | 175 LocaleWin::~LocaleWin() |
178 { | 176 { |
179 } | 177 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 386 } |
389 } | 387 } |
390 } | 388 } |
391 | 389 |
392 const Vector<String>& LocaleWin::monthLabels() | 390 const Vector<String>& LocaleWin::monthLabels() |
393 { | 391 { |
394 ensureMonthLabels(); | 392 ensureMonthLabels(); |
395 return m_monthLabels; | 393 return m_monthLabels; |
396 } | 394 } |
397 | 395 |
398 #if ENABLE(CALENDAR_PICKER) | |
399 const Vector<String>& LocaleWin::weekDayShortLabels() | 396 const Vector<String>& LocaleWin::weekDayShortLabels() |
400 { | 397 { |
401 ensureWeekDayShortLabels(); | 398 ensureWeekDayShortLabels(); |
402 return m_weekDayShortLabels; | 399 return m_weekDayShortLabels; |
403 } | 400 } |
404 | 401 |
405 unsigned LocaleWin::firstDayOfWeek() | 402 unsigned LocaleWin::firstDayOfWeek() |
406 { | 403 { |
407 return m_firstDayOfWeek; | 404 return m_firstDayOfWeek; |
408 } | 405 } |
409 | 406 |
410 bool LocaleWin::isRTL() | 407 bool LocaleWin::isRTL() |
411 { | 408 { |
412 WTF::Unicode::Direction dir = WTF::Unicode::direction(monthLabels()[0][0]); | 409 WTF::Unicode::Direction dir = WTF::Unicode::direction(monthLabels()[0][0]); |
413 return dir == WTF::Unicode::RightToLeft || dir == WTF::Unicode::RightToLeftA
rabic; | 410 return dir == WTF::Unicode::RightToLeft || dir == WTF::Unicode::RightToLeftA
rabic; |
414 } | 411 } |
415 #endif | |
416 | 412 |
417 String LocaleWin::dateFormat() | 413 String LocaleWin::dateFormat() |
418 { | 414 { |
419 if (m_dateFormat.isNull()) | 415 if (m_dateFormat.isNull()) |
420 m_dateFormat = convertWindowsDateTimeFormat(getLocaleInfoString(LOCALE_S
SHORTDATE)); | 416 m_dateFormat = convertWindowsDateTimeFormat(getLocaleInfoString(LOCALE_S
SHORTDATE)); |
421 return m_dateFormat; | 417 return m_dateFormat; |
422 } | 418 } |
423 | 419 |
424 String LocaleWin::dateFormat(const String& windowsFormat) | 420 String LocaleWin::dateFormat(const String& windowsFormat) |
425 { | 421 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 case NegativeFormatSignPrefix: // Fall through. | 578 case NegativeFormatSignPrefix: // Fall through. |
583 default: | 579 default: |
584 negativePrefix = negativeSign; | 580 negativePrefix = negativeSign; |
585 break; | 581 break; |
586 } | 582 } |
587 m_didInitializeNumberData = true; | 583 m_didInitializeNumberData = true; |
588 setLocaleData(symbols, emptyString(), emptyString(), negativePrefix, negativ
eSuffix); | 584 setLocaleData(symbols, emptyString(), emptyString(), negativePrefix, negativ
eSuffix); |
589 } | 585 } |
590 | 586 |
591 } | 587 } |
OLD | NEW |