Commit d1dd2578 authored by Jesse Schettler's avatar Jesse Schettler Committed by Commit Bot

scanning: Add string for scanner dropdown label

Add a finalized string for the scanner dropdown label and implement i18n
for strings.

Bug: 1059779
Change-Id: Ia216da7e9c9fc5a6b8928aa02e0889ade65acdad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429227Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarJimmy Gong <jimmyxgong@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Jesse Schettler <jschettler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810405}
parent bc679b7d
......@@ -458,6 +458,11 @@ Try tapping the mic to ask me anything.
<message name="IDS_PRINT_MANAGEMENT_COLLAPSE_PRINTING_STATUS" desc="A text that indicates to the user that the print job is currently printing. This text only appears if the width of the app's window is small and cannot display the entire ongoing printing status.">
Printing
</message>
<!-- Scanning App -->
<message name="IDS_SCANNING_APP_SCANNER_DROPDOWN_LABEL" desc="The label for the dropdown that displays connected scanners.">
Scanner
</message>
</messages>
</release>
</grit>
ad32798b7ebbc438f2cb9748c2081bb77e4c0ec3
\ No newline at end of file
......@@ -16,7 +16,9 @@ static_library("scanning") {
"//chromeos/components/scanning/mojom",
"//chromeos/constants",
"//chromeos/resources:scanning_app_resources",
"//chromeos/strings/",
"//content/public/browser",
"//ui/base",
"//ui/resources",
"//ui/webui",
]
......
include_rules = [
"-chrome",
"+chromeos/grit/chromeos_scanning_app_resources.h",
"+chromeos/strings/grit/chromeos_strings.h",
"+content/public/browser",
"+ui/base",
"+ui/resources",
"+ui/webui",
]
......@@ -24,6 +24,7 @@ js_library("scanner_select") {
":scanning_app_util",
"//chromeos/components/scanning/mojom:mojom_js_library_for_compile",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:i18n_behavior.m",
]
}
......
......@@ -10,8 +10,8 @@
width: 300px;
}
</style>
<!-- TODO(jschettler): Replace title and default option with i18n strings. -->
<span id="title">Scanner</span>
<!-- TODO(jschettler): Replace default option with i18n string. -->
<span id="title">[[i18n('scannerDropdownLabel')]]</span>
<div id="controls">
<div class="throbber-container" hidden$="[[loaded]]">
<div class="throbber"></div>
......
......@@ -9,8 +9,10 @@ import './scanning.mojom-lite.js';
import './throbber_css.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {ScannerArr} from './scanning_app_types.js';
import {tokenToString} from './scanning_app_util.js';
import './strings.js';
/** @type {number} */
const NUM_REQUIRED_SCANNERS = 2;
......@@ -24,6 +26,8 @@ Polymer({
_template: html`{__html_template__}`,
behaviors: [I18nBehavior],
properties: {
/** @type {!ScannerArr} */
scanners: {
......
......@@ -12,10 +12,12 @@
#include "chromeos/components/scanning/url_constants.h"
#include "chromeos/grit/chromeos_scanning_app_resources.h"
#include "chromeos/grit/chromeos_scanning_app_resources_map.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_resources.h"
namespace chromeos {
......@@ -44,6 +46,16 @@ void SetUpWebUIDataSource(content::WebUIDataSource* source,
source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER);
}
void AddScanningAppStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"scannerDropdownLabel", IDS_SCANNING_APP_SCANNER_DROPDOWN_LABEL}};
for (const auto& str : kLocalizedStrings)
html_source->AddLocalizedString(str.name, str.id);
html_source->UseStringsJs();
}
} // namespace
ScanningUI::ScanningUI(content::WebUI* web_ui, BindScanServiceCallback callback)
......@@ -64,6 +76,8 @@ ScanningUI::ScanningUI(content::WebUI* web_ui, BindScanServiceCallback callback)
html_source->AddResourcePath("scanning.mojom-lite.js",
IDR_SCANNING_MOJO_LITE_JS);
AddScanningAppStrings(html_source.get());
content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
html_source.release());
}
......
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