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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 { | 57 { |
58 RetainPtr<NSLocale> currentLocale = [NSLocale currentLocale]; | 58 RetainPtr<NSLocale> currentLocale = [NSLocale currentLocale]; |
59 String currentLocaleLanguage = languageFromLocale(String([currentLocale.get(
) localeIdentifier])); | 59 String currentLocaleLanguage = languageFromLocale(String([currentLocale.get(
) localeIdentifier])); |
60 String localeLanguage = languageFromLocale(locale); | 60 String localeLanguage = languageFromLocale(locale); |
61 if (equalIgnoringCase(currentLocaleLanguage, localeLanguage)) | 61 if (equalIgnoringCase(currentLocaleLanguage, localeLanguage)) |
62 return currentLocale; | 62 return currentLocale; |
63 // It seems initWithLocaleIdentifier accepts dash-separated locale identifie
r. | 63 // It seems initWithLocaleIdentifier accepts dash-separated locale identifie
r. |
64 return RetainPtr<NSLocale>(AdoptNS, [[NSLocale alloc] initWithLocaleIdentif
ier:locale]); | 64 return RetainPtr<NSLocale>(AdoptNS, [[NSLocale alloc] initWithLocaleIdentif
ier:locale]); |
65 } | 65 } |
66 | 66 |
67 PassOwnPtr<Locale> Locale::create(const AtomicString& locale) | 67 PassOwnPtr<Locale> Locale::create(const String& locale) |
68 { | 68 { |
69 return LocaleMac::create(determineLocale(locale.string()).get()); | 69 return LocaleMac::create(determineLocale(locale).get()); |
70 } | 70 } |
71 | 71 |
72 static RetainPtr<NSDateFormatter> createDateTimeFormatter(NSLocale* locale, NSCa
lendar* calendar, NSDateFormatterStyle dateStyle, NSDateFormatterStyle timeStyle
) | 72 static RetainPtr<NSDateFormatter> createDateTimeFormatter(NSLocale* locale, NSCa
lendar* calendar, NSDateFormatterStyle dateStyle, NSDateFormatterStyle timeStyle
) |
73 { | 73 { |
74 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | 74 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; |
75 [formatter setLocale:locale]; | 75 [formatter setLocale:locale]; |
76 [formatter setDateStyle:dateStyle]; | 76 [formatter setDateStyle:dateStyle]; |
77 [formatter setTimeStyle:timeStyle]; | 77 [formatter setTimeStyle:timeStyle]; |
78 [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; | 78 [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; |
79 [formatter setCalendar:calendar]; | 79 [formatter setCalendar:calendar]; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 ASSERT(symbols.size() == DecimalSymbolsSize); | 320 ASSERT(symbols.size() == DecimalSymbolsSize); |
321 | 321 |
322 String positivePrefix([formatter.get() positivePrefix]); | 322 String positivePrefix([formatter.get() positivePrefix]); |
323 String positiveSuffix([formatter.get() positiveSuffix]); | 323 String positiveSuffix([formatter.get() positiveSuffix]); |
324 String negativePrefix([formatter.get() negativePrefix]); | 324 String negativePrefix([formatter.get() negativePrefix]); |
325 String negativeSuffix([formatter.get() negativeSuffix]); | 325 String negativeSuffix([formatter.get() negativeSuffix]); |
326 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negat
iveSuffix); | 326 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negat
iveSuffix); |
327 } | 327 } |
328 | 328 |
329 } | 329 } |
OLD | NEW |