fix(l10n): Fix double escaping problems on /*_complete pages. (#5491) r=vladikoff

The header and button text are translated within the views
and passed to the templates. When the strings are translated
within the views, they are already HTML escaped. Then, the
template was escaping them again!

fixes #5407
This commit is contained in:
Shane Tomlinson 2017-09-18 15:32:30 +01:00 коммит произвёл Vlad Filippov
Родитель 34c4565423
Коммит b5de42b5f9
2 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -1,6 +1,6 @@
<div id="main-content" class="card">
<header>
<h1 id="{{headerId}}">{{headerTitle}}</h1>
<h1 id="{{headerId}}">{{{escapedHeaderTitle}}}</h1>
</header>
<section>
@ -9,7 +9,7 @@
<div class="graphic graphic-checkbox">{{#t}}Success{{/t}}</div>
{{#isSync}}
<p class="account-ready-service">{{readyToSyncText}}</p>
<p class="account-ready-service">{{{escapedReadyToSyncText}}}</p>
{{/isSync}}
{{^isSync}}

Просмотреть файл

@ -69,10 +69,10 @@ define(function (require, exports, module) {
setInitialContext (context) {
context.set({
escapedHeaderTitle: this._getEscapedHeaderTitle(),
escapedReadyToSyncText: this._getEscapedReadyToSyncText(),
headerId: this._getHeaderId(),
headerTitle: this._getHeaderTitle(),
isSync: this.relier.isSync(),
readyToSyncText: this._getReadyToSyncText(),
redirectUri: this.relier.get('redirectUri'),
secondaryEmailVerified: this.getSearchParam('secondary_email_verified') || null
});
@ -82,13 +82,25 @@ define(function (require, exports, module) {
return this._templateInfo.headerId;
},
_getHeaderTitle () {
var title = this._templateInfo.headerTitle;
/**
* Get the HTML escaped header title
*
* @returns {String}
*/
_getEscapedHeaderTitle () {
const title = this._templateInfo.headerTitle;
// translateInTemplate HTML escapes
return this.translateInTemplate(title);
},
_getReadyToSyncText () {
var readyToSyncText = this._templateInfo.readyToSyncText;
/**
* Get the HTML escaped "Ready to Sync" text
*
* @returns {String}
*/
_getEscapedReadyToSyncText () {
const readyToSyncText = this._templateInfo.readyToSyncText;
// translateInTemplate HTML escapes
return this.translateInTemplate(readyToSyncText);
}
});