OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/spellcheck_common.h" | 5 #include "chrome/common/spellcheck_common.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 | 8 |
9 namespace SpellCheckCommon { | 9 namespace SpellCheckCommon { |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 return input_language; | 67 return input_language; |
68 } | 68 } |
69 | 69 |
70 FilePath GetVersionedFileName(const std::string& input_language, | 70 FilePath GetVersionedFileName(const std::string& input_language, |
71 const FilePath& dict_dir) { | 71 const FilePath& dict_dir) { |
72 // The default dictionary version is 1-2. These versions have been augmented | 72 // The default dictionary version is 1-2. These versions have been augmented |
73 // with additional words found by the translation team. | 73 // with additional words found by the translation team. |
74 static const char kDefaultVersionString[] = "-1-2"; | 74 static const char kDefaultVersionString[] = "-1-2"; |
75 | 75 |
76 // The following dictionaries have either not been augmented with additional | |
77 // words (version 1-1) or have new words, as well as an upgraded dictionary | |
78 // as of Feb 2009 (version 1-3). | |
79 static const struct { | 76 static const struct { |
80 // The language input. | 77 // The language input. |
81 const char* language; | 78 const char* language; |
82 | 79 |
83 // The corresponding version. | 80 // The corresponding version. |
84 const char* version; | 81 const char* version; |
85 } special_version_string[] = { | 82 } special_version_string[] = { |
86 {"en-AU", "-1-1"}, | 83 {"es-ES", "-1-1"}, // 1-1: Have not been augmented with addtional words. |
87 {"en-GB", "-1-1"}, | |
88 {"es-ES", "-1-1"}, | |
89 {"nl-NL", "-1-1"}, | 84 {"nl-NL", "-1-1"}, |
90 {"sv-SE", "-1-1"}, | 85 {"sv-SE", "-1-1"}, |
91 {"he-IL", "-1-1"}, | 86 {"he-IL", "-1-1"}, |
92 {"el-GR", "-1-1"}, | 87 {"el-GR", "-1-1"}, |
93 {"hi-IN", "-1-1"}, | 88 {"hi-IN", "-1-1"}, |
94 {"tr-TR", "-1-1"}, | 89 {"tr-TR", "-1-1"}, |
95 {"et-EE", "-1-1"}, | 90 {"et-EE", "-1-1"}, |
96 {"fr-FR", "-2-0"}, // Hunspell fr(modern) 3.7 + Chromium delta. | 91 {"lt-LT", "-1-3"}, // 1-3 (Feb 2009): new words, as well as an upgraded |
97 {"lt-LT", "-1-3"}, | 92 // dictionary. |
98 {"pl-PL", "-1-3"}, | 93 {"pl-PL", "-1-3"}, |
| 94 {"fr-FR", "-2-0"}, // 2-0 (2010): upgraded dictionaries. |
99 {"hu-HU", "-2-0"}, | 95 {"hu-HU", "-2-0"}, |
100 {"ro-RO", "-2-0"}, | 96 {"ro-RO", "-2-0"}, |
101 {"ru-RU", "-2-0"}, | 97 {"ru-RU", "-2-0"}, |
102 {"bg-BG", "-2-0"}, | 98 {"bg-BG", "-2-0"}, |
103 {"sr", "-2-0"}, | 99 {"sr", "-2-0"}, |
104 {"uk-UA", "-2-0"}, | 100 {"uk-UA", "-2-0"}, |
105 }; | 101 }; |
106 | 102 |
107 // Generate the bdict file name using default version string or special | 103 // Generate the bdict file name using default version string or special |
108 // version string, depending on the language. | 104 // version string, depending on the language. |
109 std::string language = GetSpellCheckLanguageRegion(input_language); | 105 std::string language = GetSpellCheckLanguageRegion(input_language); |
110 std::string versioned_bdict_file_name(language + kDefaultVersionString + | 106 std::string versioned_bdict_file_name(language + kDefaultVersionString + |
111 ".bdic"); | 107 ".bdic"); |
112 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(special_version_string); ++i) { | 108 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(special_version_string); ++i) { |
113 if (language == special_version_string[i].language) { | 109 if (language == special_version_string[i].language) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 std::string language( | 170 std::string language( |
175 g_supported_spellchecker_languages[i].language_region); | 171 g_supported_spellchecker_languages[i].language_region); |
176 if (language == input_language) | 172 if (language == input_language) |
177 return std::string(g_supported_spellchecker_languages[i].language); | 173 return std::string(g_supported_spellchecker_languages[i].language); |
178 } | 174 } |
179 | 175 |
180 return input_language; | 176 return input_language; |
181 } | 177 } |
182 | 178 |
183 } // namespace SpellCheckCommon | 179 } // namespace SpellCheckCommon |
OLD | NEW |