| OLD | NEW |
| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 static const LanguageRegion g_supported_spellchecker_languages[] = { | 31 static const LanguageRegion g_supported_spellchecker_languages[] = { |
| 32 // Several languages are not to be included in the spellchecker list: | 32 // Several languages are not to be included in the spellchecker list: |
| 33 // th-TH, vi-VI. | 33 // th-TH, vi-VI. |
| 34 {"af", "af-ZA"}, | 34 {"af", "af-ZA"}, |
| 35 {"bg", "bg-BG"}, | 35 {"bg", "bg-BG"}, |
| 36 {"ca", "ca-ES"}, | 36 {"ca", "ca-ES"}, |
| 37 {"cs", "cs-CZ"}, | 37 {"cs", "cs-CZ"}, |
| 38 {"da", "da-DK"}, | 38 {"da", "da-DK"}, |
| 39 {"de", "de-DE"}, | 39 {"de", "de-DE"}, |
| 40 {"el", "el-GR"}, | 40 {"el", "el-GR"}, |
| 41 {"en-AU", "en-AU"}, | 41 {"en-AU", "en-GB"}, |
| 42 {"en-CA", "en-CA"}, | 42 {"en-CA", "en-CA"}, |
| 43 {"en-GB", "en-GB"}, | 43 {"en-GB", "en-GB"}, |
| 44 {"en-US", "en-US"}, | 44 {"en-US", "en-US"}, |
| 45 {"es", "es-ES"}, | 45 {"es", "es-ES"}, |
| 46 {"et", "et-EE"}, | 46 {"et", "et-EE"}, |
| 47 {"fa", "fa-IR"}, |
| 47 {"fo", "fo-FO"}, | 48 {"fo", "fo-FO"}, |
| 48 {"fr", "fr-FR"}, | 49 {"fr", "fr-FR"}, |
| 49 {"he", "he-IL"}, | 50 {"he", "he-IL"}, |
| 50 {"hi", "hi-IN"}, | 51 {"hi", "hi-IN"}, |
| 51 {"hr", "hr-HR"}, | 52 {"hr", "hr-HR"}, |
| 52 {"hu", "hu-HU"}, | 53 {"hu", "hu-HU"}, |
| 53 {"id", "id-ID"}, | 54 {"id", "id-ID"}, |
| 54 {"it", "it-IT"}, | 55 {"it", "it-IT"}, |
| 55 {"ko", "ko"}, | 56 {"ko", "ko"}, |
| 56 {"lt", "lt-LT"}, | 57 {"lt", "lt-LT"}, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 // Add non-default version strings here. Use the same version for all the | 108 // Add non-default version strings here. Use the same version for all the |
| 108 // dictionaries that you add at the same time. Increment the major version | 109 // dictionaries that you add at the same time. Increment the major version |
| 109 // number if you're updating either dic or aff files. Increment the minor | 110 // number if you're updating either dic or aff files. Increment the minor |
| 110 // version number if you're updating only dic_delta files. | 111 // version number if you're updating only dic_delta files. |
| 111 static LanguageVersion special_version_string[] = { | 112 static LanguageVersion special_version_string[] = { |
| 112 {"tr-TR", "-4-0"}, // Jan 9, 2013: Add "FLAG num" to aff to avoid heapcheck | 113 {"tr-TR", "-4-0"}, // Jan 9, 2013: Add "FLAG num" to aff to avoid heapcheck |
| 113 // crash. | 114 // crash. |
| 114 {"tg-TG", "-5-0"}, // Mar 4, 2014: Add Tajik dictionary. | 115 {"tg-TG", "-5-0"}, // Mar 4, 2014: Add Tajik dictionary. |
| 115 | 116 |
| 116 // Oct 28, 2014: Update from upstream, add new words. | 117 // March 2016: Update from upstream |
| 117 {"en-AU", "-4-0"}, | 118 {"en-AU", "-7-0"}, |
| 118 {"en-GB", "-4-0"}, | 119 {"en-CA", "-7-0"}, |
| 120 {"en-GB", "-7-0"}, |
| 121 {"en-US", "-7-0"}, |
| 119 | 122 |
| 120 // March 10, 2015: Update from upstream, enable typographical apostrophe. | 123 // March 2016: Initial check-in of Persian |
| 121 {"en-CA", "-6-1"}, | 124 {"fa-IR", "-7-0"}, |
| 122 {"en-US", "-6-1"}, | |
| 123 }; | 125 }; |
| 124 | 126 |
| 125 // Generate the bdict file name using default version string or special | 127 // Generate the bdict file name using default version string or special |
| 126 // version string, depending on the language. | 128 // version string, depending on the language. |
| 127 std::string language = GetSpellCheckLanguageRegion(input_language); | 129 std::string language = GetSpellCheckLanguageRegion(input_language); |
| 128 std::string versioned_bdict_file_name(language + kDefaultVersionString + | 130 std::string versioned_bdict_file_name(language + kDefaultVersionString + |
| 129 ".bdic"); | 131 ".bdic"); |
| 130 for (size_t i = 0; i < arraysize(special_version_string); ++i) { | 132 for (size_t i = 0; i < arraysize(special_version_string); ++i) { |
| 131 if (language == special_version_string[i].language) { | 133 if (language == special_version_string[i].language) { |
| 132 versioned_bdict_file_name = | 134 versioned_bdict_file_name = |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 error = U_ZERO_ERROR; | 182 error = U_ZERO_ERROR; |
| 181 uloc_getLanguage(id, language, arraysize(language), &error); | 183 uloc_getLanguage(id, language, arraysize(language), &error); |
| 182 country = uloc_getISO3Country(id); | 184 country = uloc_getISO3Country(id); |
| 183 } | 185 } |
| 184 *language_code = std::string(language); | 186 *language_code = std::string(language); |
| 185 *country_code = std::string(country); | 187 *country_code = std::string(country); |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace spellcheck_common | 190 } // namespace spellcheck_common |
| 189 } // namespace chrome | 191 } // namespace chrome |
| OLD | NEW |