OLD | NEW |
1 #include <atlbase.h> | 1 #include <atlbase.h> |
2 #include <shlwapi.h> | 2 #include <shlwapi.h> |
3 | 3 |
4 #include <map> | 4 #include <map> |
5 | 5 |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 | 8 |
9 #include "installer_util_strings.h" | 9 #include "installer_util_strings.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 // This method returns the appropriate language offset given the language as a | 68 // This method returns the appropriate language offset given the language as a |
69 // string. Note: This method is not thread safe because of how we create | 69 // string. Note: This method is not thread safe because of how we create |
70 // |offset_map|. | 70 // |offset_map|. |
71 int GetLanguageOffset(const std::wstring& language) { | 71 int GetLanguageOffset(const std::wstring& language) { |
72 static std::map<std::wstring, int> offset_map; | 72 static std::map<std::wstring, int> offset_map; |
73 if (offset_map.empty()) { | 73 if (offset_map.empty()) { |
74 offset_map[L"ar"] = IDS_L10N_OFFSET_AR; | 74 offset_map[L"ar"] = IDS_L10N_OFFSET_AR; |
75 offset_map[L"bg"] = IDS_L10N_OFFSET_BG; | 75 offset_map[L"bg"] = IDS_L10N_OFFSET_BG; |
| 76 offset_map[L"bn"] = IDS_L10N_OFFSET_BN; |
76 offset_map[L"ca"] = IDS_L10N_OFFSET_CA; | 77 offset_map[L"ca"] = IDS_L10N_OFFSET_CA; |
77 offset_map[L"cs"] = IDS_L10N_OFFSET_CS; | 78 offset_map[L"cs"] = IDS_L10N_OFFSET_CS; |
78 offset_map[L"da"] = IDS_L10N_OFFSET_DA; | 79 offset_map[L"da"] = IDS_L10N_OFFSET_DA; |
79 offset_map[L"de"] = IDS_L10N_OFFSET_DE; | 80 offset_map[L"de"] = IDS_L10N_OFFSET_DE; |
80 offset_map[L"el"] = IDS_L10N_OFFSET_EL; | 81 offset_map[L"el"] = IDS_L10N_OFFSET_EL; |
81 offset_map[L"en-gb"] = IDS_L10N_OFFSET_EN_GB; | 82 offset_map[L"en-gb"] = IDS_L10N_OFFSET_EN_GB; |
82 offset_map[L"en-us"] = IDS_L10N_OFFSET_EN_US; | 83 offset_map[L"en-us"] = IDS_L10N_OFFSET_EN_US; |
83 offset_map[L"es"] = IDS_L10N_OFFSET_ES; | 84 offset_map[L"es"] = IDS_L10N_OFFSET_ES; |
84 offset_map[L"es-419"] = IDS_L10N_OFFSET_ES_419; | 85 offset_map[L"es-419"] = IDS_L10N_OFFSET_ES_419; |
85 offset_map[L"et"] = IDS_L10N_OFFSET_ET; | 86 offset_map[L"et"] = IDS_L10N_OFFSET_ET; |
86 offset_map[L"fi"] = IDS_L10N_OFFSET_FI; | 87 offset_map[L"fi"] = IDS_L10N_OFFSET_FI; |
87 offset_map[L"fil"] = IDS_L10N_OFFSET_FIL; | 88 offset_map[L"fil"] = IDS_L10N_OFFSET_FIL; |
88 offset_map[L"fr"] = IDS_L10N_OFFSET_FR; | 89 offset_map[L"fr"] = IDS_L10N_OFFSET_FR; |
| 90 offset_map[L"gu"] = IDS_L10N_OFFSET_GU; |
89 offset_map[L"he"] = IDS_L10N_OFFSET_HE; | 91 offset_map[L"he"] = IDS_L10N_OFFSET_HE; |
90 offset_map[L"hi"] = IDS_L10N_OFFSET_HI; | 92 offset_map[L"hi"] = IDS_L10N_OFFSET_HI; |
91 offset_map[L"hr"] = IDS_L10N_OFFSET_HR; | 93 offset_map[L"hr"] = IDS_L10N_OFFSET_HR; |
92 offset_map[L"hu"] = IDS_L10N_OFFSET_HU; | 94 offset_map[L"hu"] = IDS_L10N_OFFSET_HU; |
93 offset_map[L"id"] = IDS_L10N_OFFSET_ID; | 95 offset_map[L"id"] = IDS_L10N_OFFSET_ID; |
94 offset_map[L"it"] = IDS_L10N_OFFSET_IT; | 96 offset_map[L"it"] = IDS_L10N_OFFSET_IT; |
95 // Google web properties use iw for he. Handle both just to be safe. | 97 // Google web properties use iw for he. Handle both just to be safe. |
96 offset_map[L"iw"] = IDS_L10N_OFFSET_HE; | 98 offset_map[L"iw"] = IDS_L10N_OFFSET_HE; |
97 offset_map[L"ja"] = IDS_L10N_OFFSET_JA; | 99 offset_map[L"ja"] = IDS_L10N_OFFSET_JA; |
| 100 offset_map[L"kn"] = IDS_L10N_OFFSET_KN; |
98 offset_map[L"ko"] = IDS_L10N_OFFSET_KO; | 101 offset_map[L"ko"] = IDS_L10N_OFFSET_KO; |
99 offset_map[L"lt"] = IDS_L10N_OFFSET_LT; | 102 offset_map[L"lt"] = IDS_L10N_OFFSET_LT; |
100 offset_map[L"lv"] = IDS_L10N_OFFSET_LV; | 103 offset_map[L"lv"] = IDS_L10N_OFFSET_LV; |
| 104 offset_map[L"ml"] = IDS_L10N_OFFSET_ML; |
| 105 offset_map[L"mr"] = IDS_L10N_OFFSET_MR; |
101 // Google web properties use no for nb. Handle both just to be safe. | 106 // Google web properties use no for nb. Handle both just to be safe. |
102 offset_map[L"nb"] = IDS_L10N_OFFSET_NO; | 107 offset_map[L"nb"] = IDS_L10N_OFFSET_NO; |
103 offset_map[L"nl"] = IDS_L10N_OFFSET_NL; | 108 offset_map[L"nl"] = IDS_L10N_OFFSET_NL; |
104 offset_map[L"no"] = IDS_L10N_OFFSET_NO; | 109 offset_map[L"no"] = IDS_L10N_OFFSET_NO; |
| 110 offset_map[L"or"] = IDS_L10N_OFFSET_OR; |
105 offset_map[L"pl"] = IDS_L10N_OFFSET_PL; | 111 offset_map[L"pl"] = IDS_L10N_OFFSET_PL; |
106 offset_map[L"pt-br"] = IDS_L10N_OFFSET_PT_BR; | 112 offset_map[L"pt-br"] = IDS_L10N_OFFSET_PT_BR; |
107 offset_map[L"pt-pt"] = IDS_L10N_OFFSET_PT_PT; | 113 offset_map[L"pt-pt"] = IDS_L10N_OFFSET_PT_PT; |
108 offset_map[L"ro"] = IDS_L10N_OFFSET_RO; | 114 offset_map[L"ro"] = IDS_L10N_OFFSET_RO; |
109 offset_map[L"ru"] = IDS_L10N_OFFSET_RU; | 115 offset_map[L"ru"] = IDS_L10N_OFFSET_RU; |
110 offset_map[L"sk"] = IDS_L10N_OFFSET_SK; | 116 offset_map[L"sk"] = IDS_L10N_OFFSET_SK; |
111 offset_map[L"sl"] = IDS_L10N_OFFSET_SL; | 117 offset_map[L"sl"] = IDS_L10N_OFFSET_SL; |
112 offset_map[L"sr"] = IDS_L10N_OFFSET_SR; | 118 offset_map[L"sr"] = IDS_L10N_OFFSET_SR; |
113 offset_map[L"sv"] = IDS_L10N_OFFSET_SV; | 119 offset_map[L"sv"] = IDS_L10N_OFFSET_SV; |
| 120 offset_map[L"ta"] = IDS_L10N_OFFSET_TA; |
| 121 offset_map[L"te"] = IDS_L10N_OFFSET_TE; |
114 offset_map[L"th"] = IDS_L10N_OFFSET_TH; | 122 offset_map[L"th"] = IDS_L10N_OFFSET_TH; |
115 // Some Google web properties use tl for fil. Handle both just to be safe. | 123 // Some Google web properties use tl for fil. Handle both just to be safe. |
116 // They're not completely identical, but alias it here. | 124 // They're not completely identical, but alias it here. |
117 offset_map[L"tl"] = IDS_L10N_OFFSET_FIL; | 125 offset_map[L"tl"] = IDS_L10N_OFFSET_FIL; |
118 offset_map[L"tr"] = IDS_L10N_OFFSET_TR; | 126 offset_map[L"tr"] = IDS_L10N_OFFSET_TR; |
119 offset_map[L"uk"] = IDS_L10N_OFFSET_UK; | 127 offset_map[L"uk"] = IDS_L10N_OFFSET_UK; |
120 offset_map[L"vi"] = IDS_L10N_OFFSET_VI; | 128 offset_map[L"vi"] = IDS_L10N_OFFSET_VI; |
121 offset_map[L"zh-cn"] = IDS_L10N_OFFSET_ZH_CN; | 129 offset_map[L"zh-cn"] = IDS_L10N_OFFSET_ZH_CN; |
122 offset_map[L"zh-tw"] = IDS_L10N_OFFSET_ZH_TW; | 130 offset_map[L"zh-tw"] = IDS_L10N_OFFSET_ZH_TW; |
123 } | 131 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 scoped_ptr<wchar_t> url_canon(new wchar_t[count]); | 185 scoped_ptr<wchar_t> url_canon(new wchar_t[count]); |
178 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), | 186 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), |
179 &count, URL_ESCAPE_UNSAFE); | 187 &count, URL_ESCAPE_UNSAFE); |
180 if (SUCCEEDED(hr)) | 188 if (SUCCEEDED(hr)) |
181 return std::wstring(url_canon.get()); | 189 return std::wstring(url_canon.get()); |
182 return url_path; | 190 return url_path; |
183 } | 191 } |
184 | 192 |
185 } // namespace installer_util | 193 } // namespace installer_util |
186 | 194 |
OLD | NEW |