diff options
author | Achuith Bhandarkar <achuith@chromium.org> | 2015-07-17 13:28:39 -0700 |
---|---|---|
committer | Achuith Bhandarkar <achuith@chromium.org> | 2015-07-17 20:30:36 +0000 |
commit | c69cb2449dae1c16a56c1fb247ac238377a32bca (patch) | |
tree | 0092c07dc5a6dc463ed3568d6b8310cb571a106e | |
parent | c1b1be7368e63c462266c3819648a2ade25d26fe (diff) | |
download | chromium_src-c69cb2449dae1c16a56c1fb247ac238377a32bca.zip chromium_src-c69cb2449dae1c16a56c1fb247ac238377a32bca.tar.gz chromium_src-c69cb2449dae1c16a56c1fb247ac238377a32bca.tar.bz2 |
This removes some hard-coded device-type strings.
This change depends on https://codereview.chromium.org/1206063002/.
BUG=341356
R=achuith@chromium.org, mgiuca@chromium.org
Review URL: https://codereview.chromium.org/1176673002 .
Cr-Commit-Position: refs/heads/master@{#339319}
-rw-r--r-- | chrome/app/generated_resources.grd | 15 | ||||
-rw-r--r-- | chrome/browser/extensions/api/hotword_private/hotword_private_api.cc | 33 |
2 files changed, 35 insertions, 13 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index b3aa99e..b380a0b 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -15560,7 +15560,10 @@ After you create a new supervised user, you can manage their settings at any tim This option disables support in Cast Streaming for encoding video streams using platform hardware. </message> - <!-- Hotword Audio Verification (opt-in) App strings. --> + <!-- Hotword Audio Verification (opt-in) App strings. --> + <message name="IDS_HOTWORD_BROWSER_NAME" desc="Name of the device when we're not running in CrOS"> + <ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chromium</ex></ph> browser + </message> <message name="IDS_HOTWORD_OPT_IN_CLOSE" desc="Label for the close button for the 'Ok Google' hotword opt-in dialog."> Close </message> @@ -15574,10 +15577,10 @@ After you create a new supervised user, you can manage their settings at any tim Say "Ok Google" when your screen is on and unlocked </message> <message name="IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION" desc="Description explaining the steps required to continue through the hotword opt-in process."> - To make this happen, you'll need to enable Voice & Audio Activity and train your Chromebook in the following steps. + To make this happen, you'll need to enable Voice & Audio Activity and train your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> in the following steps. </message> <message name="IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION_AUDIO_HISTORY_ENABLED" desc="Description explaining the steps required to continue through the hotword opt-in process."> - To make this happen, you'll need to train your Chromebook in the following step. + To make this happen, you'll need to train your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> in the following step. </message> <message name="IDS_HOTWORD_OPT_IN_INTRO_START" desc="Text on the start button for the 'Ok Google' hotword opt-in dialog."> Get Started @@ -15604,10 +15607,10 @@ After you create a new supervised user, you can manage their settings at any tim Something went wrong. Please try again. </message> <message name="IDS_HOTWORD_OPT_IN_TRAINING_TITLE" desc="Title of the voice model training page of the 'Ok Google' hotword opt-in dialog."> - Let's train your Chromebook + Let's train your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> </message> <message name="IDS_HOTWORD_OPT_IN_TRAINING_DESCRIPTION" desc="Description on the voice model training page of the 'Ok Google' hotword opt-in dialog."> - To help your Chromebook respond to you and for reliable and easy access to voice search, you need to teach Google the sound of your voice. + To help your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> respond to you and for reliable and easy access to voice search, you need to teach Google the sound of your voice. </message> <message name="IDS_HOTWORD_OPT_IN_TRAINING_SPEAK" desc="The text describing the action the user should take on the voice model training page of the 'Ok Google' hotword opt-in dialog."> Just say "Ok Google" three times @@ -15634,7 +15637,7 @@ After you create a new supervised user, you can manage their settings at any tim You're all set! </message> <message name="IDS_HOTWORD_OPT_IN_FINISHED_LIST_INTRO" desc="The text at the beginning of the list describing the Chromebook's new abilities. "> - Your Chromebook can now: + Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> can now: </message> <message name="IDS_HOTWORD_OPT_IN_FINISHED_LIST_ITEM_1" desc="The text of the first item in the list of Chromebook abilities. "> Recognize your voice when you say "Ok Google" diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc index 4e20c4f..e268204 100644 --- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc +++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc @@ -8,6 +8,7 @@ #include "base/lazy_instance.h" #include "base/prefs/pref_service.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search/hotword_audio_history_handler.h" @@ -17,12 +18,17 @@ #include "chrome/browser/ui/app_list/app_list_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" +#include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "content/public/browser/speech_recognition_session_preamble.h" #include "extensions/browser/event_router.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/webui/web_ui_util.h" +#if defined(OS_CHROMEOS) +#include "ash/system/chromeos/devicetype_utils.h" +#endif + namespace extensions { namespace hotword_private_constants { @@ -328,6 +334,15 @@ bool HotwordPrivateStopTrainingFunction::RunSync() { } bool HotwordPrivateGetLocalizedStringsFunction::RunSync() { +#if defined(OS_CHROMEOS) + base::string16 device_type = ash::GetChromeOSDeviceName(); +#else + base::string16 product_name = + l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); + base::string16 device_type = + l10n_util::GetStringFUTF16(IDS_HOTWORD_BROWSER_NAME, product_name); +#endif + base::DictionaryValue* localized_strings = new base::DictionaryValue(); localized_strings->SetString( @@ -344,11 +359,13 @@ bool HotwordPrivateGetLocalizedStringsFunction::RunSync() { l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_SUBTITLE)); localized_strings->SetString( "introDescription", - l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION)); + l10n_util::GetStringFUTF16(IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION, + device_type)); localized_strings->SetString( "introDescriptionAudioHistoryEnabled", - l10n_util::GetStringUTF16( - IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION_AUDIO_HISTORY_ENABLED)); + l10n_util::GetStringFUTF16( + IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION_AUDIO_HISTORY_ENABLED, + device_type)); localized_strings->SetString( "introStart", l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_START)); @@ -377,11 +394,12 @@ bool HotwordPrivateGetLocalizedStringsFunction::RunSync() { "error", l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_ERROR)); localized_strings->SetString( - "trainingTitle", - l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_TITLE)); + "trainingTitle", l10n_util::GetStringFUTF16( + IDS_HOTWORD_OPT_IN_TRAINING_TITLE, device_type)); localized_strings->SetString( "trainingDescription", - l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_DESCRIPTION)); + l10n_util::GetStringFUTF16(IDS_HOTWORD_OPT_IN_TRAINING_DESCRIPTION, + device_type)); localized_strings->SetString( "trainingSpeak", l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_SPEAK)); @@ -408,7 +426,8 @@ bool HotwordPrivateGetLocalizedStringsFunction::RunSync() { l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_TITLE)); localized_strings->SetString( "finishedListIntro", - l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_INTRO)); + l10n_util::GetStringFUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_INTRO, + device_type)); localized_strings->SetString( "finishedListItem1", l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_ITEM_1)); |