| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if ([array count] == 12) { | 122 if ([array count] == 12) { |
| 123 for (unsigned i = 0; i < 12; ++i) | 123 for (unsigned i = 0; i < 12; ++i) |
| 124 m_monthLabels.append(String([array objectAtIndex:i])); | 124 m_monthLabels.append(String([array objectAtIndex:i])); |
| 125 return m_monthLabels; | 125 return m_monthLabels; |
| 126 } | 126 } |
| 127 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) | 127 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) |
| 128 m_monthLabels.append(WTF::monthFullName[i]); | 128 m_monthLabels.append(WTF::monthFullName[i]); |
| 129 return m_monthLabels; | 129 return m_monthLabels; |
| 130 } | 130 } |
| 131 | 131 |
| 132 #if ENABLE(CALENDAR_PICKER) | |
| 133 const Vector<String>& LocaleMac::weekDayShortLabels() | 132 const Vector<String>& LocaleMac::weekDayShortLabels() |
| 134 { | 133 { |
| 135 if (!m_weekDayShortLabels.isEmpty()) | 134 if (!m_weekDayShortLabels.isEmpty()) |
| 136 return m_weekDayShortLabels; | 135 return m_weekDayShortLabels; |
| 137 m_weekDayShortLabels.reserveCapacity(7); | 136 m_weekDayShortLabels.reserveCapacity(7); |
| 138 NSArray *array = [shortDateFormatter().get() shortWeekdaySymbols]; | 137 NSArray *array = [shortDateFormatter().get() shortWeekdaySymbols]; |
| 139 if ([array count] == 7) { | 138 if ([array count] == 7) { |
| 140 for (unsigned i = 0; i < 7; ++i) | 139 for (unsigned i = 0; i < 7; ++i) |
| 141 m_weekDayShortLabels.append(String([array objectAtIndex:i])); | 140 m_weekDayShortLabels.append(String([array objectAtIndex:i])); |
| 142 return m_weekDayShortLabels; | 141 return m_weekDayShortLabels; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 153 // The document for NSCalendar - firstWeekday doesn't have an explanation of | 152 // The document for NSCalendar - firstWeekday doesn't have an explanation of |
| 154 // firstWeekday value. We can guess it by the document of NSDateComponents - | 153 // firstWeekday value. We can guess it by the document of NSDateComponents - |
| 155 // weekDay, so it can be 1 through 7 and 1 is Sunday. | 154 // weekDay, so it can be 1 through 7 and 1 is Sunday. |
| 156 return [m_gregorianCalendar.get() firstWeekday] - 1; | 155 return [m_gregorianCalendar.get() firstWeekday] - 1; |
| 157 } | 156 } |
| 158 | 157 |
| 159 bool LocaleMac::isRTL() | 158 bool LocaleMac::isRTL() |
| 160 { | 159 { |
| 161 return NSLocaleLanguageDirectionRightToLeft == [NSLocale characterDirectionF
orLanguage:[NSLocale canonicalLanguageIdentifierFromString:[m_locale.get() local
eIdentifier]]]; | 160 return NSLocaleLanguageDirectionRightToLeft == [NSLocale characterDirectionF
orLanguage:[NSLocale canonicalLanguageIdentifierFromString:[m_locale.get() local
eIdentifier]]]; |
| 162 } | 161 } |
| 163 #endif | |
| 164 | 162 |
| 165 RetainPtr<NSDateFormatter> LocaleMac::timeFormatter() | 163 RetainPtr<NSDateFormatter> LocaleMac::timeFormatter() |
| 166 { | 164 { |
| 167 return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NS
DateFormatterNoStyle, NSDateFormatterMediumStyle); | 165 return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NS
DateFormatterNoStyle, NSDateFormatterMediumStyle); |
| 168 } | 166 } |
| 169 | 167 |
| 170 RetainPtr<NSDateFormatter> LocaleMac::shortTimeFormatter() | 168 RetainPtr<NSDateFormatter> LocaleMac::shortTimeFormatter() |
| 171 { | 169 { |
| 172 return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NS
DateFormatterNoStyle, NSDateFormatterShortStyle); | 170 return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NS
DateFormatterNoStyle, NSDateFormatterShortStyle); |
| 173 } | 171 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ASSERT(symbols.size() == DecimalSymbolsSize); | 320 ASSERT(symbols.size() == DecimalSymbolsSize); |
| 323 | 321 |
| 324 String positivePrefix([formatter.get() positivePrefix]); | 322 String positivePrefix([formatter.get() positivePrefix]); |
| 325 String positiveSuffix([formatter.get() positiveSuffix]); | 323 String positiveSuffix([formatter.get() positiveSuffix]); |
| 326 String negativePrefix([formatter.get() negativePrefix]); | 324 String negativePrefix([formatter.get() negativePrefix]); |
| 327 String negativeSuffix([formatter.get() negativeSuffix]); | 325 String negativeSuffix([formatter.get() negativeSuffix]); |
| 328 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negat
iveSuffix); | 326 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negat
iveSuffix); |
| 329 } | 327 } |
| 330 | 328 |
| 331 } | 329 } |
| OLD | NEW |