| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/common/extensions/extension_l10n_util.h" | 5 #include "chrome/common/extensions/extension_l10n_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const std::string& locale_name, | 158 const std::string& locale_name, |
| 159 std::set<std::string>* valid_locales, | 159 std::set<std::string>* valid_locales, |
| 160 std::string* error) { | 160 std::string* error) { |
| 161 // Accept name that starts with a . but don't add it to the list of supported | 161 // Accept name that starts with a . but don't add it to the list of supported |
| 162 // locales. | 162 // locales. |
| 163 if (locale_name.find(".") == 0) | 163 if (locale_name.find(".") == 0) |
| 164 return true; | 164 return true; |
| 165 if (chrome_locales.find(locale_name) == chrome_locales.end()) { | 165 if (chrome_locales.find(locale_name) == chrome_locales.end()) { |
| 166 // Warn if there is an extension locale that's not in the Chrome list, | 166 // Warn if there is an extension locale that's not in the Chrome list, |
| 167 // but don't fail. | 167 // but don't fail. |
| 168 LOG(WARNING) << base::StringPrintf("Supplied locale %s is not supported.", | 168 DLOG(WARNING) << base::StringPrintf("Supplied locale %s is not supported.", |
| 169 locale_name.c_str()); | 169 locale_name.c_str()); |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 // Check if messages file is actually present (but don't check content). | 172 // Check if messages file is actually present (but don't check content). |
| 173 if (file_util::PathExists( | 173 if (file_util::PathExists( |
| 174 locale_folder.Append(Extension::kMessagesFilename))) { | 174 locale_folder.Append(Extension::kMessagesFilename))) { |
| 175 valid_locales->insert(locale_name); | 175 valid_locales->insert(locale_name); |
| 176 } else { | 176 } else { |
| 177 *error = base::StringPrintf("Catalog file is missing for locale %s.", | 177 *error = base::StringPrintf("Catalog file is missing for locale %s.", |
| 178 locale_name.c_str()); | 178 locale_name.c_str()); |
| 179 return false; | 179 return false; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 if (std::find(subdir.begin(), subdir.end(), '.') != subdir.end()) | 306 if (std::find(subdir.begin(), subdir.end(), '.') != subdir.end()) |
| 307 return true; | 307 return true; |
| 308 | 308 |
| 309 if (all_locales.find(subdir) == all_locales.end()) | 309 if (all_locales.find(subdir) == all_locales.end()) |
| 310 return true; | 310 return true; |
| 311 | 311 |
| 312 return false; | 312 return false; |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace extension_l10n_util | 315 } // namespace extension_l10n_util |
| OLD | NEW |