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

Side by Side Diff: chrome/common/spellcheck_common.cc

Issue 11566003: Bump dictionary versions to 3-0 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix android compile Created 7 years, 12 months 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
« no previous file with comments | « DEPS ('k') | chrome/renderer/spellchecker/spellcheck_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 chrome { 9 namespace chrome {
10 namespace spellcheck_common { 10 namespace spellcheck_common {
11 11
12 struct LanguageRegion { 12 struct LanguageRegion {
13 const char* language; // The language. 13 const char* language; // The language.
14 const char* language_region; // language & region, used by dictionaries. 14 const char* language_region; // language & region, used by dictionaries.
15 }; 15 };
16 16
17 struct LanguageVersion { 17 struct LanguageVersion {
18 const char* language; // The language input. 18 const char* language; // The language input.
19 const char* version; // The corresponding version. 19 const char* version; // The corresponding version.
20 }; 20 };
21 21
22 static const LanguageRegion g_supported_spellchecker_languages[] = { 22 static const LanguageRegion g_supported_spellchecker_languages[] = {
23 // Several languages are not to be included in the spellchecker list: 23 // Several languages are not to be included in the spellchecker list:
24 // th-TH 24 // th-TH, vi-VI.
25 {"af", "af-ZA"}, 25 {"af", "af-ZA"},
26 {"bg", "bg-BG"}, 26 {"bg", "bg-BG"},
27 {"ca", "ca-ES"}, 27 {"ca", "ca-ES"},
28 {"cs", "cs-CZ"}, 28 {"cs", "cs-CZ"},
29 {"da", "da-DK"}, 29 {"da", "da-DK"},
30 {"de", "de-DE"}, 30 {"de", "de-DE"},
31 {"el", "el-GR"}, 31 {"el", "el-GR"},
32 {"en-AU", "en-AU"}, 32 {"en-AU", "en-AU"},
33 {"en-CA", "en-CA"}, 33 {"en-CA", "en-CA"},
34 {"en-GB", "en-GB"}, 34 {"en-GB", "en-GB"},
35 {"en-US", "en-US"}, 35 {"en-US", "en-US"},
36 {"es", "es-ES"}, 36 {"es", "es-ES"},
37 {"et", "et-EE"}, 37 {"et", "et-EE"},
38 {"fo", "fo-FO"}, 38 {"fo", "fo-FO"},
39 {"fr", "fr-FR"}, 39 {"fr", "fr-FR"},
40 {"he", "he-IL"}, 40 {"he", "he-IL"},
41 {"hi", "hi-IN"}, 41 {"hi", "hi-IN"},
42 {"hr", "hr-HR"}, 42 {"hr", "hr-HR"},
43 {"hu", "hu-HU"}, 43 {"hu", "hu-HU"},
44 {"id", "id-ID"}, 44 {"id", "id-ID"},
45 {"it", "it-IT"}, 45 {"it", "it-IT"},
46 {"ko", "ko"},
46 {"lt", "lt-LT"}, 47 {"lt", "lt-LT"},
47 {"lv", "lv-LV"}, 48 {"lv", "lv-LV"},
48 {"nb", "nb-NO"}, 49 {"nb", "nb-NO"},
49 {"nl", "nl-NL"}, 50 {"nl", "nl-NL"},
50 {"pl", "pl-PL"}, 51 {"pl", "pl-PL"},
51 {"pt-BR", "pt-BR"}, 52 {"pt-BR", "pt-BR"},
52 {"pt-PT", "pt-PT"}, 53 {"pt-PT", "pt-PT"},
53 {"ro", "ro-RO"}, 54 {"ro", "ro-RO"},
54 {"ru", "ru-RU"}, 55 {"ru", "ru-RU"},
56 {"sh", "sh"},
55 {"sk", "sk-SK"}, 57 {"sk", "sk-SK"},
56 {"sl", "sl-SI"}, 58 {"sl", "sl-SI"},
57 {"sh", "sh"}, 59 {"sq", "sq"},
58 {"sr", "sr"}, 60 {"sr", "sr"},
59 {"sv", "sv-SE"}, 61 {"sv", "sv-SE"},
62 {"ta", "ta-IN"},
60 {"tr", "tr-TR"}, 63 {"tr", "tr-TR"},
61 {"uk", "uk-UA"}, 64 {"uk", "uk-UA"},
62 {"vi", "vi-VN"}, 65 {"vi", "vi-VN"},
63 }; 66 };
64 67
65 bool IsValidRegion(const std::string& region) { 68 bool IsValidRegion(const std::string& region) {
66 for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages); 69 for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages);
67 ++i) { 70 ++i) {
68 if (g_supported_spellchecker_languages[i].language_region == region) 71 if (g_supported_spellchecker_languages[i].language_region == region)
69 return true; 72 return true;
(...skipping 10 matching lines...) Expand all
80 return std::string( 83 return std::string(
81 g_supported_spellchecker_languages[i].language_region); 84 g_supported_spellchecker_languages[i].language_region);
82 } 85 }
83 } 86 }
84 87
85 return input_language; 88 return input_language;
86 } 89 }
87 90
88 FilePath GetVersionedFileName(const std::string& input_language, 91 FilePath GetVersionedFileName(const std::string& input_language,
89 const FilePath& dict_dir) { 92 const FilePath& dict_dir) {
90 // The default dictionary version is 1-2. These versions have been augmented 93 // The default dictionary version is 3-0. This version indicates that the bdic
91 // with additional words found by the translation team. 94 // file contains a checksum.
92 static const char kDefaultVersionString[] = "-1-2"; 95 static const char kDefaultVersionString[] = "-3-0";
93 96
97 // Add non-default version strings here. Use the same version for all the
98 // dictionaries that you add at the same time. Increment the major version
99 // number if you're updating either dic or aff files. Increment the minor
100 // version number if you're updating only dic_delta files.
94 static LanguageVersion special_version_string[] = { 101 static LanguageVersion special_version_string[] = {
95 {"es-ES", "-1-1"}, // 1-1: Have not been augmented with addtional words. 102 {"et-EE", "-1-1"}, // No dic/aff files
96 {"nl-NL", "-1-1"}, 103 {"tr-TR", "-1-1"}, // No dic/aff files
97 {"sv-SE", "-1-1"},
98 {"he-IL", "-1-1"},
99 {"el-GR", "-1-1"},
100 {"hi-IN", "-1-1"},
101 {"tr-TR", "-1-1"},
102 {"et-EE", "-1-1"},
103 {"lt-LT", "-1-3"}, // 1-3 (Feb 2009): new words, as well as an upgraded
104 // dictionary.
105 {"pl-PL", "-1-3"},
106 {"fr-FR", "-2-0"}, // 2-0 (2010): upgraded dictionaries.
107 {"hu-HU", "-2-0"},
108 {"ro-RO", "-2-0"},
109 {"ru-RU", "-2-0"},
110 {"bg-BG", "-2-0"},
111 {"sr", "-2-0"},
112 {"uk-UA", "-2-0"},
113 {"pt-BR", "-2-2"}, // 2-2 (Mar 2011): upgraded a dictionary.
114 {"sh", "-2-2"}, // 2-2 (Mar 2011): added a dictionary.
115 {"ca-ES", "-2-3"}, // 2-3 (May 2012): upgraded a dictionary.
116 {"sv-SE", "-2-3"}, // 2-3 (May 2012): upgraded a dictionary.
117 {"af-ZA", "-2-3"}, // 2-3 (May 2012): added a dictionary.
118 {"fo-FO", "-2-3"}, // 2-3 (May 2012): added a dictionary.
119 {"en-US", "-2-4"}, // 2-4 (October 2012): add more words.
120 {"en-CA", "-2-4"},
121 {"en-GB", "-2-5"}, // 2-5 (Nov 2012): Added NOSUGGEST flag = !.
122 {"en-AU", "-2-5"}, // Marked 1 word in each.
123
124 }; 104 };
125 105
126 // Generate the bdict file name using default version string or special 106 // Generate the bdict file name using default version string or special
127 // version string, depending on the language. 107 // version string, depending on the language.
128 std::string language = GetSpellCheckLanguageRegion(input_language); 108 std::string language = GetSpellCheckLanguageRegion(input_language);
129 std::string versioned_bdict_file_name(language + kDefaultVersionString + 109 std::string versioned_bdict_file_name(language + kDefaultVersionString +
130 ".bdic"); 110 ".bdic");
131 for (size_t i = 0; i < arraysize(special_version_string); ++i) { 111 for (size_t i = 0; i < arraysize(special_version_string); ++i) {
132 if (language == special_version_string[i].language) { 112 if (language == special_version_string[i].language) {
133 versioned_bdict_file_name = 113 versioned_bdict_file_name =
(...skipping 28 matching lines...) Expand all
162 142
163 void SpellCheckLanguages(std::vector<std::string>* languages) { 143 void SpellCheckLanguages(std::vector<std::string>* languages) {
164 for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages); 144 for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages);
165 ++i) { 145 ++i) {
166 languages->push_back(g_supported_spellchecker_languages[i].language); 146 languages->push_back(g_supported_spellchecker_languages[i].language);
167 } 147 }
168 } 148 }
169 149
170 } // namespace spellcheck_common 150 } // namespace spellcheck_common
171 } // namespace chrome 151 } // namespace chrome
OLDNEW
« no previous file with comments | « DEPS ('k') | chrome/renderer/spellchecker/spellcheck_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698