Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: chrome/installer/util/language_selector.cc

Issue 8488006: Add some language aliases to track changes to base/ui/l10n_util.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed bad macau alias Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/installer/util/language_selector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 Hong Kong and Macau 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 },
67 // Windows uses "mo" for Macau.
68 { L"zh-mo", IDS_L10N_OFFSET_ZH_TW }, 73 { L"zh-mo", IDS_L10N_OFFSET_ZH_TW },
69 // Although the wildcard entry for zh would result in this, alias zh-sg so 74 // 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. 75 // that it will win if it precedes another valid tag in a list of candidates.
71 { L"zh-sg", IDS_L10N_OFFSET_ZH_CN } 76 { L"zh-sg", IDS_L10N_OFFSET_ZH_CN }
72 #else // defined(GOOGLE_CHROME_BUILD) 77 #else // defined(GOOGLE_CHROME_BUILD)
73 // An empty array is no good, so repeat the fallback. 78 // An empty array is no good, so repeat the fallback.
74 { &kFallbackLanguage[0], kFallbackLanguageOffset } 79 { &kFallbackLanguage[0], kFallbackLanguageOffset }
75 #endif // !defined(GOOGLE_CHROME_BUILD) 80 #endif // !defined(GOOGLE_CHROME_BUILD)
76 }; 81 };
77 82
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 VLOG(1) << "No suitable language found for any candidates."; 297 VLOG(1) << "No suitable language found for any candidates.";
293 298
294 // Our fallback is "en-us" 299 // Our fallback is "en-us"
295 matched_candidate_.assign(&kFallbackLanguage[0], 300 matched_candidate_.assign(&kFallbackLanguage[0],
296 arraysize(kFallbackLanguage) - 1); 301 arraysize(kFallbackLanguage) - 1);
297 offset_ = kFallbackLanguageOffset; 302 offset_ = kFallbackLanguageOffset;
298 } 303 }
299 } 304 }
300 305
301 } // namespace installer 306 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/util/language_selector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698