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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return adoptNS(formatter); | 83 return adoptNS(formatter); |
84 } | 84 } |
85 | 85 |
86 LocaleMac::LocaleMac(NSLocale* locale) | 86 LocaleMac::LocaleMac(NSLocale* locale) |
87 : m_locale(locale), | 87 : m_locale(locale), |
88 m_gregorianCalendar( | 88 m_gregorianCalendar( |
89 AdoptNS, | 89 AdoptNS, |
90 [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]), | 90 [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]), |
91 m_didInitializeNumberData(false) { | 91 m_didInitializeNumberData(false) { |
92 NSArray* availableLanguages = [NSLocale ISOLanguageCodes]; | 92 NSArray* availableLanguages = [NSLocale ISOLanguageCodes]; |
93 // NSLocale returns a lower case NSLocaleLanguageCode so we don't have care ab
out case. | 93 // NSLocale returns a lower case NSLocaleLanguageCode so we don't have care |
| 94 // about case. |
94 NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode]; | 95 NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode]; |
95 if ([availableLanguages indexOfObject:language] == NSNotFound) | 96 if ([availableLanguages indexOfObject:language] == NSNotFound) |
96 m_locale.adoptNS( | 97 m_locale.adoptNS( |
97 [[NSLocale alloc] initWithLocaleIdentifier:defaultLanguage()]); | 98 [[NSLocale alloc] initWithLocaleIdentifier:defaultLanguage()]); |
98 [m_gregorianCalendar.get() setLocale:m_locale.get()]; | 99 [m_gregorianCalendar.get() setLocale:m_locale.get()]; |
99 } | 100 } |
100 | 101 |
101 LocaleMac::~LocaleMac() {} | 102 LocaleMac::~LocaleMac() {} |
102 | 103 |
103 std::unique_ptr<LocaleMac> LocaleMac::create(const String& localeIdentifier) { | 104 std::unique_ptr<LocaleMac> LocaleMac::create(const String& localeIdentifier) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 ASSERT(symbols.size() == DecimalSymbolsSize); | 323 ASSERT(symbols.size() == DecimalSymbolsSize); |
323 | 324 |
324 String positivePrefix([formatter.get() positivePrefix]); | 325 String positivePrefix([formatter.get() positivePrefix]); |
325 String positiveSuffix([formatter.get() positiveSuffix]); | 326 String positiveSuffix([formatter.get() positiveSuffix]); |
326 String negativePrefix([formatter.get() negativePrefix]); | 327 String negativePrefix([formatter.get() negativePrefix]); |
327 String negativeSuffix([formatter.get() negativeSuffix]); | 328 String negativeSuffix([formatter.get() negativeSuffix]); |
328 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, | 329 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, |
329 negativeSuffix); | 330 negativeSuffix); |
330 } | 331 } |
331 } | 332 } |
OLD | NEW |