Commit 395516be authored by Scott Chen's avatar Scott Chen Committed by Commit Bot

NUX Onboarding: add some strings

Replacing placeholder strings, and move all the add-string calls to under
one function.

also fixes a path bug for apps/ -> google_apps/ introduced in
https://chromium-review.googlesource.com/c/chromium/src/+/1285210

Bug: 874122
Change-Id: Ibd7940c6de71e3a3befc1c5342f6f6097e37de6e
Reviewed-on: https://chromium-review.googlesource.com/c/1285325
Commit-Queue: Scott Chen <scottchen@chromium.org>
Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601791}
parent b0f2b836
......@@ -20,6 +20,8 @@ per-file md_extensions_strings.grdp=*
per-file media_router_strings.grdp*=imcheng@chromium.org
per-file media_router_strings.grdp*=mfoltz@chromium.org
per-file onboarding_welcome_strings.grdp=file://chrome/browser/ui/webui/welcome/nux/OWNERS
per-file printing_strings.grdp=file://printing/OWNERS
per-file profiles_strings.grdp=file://chrome/browser/profiles/OWNERS
......@@ -27,7 +29,6 @@ per-file profiles_strings.grdp=file://chrome/browser/profiles/OWNERS
per-file settings*strings*=file://chrome/browser/resources/settings/OWNERS
per-file vr_strings.grdp=file://chrome/browser/vr/OWNERS
per-file nux_strings.grdp=file://chrome/browser/ui/webui/welcome/nux/OWNERS
# Non-GRD rules.
......
......@@ -203,7 +203,7 @@ are declared in tools/grit/grit_rule.gni.
<!-- NUX Welcome onboarding experience strings -->
<if expr="not chromeos and not is_android">
<part file="nux_strings.grdp" />
<part file="onboarding_welcome_strings.grdp" />
</if>
<!-- Printing specific strings -->
......
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- NUX email provider selection module -->
<message name="IDS_NUX_EMAIL_GET_STARTED" desc="Label for a confirmation button to finish adding a bookmark and get the user started with using the browser.">
Get started
</message>
<message name="IDS_NUX_EMAIL_PROMPT" desc="Text shown to prompt the users to select an email service to add as bookmark. This is the subheader for IDS_NUX_EMAIL_WELCOME_TITLE.">
Choose your email service for quick access
</message>
<message name="IDS_NUX_EMAIL_WELCOME_TITLE" desc="Text shown to welcome the users to chrome.">
Make Chrome your own
</message>
<message name="IDS_NUX_EMAIL_BOOKMARK_ADDED" desc="String read for accessibility to inform the user a bookmark was added.">
Bookmark added
</message>
<message name="IDS_NUX_EMAIL_BOOKMARK_REMOVED" desc="String read for accessibility to inform the user a bookmark was removed.">
Bookmark removed
</message>
<message name="IDS_NUX_EMAIL_BOOKMARK_REPLACED" desc="String read for accessibility to inform the user a bookmark was replaced.">
Bookmark replaced
</message>
<!-- NUX Google apps selection module -->
<message name="IDS_NUX_GOOGLE_APPS_GET_STARTED" desc="Message for a confirmation button that will add the selected apps from a list.">
Get started
</message>
<message name="IDS_NUX_GOOGLE_APPS_DESCRIPTION" desc="Description of what this section in the onboarding workflow does.">
Add bookmarks to your favorite Google Apps
</message>
<message name="IDS_NUX_GOOGLE_APPS_DESCRIPTION_PROMO_BUBBLE" desc="Text shown when Google Apps have been added to highlight where bookmarks have been placed.">
Open apps easily with bookmarks
</message>
</grit-part>
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- Shared strings -->
<message name="IDS_ONBOARDING_WELCOME_GET_STARTED" desc="Label for a confirmation button to finish adding a bookmark and get the user started with using the browser.">
Get started
</message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED" desc="String read for accessibility to inform the user a bookmark was added.">
Bookmark added
</message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED" desc="String read for accessibility to inform the user a bookmark was removed.">
Bookmark removed
</message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED" desc="String read for accessibility to inform the user a bookmark was replaced.">
Bookmark replaced
</message>
<!-- NUX email provider selection module -->
<message name="IDS_ONBOARDING_WELCOME_NUX_EMAIL_PROMPT" desc="Text shown to prompt the users to select an email service to add as bookmark. This is the subheader for IDS_ONBOARDING_WELCOME_NUX_EMAIL_WELCOME_TITLE.">
Choose your email service for quick access
</message>
<message name="IDS_ONBOARDING_WELCOME_NUX_EMAIL_WELCOME_TITLE" desc="Text shown to welcome the users to chrome and allow customization.">
Make Chrome your own
</message>
<!-- NUX Google apps selection module -->
<message name="IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_DESCRIPTION" desc="Description of what this section in the onboarding workflow does.">
Add bookmarks to your favorite Google Apps
</message>
<!-- NUX set default module -->
<message name="IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_HEADER" desc="Header for the page that prompts user to set Chrome as their default browser.">
Set Chrome as your default browser
</message>
<message name="IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SUB_HEADER" desc="Sub-header for the page that prompts user to set Chrome as their default browser.">
Get Google Search and Google smarts everytime you browse
</message>
<message name="IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SKIP" desc="The label for a button to skip setting Chrome as their default browser.">
Skip
</message>
<message name="IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SET_AS_DEFAULT" desc="The label for a button to confirm setting Chrome as their default browser.">
Set as default
</message>
<!-- Sign-in view -->
<message name="IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_HEADER" desc="Header for the page that prompts user to set Chrome as their default browser.">
Save your progress
</message>
<message name="IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SUB_HEADER" desc="Sub-header for the page that prompts user to set Chrome as their default browser.">
Sign in to get your bookmarks on all devices
</message>
<message name="IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SIGNIN" desc="The label for a button to skip setting Chrome as their default browser.">
Sign in
</message>
</grit-part>
......@@ -5,7 +5,7 @@
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://welcome/apps/nux_google_apps_proxy.html">
<link rel="import" href="chrome://welcome/google_apps/nux_google_apps_proxy.html">
<link rel="import" href="chrome://welcome/shared/chooser_shared_css.html">
<dom-module id="apps-chooser">
......@@ -13,38 +13,38 @@
<style include="chooser-shared-css">
.gmail {
content: -webkit-image-set(
url(chrome://welcome/apps/gmail_1x.png) 1x,
url(chrome://welcome/apps/gmail_2x.png) 2x);
url(chrome://welcome/google_apps/gmail_1x.png) 1x,
url(chrome://welcome/google_apps/gmail_2x.png) 2x);
}
.youtube {
content: -webkit-image-set(
url(chrome://welcome/apps/youtube_1x.png) 1x,
url(chrome://welcome/apps/youtube_2x.png) 2x);
url(chrome://welcome/google_apps/youtube_1x.png) 1x,
url(chrome://welcome/google_apps/youtube_2x.png) 2x);
}
.maps {
content: -webkit-image-set(
url(chrome://welcome/apps/maps_1x.png) 1x,
url(chrome://welcome/apps/maps_2x.png) 2x);
url(chrome://welcome/google_apps/maps_1x.png) 1x,
url(chrome://welcome/google_apps/maps_2x.png) 2x);
}
.translate {
content: -webkit-image-set(
url(chrome://welcome/apps/translate_1x.png) 1x,
url(chrome://welcome/apps/translate_2x.png) 2x);
url(chrome://welcome/google_apps/translate_1x.png) 1x,
url(chrome://welcome/google_apps/translate_2x.png) 2x);
}
.news {
content: -webkit-image-set(
url(chrome://welcome/apps/news_1x.png) 1x,
url(chrome://welcome/apps/news_2x.png) 2x);
url(chrome://welcome/google_apps/news_1x.png) 1x,
url(chrome://welcome/google_apps/news_2x.png) 2x);
}
.web-store {
content: -webkit-image-set(
url(chrome://welcome/apps/chrome_store_1x.png) 1x,
url(chrome://welcome/apps/chrome_store_2x.png) 2x);
url(chrome://welcome/google_apps/chrome_store_1x.png) 1x,
url(chrome://welcome/google_apps/chrome_store_2x.png) 2x);
}
</style>
......
......@@ -18,8 +18,8 @@
.chrome-logo {
content: -webkit-image-set(
url(chrome://welcome/apps/google_apps_1x.png) 1x,
url(chrome://welcome/apps/google_apps_2x.png) 2x);
url(chrome://welcome/google_apps/google_apps_1x.png) 1x,
url(chrome://welcome/google_apps/google_apps_2x.png) 2x);
height: 38px;
margin-bottom: 16px;
margin-left: auto;
......
......@@ -59,16 +59,16 @@
</style>
<div class="container">
<div class="logo"></div>
<h1>TODO_HEADER</h1>
<h2>TODO_SUBHEADER</h2>
<h1>$i18n{setDefaultHeader}</h1>
<h2>$i18n{setDefaultSubHeader}</h2>
<!-- TODO(scottchen): WIP behind feature flag, add src later. -->
<img>
<div class="button-bar">
<paper-button on-click="onDeclineClick_">
TODO_NO_THANKS
$i18n{setDefaultSkip}
</paper-button>
<paper-button class="action-button" on-click="onSetDefaultClick_">
TODO_SET_AS_DEFAULT
$i18n{setDefaultConfirm}
</paper-button>
</div>
</div>
......
......@@ -39,13 +39,13 @@
</style>
<!-- TODO(scottchen): localize -->
<div id="container">
<h2>TODO Sign in to get your bookmarks on all devices</h2>
<h1>TODO Save your progress</h1>
<h2>$i18n{signInSubHeader}</h2>
<h1>$i18n{signInHeader}</h1>
<paper-button class="action-button" on-click="onSignInClick_">
Sign in
$i18n{signIn}
</paper-button>
<paper-button on-click="onNoThanksClick_">
No thanks
$i18n{noThanks}
</paper-button>
</div>
</template>
......
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_view_manager/cr_view_manager.html">
<link rel="import" href="apps/nux_google_apps.html">
<link rel="import" href="google_apps/nux_google_apps.html">
<link rel="import" href="email/nux_email.html">
<link rel="import" href="landing_view.html">
<link rel="import" href="navigation_behavior.html">
......
......@@ -120,18 +120,6 @@ void EmailHandler::HandleGetEmailList(const base::ListValue* args) {
void EmailHandler::AddSources(content::WebUIDataSource* html_source,
PrefService* prefs) {
// Localized strings.
html_source->AddLocalizedString("noThanks", IDS_NO_THANKS);
html_source->AddLocalizedString("getStarted", IDS_NUX_EMAIL_GET_STARTED);
html_source->AddLocalizedString("welcomeTitle", IDS_NUX_EMAIL_WELCOME_TITLE);
html_source->AddLocalizedString("emailPrompt", IDS_NUX_EMAIL_PROMPT);
html_source->AddLocalizedString("bookmarkAdded",
IDS_NUX_EMAIL_BOOKMARK_ADDED);
html_source->AddLocalizedString("bookmarkRemoved",
IDS_NUX_EMAIL_BOOKMARK_REMOVED);
html_source->AddLocalizedString("bookmarkReplaced",
IDS_NUX_EMAIL_BOOKMARK_REPLACED);
// Add icons
html_source->AddResourcePath("email/aol_1x.png", IDR_NUX_EMAIL_AOL_1X);
html_source->AddResourcePath("email/aol_2x.png", IDR_NUX_EMAIL_AOL_2X);
......
......@@ -128,38 +128,35 @@ void GoogleAppsHandler::HandleGetGoogleAppsList(const base::ListValue* args) {
void GoogleAppsHandler::AddSources(content::WebUIDataSource* html_source,
PrefService* prefs) {
// Localized strings.
html_source->AddLocalizedString("noThanks", IDS_NO_THANKS);
html_source->AddLocalizedString("getStarted",
IDS_NUX_GOOGLE_APPS_GET_STARTED);
html_source->AddLocalizedString("googleAppsDescription",
IDS_NUX_GOOGLE_APPS_DESCRIPTION);
// Add icons
html_source->AddResourcePath("apps/chrome_store_1x.png",
html_source->AddResourcePath("google_apps/chrome_store_1x.png",
IDR_NUX_GOOGLE_APPS_CHROME_STORE_1X);
html_source->AddResourcePath("apps/chrome_store_2x.png",
html_source->AddResourcePath("google_apps/chrome_store_2x.png",
IDR_NUX_GOOGLE_APPS_CHROME_STORE_2X);
// TODO: rename and centralize to make it easier to share icons between NUX.
html_source->AddResourcePath("apps/gmail_1x.png",
html_source->AddResourcePath("google_apps/gmail_1x.png",
IDR_NUX_EMAIL_GMAIL_1X);
html_source->AddResourcePath("apps/gmail_2x.png",
html_source->AddResourcePath("google_apps/gmail_2x.png",
IDR_NUX_EMAIL_GMAIL_2X);
html_source->AddResourcePath("apps/google_apps_1x.png",
html_source->AddResourcePath("google_apps/google_apps_1x.png",
IDR_NUX_GOOGLE_APPS_LOGO_1X);
html_source->AddResourcePath("apps/google_apps_2x.png",
html_source->AddResourcePath("google_apps/google_apps_2x.png",
IDR_NUX_GOOGLE_APPS_LOGO_2X);
html_source->AddResourcePath("apps/maps_1x.png", IDR_NUX_GOOGLE_APPS_MAPS_1X);
html_source->AddResourcePath("apps/maps_2x.png", IDR_NUX_GOOGLE_APPS_MAPS_2X);
html_source->AddResourcePath("apps/news_1x.png", IDR_NUX_GOOGLE_APPS_NEWS_1X);
html_source->AddResourcePath("apps/news_2x.png", IDR_NUX_GOOGLE_APPS_NEWS_2X);
html_source->AddResourcePath("apps/translate_1x.png",
html_source->AddResourcePath("google_apps/maps_1x.png",
IDR_NUX_GOOGLE_APPS_MAPS_1X);
html_source->AddResourcePath("google_apps/maps_2x.png",
IDR_NUX_GOOGLE_APPS_MAPS_2X);
html_source->AddResourcePath("google_apps/news_1x.png",
IDR_NUX_GOOGLE_APPS_NEWS_1X);
html_source->AddResourcePath("google_apps/news_2x.png",
IDR_NUX_GOOGLE_APPS_NEWS_2X);
html_source->AddResourcePath("google_apps/translate_1x.png",
IDR_NUX_GOOGLE_APPS_TRANSLATE_1X);
html_source->AddResourcePath("apps/translate_2x.png",
html_source->AddResourcePath("google_apps/translate_2x.png",
IDR_NUX_GOOGLE_APPS_TRANSLATE_2X);
html_source->AddResourcePath("apps/youtube_1x.png",
html_source->AddResourcePath("google_apps/youtube_1x.png",
IDR_NUX_GOOGLE_APPS_YOUTUBE_1X);
html_source->AddResourcePath("apps/youtube_2x.png",
html_source->AddResourcePath("google_apps/youtube_2x.png",
IDR_NUX_GOOGLE_APPS_YOUTUBE_2X);
// Add constants to loadtime data
......
......@@ -25,6 +25,7 @@
#include "chrome/grit/onboarding_welcome_resources.h"
#include "chrome/grit/onboarding_welcome_resources_map.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
#include "net/base/url_util.h"
......@@ -39,6 +40,54 @@ const bool kIsBranded =
#endif
} // namespace
// TODO(scottchen): reuse instead of copy from
// md_settings_localized_strings_provider.cc.
struct LocalizedString {
const char* name;
int id;
};
void AddOnboardingStrings(content::WebUIDataSource* html_source) {
static constexpr LocalizedString kLocalizedStrings[] = {
// Shared strings.
{"headerText", IDS_WELCOME_HEADER},
{"acceptText", IDS_WELCOME_ACCEPT_BUTTON},
{"noThanks", IDS_NO_THANKS},
{"getStarted", IDS_ONBOARDING_WELCOME_GET_STARTED},
{"bookmarkAdded", IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED},
{"bookmarkRemoved", IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED},
{"bookmarkReplaced", IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED},
// Sign-in view strings.
{"signInHeader", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_HEADER},
{"signInSubHeader", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SUB_HEADER},
{"signIn", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SIGNIN},
// Email provider module strings.
{"welcomeTitle", IDS_ONBOARDING_WELCOME_NUX_EMAIL_WELCOME_TITLE},
{"emailPrompt", IDS_ONBOARDING_WELCOME_NUX_EMAIL_PROMPT},
// Google apps module strings.
{"googleAppsDescription",
IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_DESCRIPTION},
// Set as default module strings.
{"setDefaultHeader", IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_HEADER},
{"setDefaultSubHeader",
IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SUB_HEADER},
{"setDefaultSkip", IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SKIP},
{"setDefaultConfirm",
IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SET_AS_DEFAULT},
};
// TODO(scottchen): reuse instead of copy from
// md_settings_localized_strings_provider.cc.
for (size_t i = 0; i < base::size(kLocalizedStrings); i++) {
html_source->AddLocalizedString(kLocalizedStrings[i].name,
kLocalizedStrings[i].id);
}
}
WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
: content::WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
......@@ -67,8 +116,7 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
if (nux::IsNuxOnboardingEnabled(profile)) {
// Add Onboarding welcome strings.
html_source->AddLocalizedString("headerText", IDS_WELCOME_HEADER);
html_source->AddLocalizedString("acceptText", IDS_WELCOME_ACCEPT_BUTTON);
AddOnboardingStrings(html_source);
// Add all Onboarding resources.
for (size_t i = 0; i < kOnboardingWelcomeResourcesSize; ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment