Skip to content

Commit

Permalink
shimless: i18n strings for RSU code page
Browse files Browse the repository at this point in the history
Screenshot:
https://storage.cloud.google.com/chromium-translation-screenshots/c1105993eb549b25da9b7b1b790cc6817f7c1b23

Also remove Element suffix from OnboardingEnterRsuWpDisableCodePage
while refactoring it to add i18n support.

Bug: 1198187
Test: Run local build and confirm text is correct.
Change-Id: I095259273f08adc6d82d8bc116343ad4fec4b7ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3265984
Commit-Queue: Gavin Dodd <gavindodd@google.com>
Reviewed-by: Gavin Williams <gavinwill@chromium.org>
Cr-Commit-Position: refs/heads/main@{#939459}
  • Loading branch information
greatgoogleymoogley authored and Chromium LUCI CQ committed Nov 8, 2021
1 parent fffe74c commit 299ec35
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

<base-page orientation="column">
<div slot="header">
<!-- TODO(gavindodd): Update text for i18n -->
<h1>Enter RSU Hardware Write Protection Disable Code</h1>

<p>Challenge:</p>
<h1>[[i18n('rsuCodePageTitleText')]]</h1>
<div>[[i18n('rsuCodeInstructionsText')]]</div>
<div>[[i18n('rsuChallengeLabelText')]]</div>
<div id="rsuChallenge">
<template id="rsuChallengeParts" is="dom-repeat" items="[[rsuChallenge_]]" as="row">
<template id="rsuChallengePart" is="dom-repeat" items="[[row]]" as="segment">
Expand All @@ -15,11 +14,11 @@ <h1>Enter RSU Hardware Write Protection Disable Code</h1>
<br/>
</template>
</div>
<p>HWID: <span id="rsuHwid">[[rsuHwid_]]</span></p>
<div id="rsuHwid">[[i18n('rsuHardwareIdText', rsuHwid_)]]</div>
<cr-input
on-change="onRsuCodeChanged_"
label="RSU Code:"
placeholder="Enter RSU Code"
label="[[i18n('rsuCodeLabelText')]]"
placeholder="[[i18n('rsuCodePlaceHolderText')]]"
id="rsuCode"
value="{{rsuCode_}}">
</cr-input>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import './shimless_rma_shared_css.js';
import './base_page.js';
import '//resources/cr_elements/cr_input/cr_input.m.js';

import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {getShimlessRmaService} from './mojo_interface_provider.js';
import {QrCode, ShimlessRmaServiceInterface, StateResult} from './shimless_rma_types.js';
Expand All @@ -23,7 +24,18 @@ const QR_CODE_FILL_STYLE = '#000000';
* 'onboarding-enter-rsu-wp-disable-code-page' asks the user for the RSU disable
* code.
*/
export class OnboardingEnterRsuWpDisableCodePageElement extends PolymerElement {

/**
* @constructor
* @extends {PolymerElement}
* @implements {I18nBehaviorInterface}
*/
const OnboardingEnterRsuWpDisableCodePageBase =
mixinBehaviors([I18nBehavior], PolymerElement);

/** @polymer */
export class OnboardingEnterRsuWpDisableCodePage extends
OnboardingEnterRsuWpDisableCodePageBase {
static get is() {
return 'onboarding-enter-rsu-wp-disable-code-page';
}
Expand Down Expand Up @@ -163,5 +175,5 @@ export class OnboardingEnterRsuWpDisableCodePageElement extends PolymerElement {
}

customElements.define(
OnboardingEnterRsuWpDisableCodePageElement.is,
OnboardingEnterRsuWpDisableCodePageElement);
OnboardingEnterRsuWpDisableCodePage.is,
OnboardingEnterRsuWpDisableCodePage);
11 changes: 9 additions & 2 deletions ash/webui/shimless_rma/shimless_rma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ void AddShimlessRmaStrings(content::WebUIDataSource* html_source) {
IDS_SHIMLESS_RMA_CURRENT_VERSION_OUT_OF_DATE},
{"currentVersionUpToDateText",
IDS_SHIMLESS_RMA_CURRENT_VERSION_UP_TO_DATE},
{"updateVersionRestartLabel",
IDS_SHIMLESS_RMA_UPDATE_VERSION_AND_RESTART},
// RSU code page
{"rsuCodePageTitleText", IDS_SHIMLESS_RMA_RSU_CODE_PAGE_TITLE},
{"rsuCodeInstructionsText", IDS_SHIMLESS_RMA_RSU_CODE_INSTRUCTIONS},
{"rsuChallengeLabelText", IDS_SHIMLESS_RMA_RSU_CHALLENGE_LABEL},
{"rsuHardwareIdText", IDS_SHIMLESS_RMA_RSU_HWID},
{"rsuCodeLabelText", IDS_SHIMLESS_RMA_RSU_CODE_LABEL},
{"rsuCodePlaceHolderText", IDS_SHIMLESS_RMA_RSU_CODE_PLACEHOLDER},
// Repair complete page
{"repairCompletedTitleText", IDS_SHIMLESS_RMA_REPAIR_COMPLETED},
{"reworkFlowLinkText", IDS_SHIMLESS_RMA_REWORK_FLOW_LINK},
{"updateVersionRestartLabel",
IDS_SHIMLESS_RMA_UPDATE_VERSION_AND_RESTART},
};

html_source->AddLocalizedStrings(kLocalizedStrings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js';
import {fakeRsuChallengeQrCode} from 'chrome://shimless-rma/fake_data.js';
import {FakeShimlessRmaService} from 'chrome://shimless-rma/fake_shimless_rma_service.js';
import {setShimlessRmaServiceForTesting} from 'chrome://shimless-rma/mojo_interface_provider.js';
import {OnboardingEnterRsuWpDisableCodePageElement} from 'chrome://shimless-rma/onboarding_enter_rsu_wp_disable_code_page.js';
import {OnboardingEnterRsuWpDisableCodePage} from 'chrome://shimless-rma/onboarding_enter_rsu_wp_disable_code_page.js';
import {assertDeepEquals, assertEquals, assertFalse, assertTrue} from '../../chai_assert.js';
import {flushTasks} from '../../test_util.js';

Expand All @@ -21,7 +21,7 @@ function suppressedComponentCanvasSize_(component) {
}

export function onboardingEnterRsuWpDisableCodePageTest() {
/** @type {?OnboardingEnterRsuWpDisableCodePageElement} */
/** @type {?OnboardingEnterRsuWpDisableCodePage} */
let component = null;

/** @type {?FakeShimlessRmaService} */
Expand Down Expand Up @@ -56,7 +56,7 @@ export function onboardingEnterRsuWpDisableCodePageTest() {
service.setGetRsuDisableWriteProtectChallengeQrCodeResponse(
fakeRsuChallengeQrCode);

component = /** @type {!OnboardingEnterRsuWpDisableCodePageElement} */ (
component = /** @type {!OnboardingEnterRsuWpDisableCodePage} */ (
document.createElement('onboarding-enter-rsu-wp-disable-code-page'));
assertTrue(!!component);
document.body.appendChild(component);
Expand Down Expand Up @@ -88,7 +88,7 @@ export function onboardingEnterRsuWpDisableCodePageTest() {
test('EnterRsuWpDisableCodePageDisplaysHwid', async () => {
await initializeEnterRsuWpDisableCodePage('', 'device hwid');
const rsuHwidComponent = component.shadowRoot.querySelector('#rsuHwid');
assertEquals('device hwid', rsuHwidComponent.innerHTML);
assertTrue(rsuHwidComponent.innerHTML.includes('device hwid'));
});

test('EnterRsuWpDisableCodePageRendersQrCode', async () => {
Expand Down
19 changes: 19 additions & 0 deletions chromeos/chromeos_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,25 @@ Try tapping the mic to ask me anything.
Select this option if the device is being restocked or refurbished for
distribution to a new customer.
</message>
<!-- Enter RSU code page -->
<message name="IDS_SHIMLESS_RMA_RSU_CODE_PAGE_TITLE" desc="Title for the RSU challenge page.">
Perform RMA Server Unlock
</message>
<message name="IDS_SHIMLESS_RMA_RSU_CODE_INSTRUCTIONS" translateable="false" desc="Instructions for the RSU challenge page.">
Get your unlock code by scanning the QR code or going to the RSU web site and entering the challenge key.
</message>
<message name="IDS_SHIMLESS_RMA_RSU_CHALLENGE_LABEL" translateable="false" desc="Label for the formatted RSU challenge key.">
Challenge:
</message>
<message name="IDS_SHIMLESS_RMA_RSU_HWID" translateable="false" desc="Label that shows to display the device hardware ID.">
HWID: <ph name="HARDWARE_ID">$1<ex>SAMUSTEST_2082</ex></ph>
</message>
<message name="IDS_SHIMLESS_RMA_RSU_CODE_LABEL" desc="Label for the RSU code input box.">
Enter the unlock code:
</message>
<message name="IDS_SHIMLESS_RMA_RSU_CODE_PLACEHOLDER" translateable="false" desc="Placeholder text for empty RSU code input box.">
Enter RSU Code
</message>
<!-- Repair complete page -->
<message name="IDS_SHIMLESS_RMA_REPAIR_COMPLETED" desc="Title for the page shown when the RMA process repair process is completed.">
Repair completed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c1105993eb549b25da9b7b1b790cc6817f7c1b23
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c1105993eb549b25da9b7b1b790cc6817f7c1b23

0 comments on commit 299ec35

Please sign in to comment.