Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file defines a helper class for selecting a supported language from a | 5 // This file defines a helper class for selecting a supported language from a |
| 6 // set of candidates. | 6 // set of candidates. |
| 7 | 7 |
| 8 #include "chrome/installer/util/language_selector.h" | 8 #include "chrome/installer/util/language_selector.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 #undef HANDLE_LANGUAGE | 41 #undef HANDLE_LANGUAGE |
| 42 #else // defined(GOOGLE_CHROME_BUILD) | 42 #else // defined(GOOGLE_CHROME_BUILD) |
| 43 { &kFallbackLanguage[0], kFallbackLanguageOffset } | 43 { &kFallbackLanguage[0], kFallbackLanguageOffset } |
| 44 #endif // !defined(GOOGLE_CHROME_BUILD) | 44 #endif // !defined(GOOGLE_CHROME_BUILD) |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // A sorted array of language identifiers that are aliases to other languages | 47 // A sorted array of language identifiers that are aliases to other languages |
| 48 // for which translations are available. | 48 // for which translations are available. |
| 49 const LangToOffset kLanguageToOffsetExceptions[] = { | 49 const LangToOffset kLanguageToOffsetExceptions[] = { |
| 50 #if defined(GOOGLE_CHROME_BUILD) | 50 #if defined(GOOGLE_CHROME_BUILD) |
| 51 // Alias some English variants to British English (all others wildcard to US). | |
| 52 { L"en-au", IDS_L10N_OFFSET_EN_GB }, | |
| 53 { L"en-ca", IDS_L10N_OFFSET_EN_GB }, | |
| 54 { L"en-nz", IDS_L10N_OFFSET_EN_GB }, | |
| 55 { L"en-za", IDS_L10N_OFFSET_EN_GB }, | |
| 56 // Alias es-es to es (all others wildcard to es-419). | |
| 57 { L"es-es", IDS_L10N_OFFSET_ES }, | |
| 51 // Google web properties use iw for he. Handle both just to be safe. | 58 // Google web properties use iw for he. Handle both just to be safe. |
| 52 { L"he", IDS_L10N_OFFSET_IW }, | 59 { L"he", IDS_L10N_OFFSET_IW }, |
| 53 // Google web properties use no for nb. Handle both just to be safe. | 60 // Google web properties use no for nb. Handle both just to be safe. |
| 54 { L"nb", IDS_L10N_OFFSET_NO }, | 61 { L"nb", IDS_L10N_OFFSET_NO }, |
| 55 // Some Google web properties use tl for fil. Handle both just to be safe. | 62 // Some Google web properties use tl for fil. Handle both just to be safe. |
| 56 // They're not completely identical, but alias it here. | 63 // They're not completely identical, but alias it here. |
| 57 { L"tl", IDS_L10N_OFFSET_FIL }, | 64 { L"tl", IDS_L10N_OFFSET_FIL }, |
| 58 // Pre-Vista aliases for Chinese w/ script subtag. | 65 // Pre-Vista aliases for Chinese w/ script subtag. |
| 59 { L"zh-chs", IDS_L10N_OFFSET_ZH_CN }, | 66 { L"zh-chs", IDS_L10N_OFFSET_ZH_CN }, |
| 60 { L"zh-cht", IDS_L10N_OFFSET_ZH_TW }, | 67 { L"zh-cht", IDS_L10N_OFFSET_ZH_TW }, |
| 61 // Vista+ aliases for Chinese w/ script subtag. | 68 // Vista+ aliases for Chinese w/ script subtag. |
| 62 { L"zh-hans", IDS_L10N_OFFSET_ZH_CN }, | 69 { L"zh-hans", IDS_L10N_OFFSET_ZH_CN }, |
| 63 { L"zh-hant", IDS_L10N_OFFSET_ZH_TW }, | 70 { L"zh-hant", IDS_L10N_OFFSET_ZH_TW }, |
| 64 // Alias Macau and Hong Kong to Taiwan. | 71 // Alias Macau and Hong Kong to Taiwan. |
| 65 { L"zh-hk", IDS_L10N_OFFSET_ZH_TW }, | 72 { L"zh-hk", IDS_L10N_OFFSET_ZH_TW }, |
| 66 { L"zh-mk", IDS_L10N_OFFSET_ZH_TW }, | 73 { L"zh-mk", IDS_L10N_OFFSET_ZH_TW }, |
|
jungshik at Google
2011/11/29 23:35:54
I think this line came from my 'typo' in l10n_util
grt (UTC plus 2)
2011/12/01 14:31:11
Thanks for spotting that. Done.
| |
| 67 // Windows uses "mo" for Macau. | 74 // Windows uses "mo" for Macau. |
| 68 { L"zh-mo", IDS_L10N_OFFSET_ZH_TW }, | 75 { L"zh-mo", IDS_L10N_OFFSET_ZH_TW }, |
| 69 // Although the wildcard entry for zh would result in this, alias zh-sg so | 76 // Although the wildcard entry for zh would result in this, alias zh-sg so |
| 70 // that it will win if it precedes another valid tag in a list of candidates. | 77 // that it will win if it precedes another valid tag in a list of candidates. |
| 71 { L"zh-sg", IDS_L10N_OFFSET_ZH_CN } | 78 { L"zh-sg", IDS_L10N_OFFSET_ZH_CN } |
| 72 #else // defined(GOOGLE_CHROME_BUILD) | 79 #else // defined(GOOGLE_CHROME_BUILD) |
| 73 // An empty array is no good, so repeat the fallback. | 80 // An empty array is no good, so repeat the fallback. |
| 74 { &kFallbackLanguage[0], kFallbackLanguageOffset } | 81 { &kFallbackLanguage[0], kFallbackLanguageOffset } |
| 75 #endif // !defined(GOOGLE_CHROME_BUILD) | 82 #endif // !defined(GOOGLE_CHROME_BUILD) |
| 76 }; | 83 }; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 VLOG(1) << "No suitable language found for any candidates."; | 299 VLOG(1) << "No suitable language found for any candidates."; |
| 293 | 300 |
| 294 // Our fallback is "en-us" | 301 // Our fallback is "en-us" |
| 295 matched_candidate_.assign(&kFallbackLanguage[0], | 302 matched_candidate_.assign(&kFallbackLanguage[0], |
| 296 arraysize(kFallbackLanguage) - 1); | 303 arraysize(kFallbackLanguage) - 1); |
| 297 offset_ = kFallbackLanguageOffset; | 304 offset_ = kFallbackLanguageOffset; |
| 298 } | 305 } |
| 299 } | 306 } |
| 300 | 307 |
| 301 } // namespace installer | 308 } // namespace installer |
| OLD | NEW |