OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/chromeos/dom_ui/language_pinyin_options_handler.h" | 5 #include "chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/dom_ui/language_options_util.h" |
9 #include "chrome/browser/chromeos/language_preferences.h" | 10 #include "chrome/browser/chromeos/language_preferences.h" |
10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
11 | 12 |
| 13 // TODO(kochi): Add prefix for each language (e.g. "Pinyin") for each i18n |
| 14 // identifier. |
| 15 |
12 LanguagePinyinOptionsHandler::LanguagePinyinOptionsHandler() { | 16 LanguagePinyinOptionsHandler::LanguagePinyinOptionsHandler() { |
13 } | 17 } |
14 | 18 |
15 LanguagePinyinOptionsHandler::~LanguagePinyinOptionsHandler() { | 19 LanguagePinyinOptionsHandler::~LanguagePinyinOptionsHandler() { |
16 } | 20 } |
17 | 21 |
18 void LanguagePinyinOptionsHandler::GetLocalizedValues( | 22 void LanguagePinyinOptionsHandler::GetLocalizedValues( |
19 DictionaryValue* localized_strings) { | 23 DictionaryValue* localized_strings) { |
20 DCHECK(localized_strings); | 24 DCHECK(localized_strings); |
21 // Language Pinyin page - ChromeOS | 25 // Language Pinyin page - ChromeOS |
| 26 for (size_t i = 0; i < chromeos::kNumPinyinBooleanPrefs; ++i) { |
| 27 localized_strings->SetString( |
| 28 GetI18nContentValue(chromeos::kPinyinBooleanPrefs[i]), |
| 29 l10n_util::GetString(chromeos::kPinyinBooleanPrefs[i].message_id)); |
| 30 } |
| 31 |
| 32 localized_strings->SetString( |
| 33 GetI18nContentValue(chromeos::kPinyinDoublePinyinSchema), |
| 34 l10n_util::GetString( |
| 35 chromeos::kPinyinDoublePinyinSchema.label_message_id)); |
| 36 ListValue* list_value = new ListValue(); |
| 37 for (size_t i = 0; |
| 38 i < chromeos::LanguageMultipleChoicePreference<int>::kMaxItems; |
| 39 ++i) { |
| 40 if (chromeos::kPinyinDoublePinyinSchema.values_and_ids[i]. |
| 41 item_message_id == 0) |
| 42 break; |
| 43 ListValue* option = new ListValue(); |
| 44 option->Append(Value::CreateIntegerValue( |
| 45 chromeos::kPinyinDoublePinyinSchema.values_and_ids[i]. |
| 46 ibus_config_value)); |
| 47 option->Append(Value::CreateStringValue(l10n_util::GetString( |
| 48 chromeos::kPinyinDoublePinyinSchema.values_and_ids[i]. |
| 49 item_message_id))); |
| 50 list_value->Append(option); |
| 51 } |
| 52 localized_strings->Set( |
| 53 GetTemplateDataPropertyName(chromeos::kPinyinDoublePinyinSchema), |
| 54 list_value); |
22 } | 55 } |
OLD | NEW |