Commit 1c450164 authored by Denis Kuznetsov's avatar Denis Kuznetsov Committed by Commit Bot

Replace i18n-content with i18nDynamic in polymer elements

Bug: 955194
Change-Id: I6d35b0897dc753d16ae37bc83dff502f960af154
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899500
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#713407}
parent ee49feff
...@@ -146,6 +146,9 @@ js_library("multidevice_setup_first_run") { ...@@ -146,6 +146,9 @@ js_library("multidevice_setup_first_run") {
} }
js_library("active_directory_password_change") { js_library("active_directory_password_change") {
deps = [
"//ui/webui/resources/js:i18n_behavior",
]
} }
js_library("app_downloading") { js_library("app_downloading") {
...@@ -157,7 +160,9 @@ js_library("app_downloading") { ...@@ -157,7 +160,9 @@ js_library("app_downloading") {
js_library("arc_terms_of_service") { js_library("arc_terms_of_service") {
deps = [ deps = [
":html-echo",
":oobe_dialog_host_behavior", ":oobe_dialog_host_behavior",
"//ui/webui/resources/js:i18n_behavior",
] ]
} }
...@@ -214,6 +219,9 @@ js_library("gaia_input") { ...@@ -214,6 +219,9 @@ js_library("gaia_input") {
} }
js_library("gaia_password_changed") { js_library("gaia_password_changed") {
deps = [
"//ui/webui/resources/js:i18n_behavior",
]
} }
js_library("hd-iron-icon") { js_library("hd-iron-icon") {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<gaia-card id="gaiaCard" class="fit"> <gaia-card id="gaiaCard" class="fit">
<div slot="header" class="flex vertical layout end-justified start"> <div slot="header" class="flex vertical layout end-justified start">
<h1 id="welcomeMessage" class="welcome-message"> <h1 id="welcomeMessage" class="welcome-message">
[[computeWelcomeMessage_(username)]] [[i18nDynamic(locale, 'adPassChangeMessage', username)]]
</h1> </h1>
</div> </div>
<div slot="footer" class="flex vertical layout justified"> <div slot="footer" class="flex vertical layout justified">
...@@ -47,25 +47,29 @@ ...@@ -47,25 +47,29 @@
i18n-values="button-text:offlineLoginNextBtn"> i18n-values="button-text:offlineLoginNextBtn">
<gaia-input slot="inputs" id="oldPassword" type="password" <gaia-input slot="inputs" id="oldPassword" type="password"
required> required>
<div slot="label" i18n-content="adPassChangeOldPasswordHint"> <div slot="label">
[[i18nDynamic(locale, 'adPassChangeOldPasswordHint')]]
</div> </div>
<div slot="error" i18n-content="adPassChangeOldPasswordError"> <div slot="error">
[[i18nDynamic(locale, 'adPassChangeOldPasswordError')]]
</div> </div>
</gaia-input> </gaia-input>
<gaia-input slot="inputs" id="newPassword1" type="password" <gaia-input slot="inputs" id="newPassword1" type="password"
required> required>
<div slot="label" i18n-content="adPassChangeNewPasswordHint"> <div slot="label">
[[i18nDynamic(locale, 'adPassChangeNewPasswordHint')]]
</div> </div>
<div slot="error" <div slot="error">
i18n-content="adPassChangeNewPasswordRejected"> [[i18nDynamic(locale, 'adPassChangeNewPasswordRejected')]]
</div> </div>
</gaia-input> </gaia-input>
<gaia-input slot="inputs" id="newPassword2" type="password" <gaia-input slot="inputs" id="newPassword2" type="password"
required> required>
<div slot="label" <div slot="label">
i18n-content="adPassChangeRepeatNewPasswordHint"> [[i18nDynamic(locale, 'adPassChangeRepeatNewPasswordHint')]]
</div> </div>
<div slot="error" i18n-content="adPassChangePasswordsMismatch"> <div slot="error">
[[i18nDynamic(locale, 'adPassChangePasswordsMismatch')]]
</div> </div>
</gaia-input> </gaia-input>
</gaia-input-form> </gaia-input-form>
......
...@@ -19,6 +19,8 @@ var ACTIVE_DIRECTORY_PASSWORD_CHANGE_ERROR_STATE = { ...@@ -19,6 +19,8 @@ var ACTIVE_DIRECTORY_PASSWORD_CHANGE_ERROR_STATE = {
Polymer({ Polymer({
is: 'active-directory-password-change', is: 'active-directory-password-change',
behaviors: [I18nBehavior],
properties: { properties: {
/** /**
* The user principal name. * The user principal name.
...@@ -52,15 +54,6 @@ Polymer({ ...@@ -52,15 +54,6 @@ Polymer({
} }
}, },
/**
* @param {string} username
* @return {string}
* @private
*/
computeWelcomeMessage_: function(username) {
return loadTimeData.getStringF('adPassChangeMessage', username);
},
/** @private */ /** @private */
onSubmit_: function() { onSubmit_: function() {
if (!this.$.oldPassword.checkValidity() || if (!this.$.oldPassword.checkValidity() ||
......
...@@ -34,13 +34,15 @@ ...@@ -34,13 +34,15 @@
<hd-iron-icon slot="oobe-icon" <hd-iron-icon slot="oobe-icon"
icon1x="oobe-32:briefcase" icon2x="oobe-64:briefcase"> icon1x="oobe-32:briefcase" icon2x="oobe-64:briefcase">
</hd-iron-icon> </hd-iron-icon>
<h1 slot="title" i18n-content="oauthEnrollScreenTitle"></h1> <h1 slot="title">
[[i18nDynamic(locale, 'oauthEnrollScreenTitle')]]
</h1>
<paper-progress slot="progress" indeterminate> <paper-progress slot="progress" indeterminate>
</paper-progress> </paper-progress>
<div slot="footer" class="flex layout vertical" role="alert"> <div slot="footer" class="flex layout vertical" role="alert">
<div class="oauth-enroll-step-message"> <div class="oauth-enroll-step-message">
<span i18n-content="oauthEnrollWorking"></span> [[i18nDynamic(locale, 'oauthEnrollWorking')]]
</div> </div>
</div> </div>
</oobe-dialog> </oobe-dialog>
...@@ -72,15 +74,17 @@ ...@@ -72,15 +74,17 @@
<hd-iron-icon slot="oobe-icon" <hd-iron-icon slot="oobe-icon"
icon1x="oobe-32:briefcase" icon2x="oobe-64:briefcase"> icon1x="oobe-32:briefcase" icon2x="oobe-64:briefcase">
</hd-iron-icon> </hd-iron-icon>
<h1 slot="title" i18n-content="oauthEnrollSuccessTitle"></h1> <h1 slot="title">
[[i18nDynamic(locale, 'oauthEnrollSuccessTitle')]]
</h1>
<div slot="subtitle"> <div slot="subtitle">
<div hidden="[[!isEmpty_(enrolledDomain_)]]"> <div hidden="[[!isEmpty_(enrolledDomain_)]]">
[[i18nDynamic(locale,'oauthEnrollSuccessTitle')]] [[i18nDynamic(locale,'oauthEnrollSuccessTitle')]]
</div> </div>
<div hidden="[[isEmpty_(enrolledDomain_)]]"> <div hidden="[[isEmpty_(enrolledDomain_)]]">
<div inner-h-t-m-l= <html-echo content=
"[[successText_(locale, deviceName_, enrolledDomain_)]]"> "[[successText_(locale, deviceName_, enrolledDomain_)]]">
</div> </html-echo>
<div>[[i18nDynamic(locale, 'oauthEnrollAbeSuccessSupport')]]</div> <div>[[i18nDynamic(locale, 'oauthEnrollAbeSuccessSupport')]]</div>
</div> </div>
</div> </div>
...@@ -94,7 +98,7 @@ ...@@ -94,7 +98,7 @@
<oobe-text-button inverse id="success-done-button" <oobe-text-button inverse id="success-done-button"
on-tap="onEnrollmentFinished_" on-tap="onEnrollmentFinished_"
class="focus-on-show"> class="focus-on-show">
<div i18n-content="oauthEnrollDone"></div> <div>[[i18nDynamic(locale, 'oauthEnrollDone')]]</div>
</oobe-text-button> </oobe-text-button>
</div> </div>
</oobe-dialog> </oobe-dialog>
...@@ -105,31 +109,39 @@ ...@@ -105,31 +109,39 @@
<hd-iron-icon slot="oobe-icon" <hd-iron-icon slot="oobe-icon"
icon1x="oobe-32:briefcase" icon2x="oobe-64:briefcase"> icon1x="oobe-32:briefcase" icon2x="oobe-64:briefcase">
</hd-iron-icon> </hd-iron-icon>
<h1 slot="title" i18n-content="oauthEnrollScreenTitle"></h1> <h1 slot="title">
<div slot="subtitle" i18n-content="oauthEnrollDeviceInformation"> [[i18nDynamic(locale, 'oauthEnrollScreenTitle')]]
</h1>
<div slot="subtitle">
[[i18nDynamic(locale, 'oauthEnrollDeviceInformation')]]
</div> </div>
<div slot="footer" class="layout vertical start"> <div slot="footer" class="layout vertical start">
<div class="oauth-enroll-step-message"> <div class="oauth-enroll-step-message">
<span id="oauth-enroll-attribute-prompt-message" <span id="oauth-enroll-attribute-prompt-message">
i18n-content="oauthEnrollAttributeExplanation"> [[i18nDynamic(locale, 'oauthEnrollAttributeExplanation')]]
</span> </span>
<a href="#" id="oauth-enroll-learn-more-link" <a href="#" id="oauth-enroll-learn-more-link"
class="oauth-enroll-link" class="oauth-enroll-link">
i18n-content="oauthEnrollExplainAttributeLink"></a> [[i18nDynamic(locale, 'oauthEnrollExplainAttributeLink')]]
</a>
</div> </div>
<gaia-input id="oauth-enroll-asset-id" type="text" <gaia-input id="oauth-enroll-asset-id" type="text"
class="focus-on-show"> class="focus-on-show">
<div slot="label" i18n-content="oauthEnrollAssetIdLabel"> <div slot="label">
[[i18nDynamic(locale, 'oauthEnrollAssetIdLabel')]]
</div> </div>
</gaia-input> </gaia-input>
<gaia-input id="oauth-enroll-location" type="text"> <gaia-input id="oauth-enroll-location" type="text">
<div slot="label" i18n-content="oauthEnrollLocationLabel"> <div slot="label">
[[i18nDynamic(locale, 'oauthEnrollLocationLabel')]]
</div> </div>
</gaia-input> </gaia-input>
</div> </div>
<div slot="bottom-buttons" class="layout horizontal end-justified"> <div slot="bottom-buttons" class="layout horizontal end-justified">
<oobe-text-button id="attributes-skip" on-tap="skipAttributes_"> <oobe-text-button id="attributes-skip" on-tap="skipAttributes_">
<div i18n-content="oauthEnrollSkip"></div> <div>
[[i18nDynamic(locale, 'oauthEnrollSkip')]]
</div>
</oobe-text-button> </oobe-text-button>
<div class="flex"></div> <div class="flex"></div>
<oobe-next-button id="attributes-submit" <oobe-next-button id="attributes-submit"
......
...@@ -55,20 +55,24 @@ ...@@ -55,20 +55,24 @@
</gaia-header> </gaia-header>
<div slot="footer" class="gaia-body-text" <div slot="footer" class="gaia-body-text"
class="horizontal layout center"> class="horizontal layout center">
<p i18n-content="passwordChangedTitle"> <p>[[i18nDynamic(locale, 'passwordChangedTitle')]]</p>
</p>
</div> </div>
<gaia-input-form slot="footer" id="oldPasswordInputForm" <gaia-input-form slot="footer" id="oldPasswordInputForm"
disabled="[[disabled]]" on-submit="onPasswordSubmitted_" disabled="[[disabled]]" on-submit="onPasswordSubmitted_"
i18n-values="button-text:nextButtonText"> i18n-values="button-text:nextButtonText">
<gaia-input slot="inputs" id="oldPasswordInput" type="password" <gaia-input slot="inputs" id="oldPasswordInput" type="password"
required> required>
<div slot="label" i18n-content="oldPasswordHint"></div> <div slot="label">
<div slot="error" i18n-content="oldPasswordIncorrect"></div> [[i18nDynamic(locale,'oldPasswordHint')]]
</div>
<div slot="error">
[[i18nDynamic(locale,'oldPasswordIncorrect')]]
</div>
</gaia-input> </gaia-input>
<gaia-button id="forgot-password-link" <gaia-button id="forgot-password-link"
on-click="onForgotPasswordClicked_" on-click="onForgotPasswordClicked_" link>
i18n-content="forgotOldPasswordButtonText" link></gaia-button> [[i18nDynamic(locale,'forgotOldPasswordButtonText')]]
</gaia-button>
</gaia-input-form> </gaia-input-form>
</gaia-card> </gaia-card>
</neon-animatable> </neon-animatable>
...@@ -79,14 +83,18 @@ ...@@ -79,14 +83,18 @@
<div slot="footer"> <div slot="footer">
<div class="gaia-body-text horizontal layout center"> <div class="gaia-body-text horizontal layout center">
<iron-icon icon="cr:warning"></iron-icon> <iron-icon icon="cr:warning"></iron-icon>
<p i18n-content="passwordChangedProceedAnywayTitle" class="flex"> <p class="flex">
[[i18nDynamic(locale,'passwordChangedProceedAnywayTitle')]]
</p> </p>
</div> </div>
<div class="horizontal layout justified center"> <div class="horizontal layout justified center">
<gaia-button id="try-again-link" on-click="onTryAgainClicked_" <gaia-button id="try-again-link"
i18n-content="passwordChangedTryAgain" link></gaia-button> on-click="onTryAgainClicked_" link>
<gaia-button id="proceedAnywayBtn" on-click="onProceedClicked_" [[i18nDynamic(locale,'passwordChangedTryAgain')]]
i18n-content="proceedAnywayButton"></gaia-button> </gaia-button>
<gaia-button id="proceedAnywayBtn" on-click="onProceedClicked_">
[[i18nDynamic(locale,'proceedAnywayButton')]]
</gaia-button>
</div> </div>
</div> </div>
</gaia-card> </gaia-card>
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
Polymer({ Polymer({
is: 'gaia-password-changed', is: 'gaia-password-changed',
behaviors: [I18nBehavior],
properties: { properties: {
email: String, email: String,
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
class="multidevice-help-overlay-close-top class="multidevice-help-overlay-close-top
multidevice-help-overlay-close-button" multidevice-help-overlay-close-button"
on-click="hideWebviewOverlay_" on-click="hideWebviewOverlay_"
title="[[getOverlayCloseTopTitle_()]]"> title="[[i18nDynamic(locale, 'arcOverlayClose')]]">
</div> </div>
<div id="multidevice-help-overlay-webview-container"> <div id="multidevice-help-overlay-webview-container">
<div class="multidevice-help-overlay-webview-loading <div class="multidevice-help-overlay-webview-loading
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
on-click="hideWebviewOverlay_"> on-click="hideWebviewOverlay_">
<!-- TODO(crbug.com/894537): Use string that is specific to <!-- TODO(crbug.com/894537): Use string that is specific to
MultiDevice. --> MultiDevice. -->
<div i18n-content="arcOverlayClose"></div> <div>[[i18nDynamic(locale, 'arcOverlayClose')]]</div>
</oobe-text-button> </oobe-text-button>
</div> </div>
</div> </div>
......
...@@ -161,11 +161,6 @@ cr.define('multidevice_setup', function() { ...@@ -161,11 +161,6 @@ cr.define('multidevice_setup', function() {
this.webviewSrc_ = event.detail; this.webviewSrc_ = event.detail;
this.webviewOverlayHidden_ = false; this.webviewOverlayHidden_ = false;
}, },
/** @private */
getOverlayCloseTopTitle_: function() {
return this.i18n('arcOverlayClose');
},
}); });
return { return {
......
...@@ -108,11 +108,13 @@ ...@@ -108,11 +108,13 @@
</oobe-dialog> </oobe-dialog>
<cr-dialog id="forgotPasswordDlg" <cr-dialog id="forgotPasswordDlg"
on-close="onDialogOverlayClosed_"> on-close="onDialogOverlayClosed_">
<div slot="body" <div slot="body">
i18n-content="offlineLoginForgotPasswordDlg"></div> [[i18nDynamic(locale, 'offlineLoginForgotPasswordDlg')]]
</div>
<div slot="button-container"> <div slot="button-container">
<cr-button autofocus on-tap="onForgotPasswordCloseTap_" <cr-button autofocus on-tap="onForgotPasswordCloseTap_"
i18n-content="offlineLoginCloseBtn" class="action-button"> class="action-button">
[[i18nDynamic(locale, 'offlineLoginCloseBtn')]]
</cr-button> </cr-button>
</div> </div>
</cr-dialog> </cr-dialog>
......
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
Example: Example:
<oobe-welcome-secondary-button icon="close"> <oobe-welcome-secondary-button icon="close">
<div i18n-content="oobeCloseButtonText"></div> <div>[[i18nDynamic(locale, 'offlineLoginCloseBtn')]]</div>
</oobe-welcome-secondary-button> </oobe-welcome-secondary-button>
Attributes: Attributes:
......
...@@ -74,5 +74,14 @@ login.createScreen( ...@@ -74,5 +74,14 @@ login.createScreen(
$('ad-password-change'), cr.ui.Bubble.Attachment.BOTTOM, error, $('ad-password-change'), cr.ui.Bubble.Attachment.BOTTOM, error,
BUBBLE_HORIZONTAL_PADDING, BUBBLE_VERTICAL_PADDING); BUBBLE_HORIZONTAL_PADDING, BUBBLE_VERTICAL_PADDING);
}, },
/**
* Updates localized content of the screen that is not updated via
* template.
*/
updateLocalizedContent: function() {
$('active-directory-password-change').i18nUpdateLocale();
},
}; };
}); });
...@@ -56,6 +56,14 @@ login.createScreen('PasswordChangedScreen', 'password-changed', function() { ...@@ -56,6 +56,14 @@ login.createScreen('PasswordChangedScreen', 'password-changed', function() {
// We'll get here after the successful online authentication. // We'll get here after the successful online authentication.
Oobe.showScreen({id: SCREEN_PASSWORD_CHANGED}); Oobe.showScreen({id: SCREEN_PASSWORD_CHANGED});
Oobe.getInstance().setSigninUIState(SIGNIN_UI_STATE.PASSWORD_CHANGED); Oobe.getInstance().setSigninUIState(SIGNIN_UI_STATE.PASSWORD_CHANGED);
} },
/**
* Updates localized content of the screen that is not updated via template.
*/
updateLocalizedContent: function() {
this.gaiaPasswordChanged_.i18nUpdateLocale();
},
}; };
}); });
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