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

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

Issue 2807035: Adds a unit test for Serbian and Ukranian dictionaries.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | « no previous file | 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) 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 28 matching lines...) Expand all
39 {"lv", "lv-LV"}, 39 {"lv", "lv-LV"},
40 {"nb", "nb-NO"}, 40 {"nb", "nb-NO"},
41 {"nl", "nl-NL"}, 41 {"nl", "nl-NL"},
42 {"pl", "pl-PL"}, 42 {"pl", "pl-PL"},
43 {"pt-BR", "pt-BR"}, 43 {"pt-BR", "pt-BR"},
44 {"pt-PT", "pt-PT"}, 44 {"pt-PT", "pt-PT"},
45 {"ro", "ro-RO"}, 45 {"ro", "ro-RO"},
46 {"ru", "ru-RU"}, 46 {"ru", "ru-RU"},
47 {"sk", "sk-SK"}, 47 {"sk", "sk-SK"},
48 {"sl", "sl-SI"}, 48 {"sl", "sl-SI"},
49 {"sr", "sr"},
49 {"sv", "sv-SE"}, 50 {"sv", "sv-SE"},
50 {"tr", "tr-TR"}, 51 {"tr", "tr-TR"},
52 {"uk", "uk-UA"},
51 {"vi", "vi-VN"}, 53 {"vi", "vi-VN"},
52 }; 54 };
53 55
54 // This function returns the language-region version of language name. 56 // This function returns the language-region version of language name.
55 // e.g. returns hi-IN for hi. 57 // e.g. returns hi-IN for hi.
56 std::string GetSpellCheckLanguageRegion(const std::string& input_language) { 58 std::string GetSpellCheckLanguageRegion(const std::string& input_language) {
57 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(g_supported_spellchecker_languages); 59 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(g_supported_spellchecker_languages);
58 ++i) { 60 ++i) {
59 if (g_supported_spellchecker_languages[i].language == input_language) { 61 if (g_supported_spellchecker_languages[i].language == input_language) {
60 return std::string( 62 return std::string(
(...skipping 30 matching lines...) Expand all
91 {"hi-IN", "-1-1"}, 93 {"hi-IN", "-1-1"},
92 {"tr-TR", "-1-1"}, 94 {"tr-TR", "-1-1"},
93 {"et-EE", "-1-1"}, 95 {"et-EE", "-1-1"},
94 {"fr-FR", "-1-4"}, // To fix a crash, fr dictionary was updated to 1.4. 96 {"fr-FR", "-1-4"}, // To fix a crash, fr dictionary was updated to 1.4.
95 {"lt-LT", "-1-3"}, 97 {"lt-LT", "-1-3"},
96 {"pl-PL", "-1-3"}, 98 {"pl-PL", "-1-3"},
97 {"hu-HU", "-2-0"}, 99 {"hu-HU", "-2-0"},
98 {"ro-RO", "-2-0"}, 100 {"ro-RO", "-2-0"},
99 {"ru-RU", "-2-0"}, 101 {"ru-RU", "-2-0"},
100 {"bg-BG", "-2-0"}, 102 {"bg-BG", "-2-0"},
103 {"sr", "-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) {
110 versioned_bdict_file_name = 114 versioned_bdict_file_name =
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698