diff options
3 files changed, 28 insertions, 15 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index df5d978..7dacea0 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -301,8 +301,8 @@ base::string16 InputMethodUtil::GetInputMethodMediumName( return GetInputMethodShortName(input_method); } -base::string16 InputMethodUtil::GetInputMethodLongName( - const InputMethodDescriptor& input_method) const { +base::string16 InputMethodUtil::GetInputMethodLongNameInternal( + const InputMethodDescriptor& input_method, bool short_name) const { if (!input_method.name().empty() && !IsKeyboardLayout(input_method.id())) { // If the descriptor has a name, use it. return base::UTF8ToUTF16(input_method.name()); @@ -310,25 +310,18 @@ base::string16 InputMethodUtil::GetInputMethodLongName( // We don't show language here. Name of keyboard layout or input method // usually imply (or explicitly include) its language. - // Special case for German, French and Dutch: these languages have multiple // keyboard layouts and share the same layout of keyboard (Belgian). We need - // to show explicitly the language for the layout. For Arabic, Amharic, and - // Indic languages: they share "Standard Input Method". - const base::string16 standard_input_method_text = - delegate_->GetLocalizedString( - IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD); + // to show explicitly the language for the layout. DCHECK(!input_method.language_codes().empty()); const std::string language_code = input_method.language_codes().at(0); - base::string16 text = TranslateString(input_method.id()); - if (text == standard_input_method_text || - language_code == "de" || - language_code == "fr" || - language_code == "nl") { + base::string16 text = (short_name || input_method.name().empty()) + ? TranslateString(input_method.id()) + : base::UTF8ToUTF16(input_method.name()); + if (language_code == "de" || language_code == "fr" || language_code == "nl") { const base::string16 language_name = delegate_->GetDisplayLanguageName( language_code); - text = language_name + base::UTF8ToUTF16(" - ") + text; } @@ -336,6 +329,17 @@ base::string16 InputMethodUtil::GetInputMethodLongName( return text; } + +base::string16 InputMethodUtil::GetInputMethodLongNameStripped( + const InputMethodDescriptor& input_method) const { + return GetInputMethodLongNameInternal(input_method, true /* short_name */); +} + +base::string16 InputMethodUtil::GetInputMethodLongName( + const InputMethodDescriptor& input_method) const { + return GetInputMethodLongNameInternal(input_method, false /* short_name */); +} + const InputMethodDescriptor* InputMethodUtil::GetInputMethodDescriptorFromId( const std::string& input_method_id) const { InputMethodIdToDescriptorMap::const_iterator iter = diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h index 7d31abf4bb..8b3b7d7 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.h +++ b/chrome/browser/chromeos/input_method/input_method_util.h @@ -57,6 +57,8 @@ class InputMethodUtil { const InputMethodDescriptor& input_method) const; base::string16 GetInputMethodMediumName( const InputMethodDescriptor& input_method) const; + base::string16 GetInputMethodLongNameStripped( + const InputMethodDescriptor& input_method) const; base::string16 GetInputMethodLongName( const InputMethodDescriptor& input_method) const; @@ -177,6 +179,12 @@ class InputMethodUtil { bool TranslateStringInternal(const std::string& english_string, base::string16 *out_string) const; + // Get long name of the given input method. |short_name| is to specify whether + // to get the long name for OOBE screen, because OOBE screen displays shorter + // name (e.g. 'US' instead of 'US keyboard'). + base::string16 GetInputMethodLongNameInternal( + const InputMethodDescriptor& input_method, bool short_name) const; + // Map from language code to associated input method IDs, etc. typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc index d71427c..98ef452 100644 --- a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc +++ b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc @@ -47,7 +47,8 @@ scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( const std::string& ime_id = method.id(); scoped_ptr<base::DictionaryValue> input_method(new base::DictionaryValue); input_method->SetString("value", ime_id); - input_method->SetString("title", util->GetInputMethodLongName(method)); + input_method->SetString( + "title", util->GetInputMethodLongNameStripped(method)); input_method->SetBoolean("selected", ime_id == selected); return input_method.Pass(); } |