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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return normalized_locale; | 50 return normalized_locale; |
51 return normalized_locale.Left(separator_position); | 51 return normalized_locale.Left(separator_position); |
52 } | 52 } |
53 | 53 |
54 static RetainPtr<NSLocale> DetermineLocale(const String& locale) { | 54 static RetainPtr<NSLocale> DetermineLocale(const String& locale) { |
55 if (!LayoutTestSupport::IsRunningLayoutTest()) { | 55 if (!LayoutTestSupport::IsRunningLayoutTest()) { |
56 RetainPtr<NSLocale> current_locale = [NSLocale currentLocale]; | 56 RetainPtr<NSLocale> current_locale = [NSLocale currentLocale]; |
57 String current_locale_language = | 57 String current_locale_language = |
58 LanguageFromLocale(String([current_locale.Get() localeIdentifier])); | 58 LanguageFromLocale(String([current_locale.Get() localeIdentifier])); |
59 String locale_language = LanguageFromLocale(locale); | 59 String locale_language = LanguageFromLocale(locale); |
60 if (EqualIgnoringCase(current_locale_language, locale_language)) | 60 if (DeprecatedEqualIgnoringCase(current_locale_language, locale_language)) |
61 return current_locale; | 61 return current_locale; |
62 } | 62 } |
63 // It seems initWithLocaleIdentifier accepts dash-separated locale identifier. | 63 // It seems initWithLocaleIdentifier accepts dash-separated locale identifier. |
64 return RetainPtr<NSLocale>( | 64 return RetainPtr<NSLocale>( |
65 kAdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:locale]); | 65 kAdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:locale]); |
66 } | 66 } |
67 | 67 |
68 std::unique_ptr<Locale> Locale::Create(const String& locale) { | 68 std::unique_ptr<Locale> Locale::Create(const String& locale) { |
69 return LocaleMac::Create(DetermineLocale(locale).Get()); | 69 return LocaleMac::Create(DetermineLocale(locale).Get()); |
70 } | 70 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 ASSERT(symbols.size() == kDecimalSymbolsSize); | 323 ASSERT(symbols.size() == kDecimalSymbolsSize); |
324 | 324 |
325 String positive_prefix([formatter.Get() positivePrefix]); | 325 String positive_prefix([formatter.Get() positivePrefix]); |
326 String positive_suffix([formatter.Get() positiveSuffix]); | 326 String positive_suffix([formatter.Get() positiveSuffix]); |
327 String negative_prefix([formatter.Get() negativePrefix]); | 327 String negative_prefix([formatter.Get() negativePrefix]); |
328 String negative_suffix([formatter.Get() negativeSuffix]); | 328 String negative_suffix([formatter.Get() negativeSuffix]); |
329 SetLocaleData(symbols, positive_prefix, positive_suffix, negative_prefix, | 329 SetLocaleData(symbols, positive_prefix, positive_suffix, negative_prefix, |
330 negative_suffix); | 330 negative_suffix); |
331 } | 331 } |
332 } | 332 } |
OLD | NEW |