Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/translate/language_detection_util.h" | 5 #include "chrome/common/translate/language_detection_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 #if !defined(CLD_VERSION) || CLD_VERSION==1 | 147 #if !defined(CLD_VERSION) || CLD_VERSION==1 |
| 148 case 1: | 148 case 1: |
| 149 language = | 149 language = |
| 150 LanguageCodeWithDialects(static_cast<Language>(cld_language)); | 150 LanguageCodeWithDialects(static_cast<Language>(cld_language)); |
| 151 break; | 151 break; |
| 152 #endif | 152 #endif |
| 153 #if !defined(CLD_VERSION) || CLD_VERSION==2 | 153 #if !defined(CLD_VERSION) || CLD_VERSION==2 |
| 154 case 2: | 154 case 2: |
| 155 if (cld_language == CLD2::CHINESE) { | 155 if (cld_language == CLD2::CHINESE) { |
| 156 language = "zh-CN"; | 156 language = "zh-CN"; |
| 157 } else if (cld_language == CLD2::CHINESE_T) { | |
| 158 language = "zh-TW"; | |
|
Takashi Toyoshima
2013/10/01 06:20:17
Do you have any reason to handle them as special c
hajimehoshi
2013/10/02 01:13:25
We decided not to update CLD2 for this. I'll add
| |
| 157 } else { | 159 } else { |
| 158 language = | 160 language = |
| 159 CLD2::LanguageCode(static_cast<CLD2::Language>(cld_language)); | 161 CLD2::LanguageCode(static_cast<CLD2::Language>(cld_language)); |
| 160 } | 162 } |
| 161 break; | 163 break; |
| 162 #endif | 164 #endif |
| 163 default: | 165 default: |
| 164 NOTREACHED(); | 166 NOTREACHED(); |
| 165 } | 167 } |
| 166 } | 168 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 case 2: | 374 case 2: |
| 373 return CLD2::DetectLanguageVersion(); | 375 return CLD2::DetectLanguageVersion(); |
| 374 #endif | 376 #endif |
| 375 default: | 377 default: |
| 376 NOTREACHED(); | 378 NOTREACHED(); |
| 377 } | 379 } |
| 378 return ""; | 380 return ""; |
| 379 } | 381 } |
| 380 | 382 |
| 381 } // namespace LanguageDetectionUtil | 383 } // namespace LanguageDetectionUtil |
| OLD | NEW |