Bug 1487395 - Update strings on error pages, as well as convert apostrophes to use 'smart-quotes'. r=sfoster

Differential Revision: https://phabricator.services.mozilla.com/D5068

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Wein 2018-09-06 19:43:19 +00:00
Родитель be45c91042
Коммит 57e533640d
5 изменённых файлов: 44 добавлений и 31 удалений

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

@ -20,6 +20,8 @@ export default class CompletionErrorPage extends PaymentStateSubscriberMixin(Pay
super();
this.classList.add("error-page");
this.suggestionHeading = document.createElement("p");
this.body.append(this.suggestionHeading);
this.suggestionsList = document.createElement("ul");
this.suggestions = [];
this.body.append(this.suggestionsList);
@ -41,17 +43,23 @@ export default class CompletionErrorPage extends PaymentStateSubscriberMixin(Pay
let {request} = this.requestStore.getState();
let {displayHost} = request.topLevelPrincipal.URI;
for (let key of ["pageTitle", "suggestion-1", "suggestion-2", "suggestion-3"]) {
this.dataset[key] = this.dataset[key].replace("**host-name**", displayHost);
for (let key of ["pageTitle", "suggestion-heading", "suggestion-1", "suggestion-2"]) {
if (this.dataset[key]) {
this.dataset[key] = this.dataset[key].replace("**host-name**", displayHost);
}
}
this.pageTitleHeading.textContent = this.dataset.pageTitle;
this.suggestionHeading.textContent = this.dataset.suggestionHeading;
this.doneButton.textContent = this.dataset.doneButtonLabel;
this.suggestionsList.textContent = "";
this.suggestions[0] = this.dataset["suggestion-1"];
this.suggestions[1] = this.dataset["suggestion-2"];
this.suggestions[2] = this.dataset["suggestion-3"];
if (this.dataset["suggestion-1"]) {
this.suggestions[0] = this.dataset["suggestion-1"];
}
if (this.dataset["suggestion-2"]) {
this.suggestions[1] = this.dataset["suggestion-2"];
}
let suggestionsFragment = document.createDocumentFragment();
for (let suggestionText of this.suggestions) {

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

@ -98,6 +98,7 @@ payment-dialog > header > .page-error {
.page > footer {
align-items: center;
justify-content: end;
background-color: #eaeaee;
display: flex;
/* from visual spec: */

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

@ -19,9 +19,9 @@
<!ENTITY shippingOptionsLabel "Shipping Options">
<!ENTITY deliveryOptionsLabel "Delivery Options">
<!ENTITY pickupOptionsLabel "Pickup Options">
<!ENTITY shippingGenericError "Can't ship to this address. Select a different address.">
<!ENTITY deliveryGenericError "Can't deliver to this address. Select a different address.">
<!ENTITY pickupGenericError "Can't pick up from this address. Select a different address.">
<!ENTITY shippingGenericError "Cant ship to this address. Select a different address.">
<!ENTITY deliveryGenericError "Cant deliver to this address. Select a different address.">
<!ENTITY pickupGenericError "Cant pick up from this address. Select a different address.">
<!ENTITY paymentMethodsLabel "Payment Method">
<!ENTITY address.addLink.label "Add">
<!ENTITY address.editLink.label "Edit">
@ -63,16 +63,14 @@
<!ENTITY addressPage.addButton.label "Add">
<!ENTITY addressPage.updateButton.label "Update">
<!ENTITY addressPage.persistCheckbox.label "Save address to &brandShortName;">
<!ENTITY failErrorPage.title "Sorry! Something went wrong with the payment process.">
<!ENTITY failErrorPage.suggestion1 "Check your credit card has not expired.">
<!ENTITY failErrorPage.suggestion2 "Make sure your credit card information is accurate.">
<!ENTITY failErrorPage.suggestion3 "If no other solutions work, check with **host-name**.">
<!ENTITY failErrorPage.doneButton.label "OK">
<!ENTITY timeoutErrorPage.title "Whoops! **host-name** took too long to respond.">
<!ENTITY timeoutErrorPage.suggestion1 "Try again later.">
<!ENTITY timeoutErrorPage.suggestion2 "Check your network connection." >
<!ENTITY timeoutErrorPage.suggestion3 "If no other solutions work, check with **host-name**.">
<!ENTITY timeoutErrorPage.doneButton.label "OK">
<!ENTITY failErrorPage.title "We couldnt complete your payment to **host-name**">
<!ENTITY failErrorPage.suggestionHeading "The most likely cause is a hiccup with your credit card.">
<!ENTITY failErrorPage.suggestion1 "Make sure the card youre using hasnt expired">
<!ENTITY failErrorPage.suggestion2 "Double check the card number and expiration date">
<!ENTITY failErrorPage.doneButton.label "Close">
<!ENTITY timeoutErrorPage.title "**host-name** is taking too long to respond.">
<!ENTITY timeoutErrorPage.suggestionHeading "The most likely cause is a temporary connection hiccup. Open a new tab to check your network connection or click “Close” to try again.">
<!ENTITY timeoutErrorPage.doneButton.label "Close">
<!ENTITY webPaymentsBranding.label "&brandShortName; Checkout">
<!ENTITY invalidOption.label "Missing or invalid information">
]>
@ -199,16 +197,14 @@
<completion-error-page id="completion-timeout-error" class="illustrated"
data-page-title="&timeoutErrorPage.title;"
data-suggestion-1="&timeoutErrorPage.suggestion1;"
data-suggestion-2="&timeoutErrorPage.suggestion2;"
data-suggestion-3="&timeoutErrorPage.suggestion3;"
data-suggestion-heading="&timeoutErrorPage.suggestionHeading;"
data-done-button-label="&timeoutErrorPage.doneButton.label;"
hidden="hidden"></completion-error-page>
<completion-error-page id="completion-fail-error" class="illustrated"
data-page-title="&failErrorPage.title;"
data-suggestion-heading="&failErrorPage.suggestionHeading;"
data-suggestion-1="&failErrorPage.suggestion1;"
data-suggestion-2="&failErrorPage.suggestion2;"
data-suggestion-3="&failErrorPage.suggestion3;"
data-done-button-label="&failErrorPage.doneButton.label;"
hidden="hidden"></completion-error-page>
</div>

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

@ -18,9 +18,9 @@ Test the completion-error-page component
<p id="display">
<completion-error-page id="completion-timeout-error" class="illustrated"
data-page-title="Sample Title"
data-suggestion-heading="Sample suggestion heading"
data-suggestion-1="Sample suggestion"
data-suggestion-2="Sample suggestion"
data-suggestion-3="Sample suggestion"
data-done-button-label="OK"></completion-error-page>
</p>
<div id="content" style="display: none">
@ -38,9 +38,12 @@ let page = document.getElementById("completion-timeout-error");
add_task(async function test_no_values() {
ok(page, "page exists");
is(page.dataset.pageTitle, "Sample Title", "Title set on page");
is(page.dataset["suggestion-1"], "Sample suggestion", "Suggestion 1 set on page");
is(page.dataset["suggestion-2"], "Sample suggestion", "Suggestion 2 set on page");
is(page.dataset["suggestion-3"], "Sample suggestion", "Suggestion 3 set on page");
is(page.dataset.suggestionHeading, "Sample suggestion heading",
"Suggestion heading set on page");
is(page.dataset["suggestion-1"], "Sample suggestion",
"Suggestion 1 set on page");
is(page.dataset["suggestion-2"], "Sample suggestion",
"Suggestion 2 set on page");
page.dataset.pageTitle = "Oh noes! **host-name** is having an issue";
page.dataset["suggestion-2"] = "You should probably blame **host-name**, not us";
@ -58,12 +61,17 @@ add_task(async function test_no_values() {
is(page.requestStore.getState().request.topLevelPrincipal.URI.displayHost, displayHost,
"State should have the displayHost set properly");
is(page.dataset.pageTitle, `Oh noes! ${displayHost} is having an issue`,
is(page.querySelector("h2").textContent,
`Oh noes! ${displayHost} is having an issue`,
"Title includes host-name");
is(page.dataset["suggestion-1"], "Sample suggestion", "Suggestion 1 set on page");
is(page.dataset["suggestion-2"], `You should probably blame ${displayHost}, not us`,
is(page.querySelector("p").textContent,
"Sample suggestion heading",
"Suggestion heading set on page");
is(page.querySelector("li:nth-child(1)").textContent, "Sample suggestion",
"Suggestion 1 set on page");
is(page.querySelector("li:nth-child(2)").textContent,
`You should probably blame ${displayHost}, not us`,
"Suggestion 2 includes host-name");
is(page.dataset["suggestion-3"], "Sample suggestion", "Suggestion 3 set on page");
});
</script>

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

@ -249,7 +249,7 @@ add_task(async function test_timeout_fail_completeStatus() {
ok(payButton != primaryButton,
`Primary button is the not pay button in the ${completeStatus} state`);
ok(isHidden(payButton), "Pay button is not visible");
is(primaryButton.textContent, "OK", "Check button label");
is(primaryButton.textContent, "Close", "Check button label");
let rect = primaryButton.getBoundingClientRect();
let visibleElement =