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