| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/options2/chromeos/language_pinyin_handler.h" | |
| 6 | |
| 7 #include "base/values.h" | |
| 8 #include "chrome/browser/chromeos/language_preferences.h" | |
| 9 #include "chrome/browser/ui/webui/options2/chromeos/language_options_util.h" | |
| 10 #include "grit/generated_resources.h" | |
| 11 #include "ui/base/l10n/l10n_util.h" | |
| 12 | |
| 13 namespace { | |
| 14 const char kI18nPrefix[] = "Pinyin"; | |
| 15 } // namespace | |
| 16 | |
| 17 namespace chromeos { | |
| 18 | |
| 19 LanguagePinyinHandler::LanguagePinyinHandler() { | |
| 20 } | |
| 21 | |
| 22 LanguagePinyinHandler::~LanguagePinyinHandler() { | |
| 23 } | |
| 24 | |
| 25 void LanguagePinyinHandler::GetLocalizedValues( | |
| 26 DictionaryValue* localized_strings) { | |
| 27 DCHECK(localized_strings); | |
| 28 | |
| 29 RegisterTitle(localized_strings, "languagePinyinPage", | |
| 30 IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTINGS_TITLE); | |
| 31 | |
| 32 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { | |
| 33 localized_strings->SetString( | |
| 34 GetI18nContentValue(language_prefs::kPinyinBooleanPrefs[i], | |
| 35 kI18nPrefix), | |
| 36 l10n_util::GetStringUTF16( | |
| 37 language_prefs::kPinyinBooleanPrefs[i].message_id)); | |
| 38 } | |
| 39 | |
| 40 localized_strings->SetString( | |
| 41 GetI18nContentValue(language_prefs::kPinyinDoublePinyinSchema, | |
| 42 kI18nPrefix), | |
| 43 l10n_util::GetStringUTF16( | |
| 44 language_prefs::kPinyinDoublePinyinSchema.label_message_id)); | |
| 45 ListValue* list_value = new ListValue(); | |
| 46 for (size_t i = 0; | |
| 47 i < language_prefs::LanguageMultipleChoicePreference<int>::kMaxItems; | |
| 48 ++i) { | |
| 49 if (language_prefs::kPinyinDoublePinyinSchema.values_and_ids[i]. | |
| 50 item_message_id == 0) | |
| 51 break; | |
| 52 ListValue* option = new ListValue(); | |
| 53 option->Append(Value::CreateIntegerValue( | |
| 54 language_prefs::kPinyinDoublePinyinSchema.values_and_ids[i]. | |
| 55 ibus_config_value)); | |
| 56 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( | |
| 57 language_prefs::kPinyinDoublePinyinSchema.values_and_ids[i]. | |
| 58 item_message_id))); | |
| 59 list_value->Append(option); | |
| 60 } | |
| 61 localized_strings->Set( | |
| 62 GetTemplateDataPropertyName(language_prefs::kPinyinDoublePinyinSchema, | |
| 63 kI18nPrefix), | |
| 64 list_value); | |
| 65 } | |
| 66 | |
| 67 } // namespace chromeos | |
| OLD | NEW |