Combine disparate strings for easier l10n.

* Interpolate on %s and %(name)s that the Mozilla l10n team is accustomed to using.
* Write email HTML from JS to simplify the translator's job

fixes #267
This commit is contained in:
Shane Tomlinson 2014-01-24 12:59:51 +00:00
Родитель 09ea53c863
Коммит 9a5981c8ac
11 изменённых файлов: 19 добавлений и 10 удалений

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

@ -12,7 +12,7 @@
<div class="graphic graphic-checkbox">{{#t}}Success{{/t}}</div> <div class="graphic graphic-checkbox">{{#t}}Success{{/t}}</div>
{{#redirectTo}} {{#redirectTo}}
<p>{{#t}}You are now ready to use{{/t}} {{ service }}</p> <p>{{#t}}You are now ready to use %(service)s{{/t}}</p>
<a href="{{ redirectTo }}" autofocus>{{#t}}Continue{{/t}}</a> <a href="{{ redirectTo }}" autofocus>{{#t}}Continue{{/t}}</a>
{{/redirectTo}} {{/redirectTo}}

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

@ -9,7 +9,7 @@
<div class="graphic graphic-mail">{{#t}}Email Sent{{/t}}</div> <div class="graphic graphic-mail">{{#t}}Email Sent{{/t}}</div>
<p class="verification-email-message">{{#t}}A verification link has been sent to:{{/t}}<br/><span id="confirm-email">{{email}}</span>.</p> <p class="verification-email-message">{{#t}}A verification link has been sent&nbsp;to: %(email)s{{/t}}</p>
<div class="links"> <div class="links">
<a>{{#t}}Email not showing up? Send again{{/t}}</a> <a>{{#t}}Email not showing up? Send again{{/t}}</a>

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

@ -9,7 +9,7 @@
<div class="graphic graphic-mail">{{#t}}Email Sent{{/t}}</div> <div class="graphic graphic-mail">{{#t}}Email Sent{{/t}}</div>
<p class="verification-email-message">{{#t}}A reset link has been sent to:{{/t}}<br/><strong>{{email}}.</strong></p> <p class="verification-email-message">{{#t}}A reset link has been sent to: %(email)s{{/t}}</p>
<div class="links"> <div class="links">
<a>{{#t}}Email not showing up? Send again{{/t}}</a> <a>{{#t}}Email not showing up? Send again{{/t}}</a>

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

@ -10,7 +10,7 @@
<div class="graphic graphic-checkbox">{{#t}}Success{{/t}}</div> <div class="graphic graphic-checkbox">{{#t}}Success{{/t}}</div>
{{#redirectTo}} {{#redirectTo}}
<p>{{#t}}Continue to{{/t}} {{ service }} {{#t}}on the <strong>Initial Client</strong>.{{/t}}</p> <p>{{#t}}Continue to %(service)s on the <strong>Initial Client</strong>.{{/t}}</p>
<a href="{{ redirectTo }}" autofocus>{{#t}}Continue{{/t}}</a> <a href="{{ redirectTo }}" autofocus>{{#t}}Continue{{/t}}</a>
{{/redirectTo}} {{/redirectTo}}

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

@ -7,7 +7,7 @@
<div class="error"></div> <div class="error"></div>
<div class="success">{{#t}}Password changed{{/t}}</div> <div class="success">{{#t}}Password changed{{/t}}</div>
<p>{{#t}}You are signed in as:{{/t}}<br /> {{ email }}</p> <p>{{#t}}You are signed in as: %(email)s{{/t}}</p>
<form> <form>
<div class="input-row"> <div class="input-row">

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

@ -48,14 +48,15 @@ function (_, Backbone, jQuery, Session) {
getContext: function () { getContext: function () {
var ctx = this.context() || {}; var ctx = this.context() || {};
ctx.t = this.translate; ctx.t = _.bind(this.translate, this);
return ctx; return ctx;
}, },
translate: function () { translate: function () {
var self = this;
return function (text) { return function (text) {
return translator.get(text); return translator.get(text, self.getContext());
}; };
}, },

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

@ -16,7 +16,8 @@ function (BaseView, ConfirmTemplate, Session) {
context: function () { context: function () {
return { return {
email: Session.email // HTML is written here to simplify the l10n community's job
email: '<strong id="confirm-email" class="email">' + Session.email + '</strong>'
}; };
} }
}); });

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

@ -16,7 +16,8 @@ function (BaseView, Template, Session) {
context: function () { context: function () {
return { return {
email: Session.email // HTML is written here to simplify the l10n community's job
email: '<strong id="confirm-email" class="email">' + Session.email + '</strong>'
}; };
} }
}); });

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

@ -21,7 +21,8 @@ function (_, BaseView, Template, FxaClient, Session) {
context: function () { context: function () {
return { return {
email: Session.email // HTML is written here to simplify the l10n community's job
email: '<strong id="email" class="email">' + Session.email + '</strong>'
}; };
}, },

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

@ -70,6 +70,10 @@ section p {
font-size: 18px; font-size: 18px;
} }
strong.email {
display: block;
}
.error { .error {
background: #D63920; background: #D63920;
color: #fff; color: #fff;

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

@ -55,6 +55,7 @@ require([
'../tests/spec/lib/url', '../tests/spec/lib/url',
'../tests/spec/lib/session', '../tests/spec/lib/session',
'../tests/spec/lib/fxa-client', '../tests/spec/lib/fxa-client',
'../tests/spec/lib/translator',
'../tests/spec/views/base', '../tests/spec/views/base',
'../tests/spec/views/sign_up', '../tests/spec/views/sign_up',
'../tests/spec/views/sign_in', '../tests/spec/views/sign_in',