fix: correctly mark program dashboard and details translations string (#32242)

This commit is contained in:
Nawfal Ahmed
2023-05-16 17:02:54 +05:00
committed by GitHub
parent 7174da78d0
commit 30a66120fd
7 changed files with 48 additions and 61 deletions

View File

@@ -45,10 +45,10 @@ describe('Sidebar View', () => {
expect(view.$('.js-subscription-upsell .badge').html().trim())
.toEqual('New');
expect(view.$('.js-subscription-upsell h4').html().trim())
.toEqual('Monthly program subscriptions now available');
expect(view.$('.js-subscription-upsell .advertise-message'))
.toContainText(
'An easier way to access popular programs with more control over how much you spend.'
.toMatch(/^Monthly program subscriptions . more flexible, more affordable$/);
expect(view.$('.js-subscription-upsell .advertise-message').html().trim())
.toEqual(
'Now available for many popular programs, affordable monthly subscription pricing can help you manage your budget more effectively. Subscriptions start at $39/month USD per program, after a 7-day full access free trial. Cancel at any time.'
);
expect(view.$('.js-subscription-upsell a span:last').html().trim())
.toEqual('Explore subscription options');

View File

@@ -55,33 +55,20 @@ class ProgramAlertListView extends Backbone.View {
})
);
return alertList.concat(this.trialEndingAlerts.map(
({ title: programName, remainingDays, ...data }) => {
const title = 'Subscription trial expires in {remainingDays} day';
const message = 'Your {programName} trial will expire in {remainingDays} day at {trialEndTime} on {trialEndDate} and the card on file will be charged {subscriptionPrice}/month.';
return {
title: StringUtils.interpolate(
ngettext(
title,
title.replace(/\bday\b/, 'days'),
remainingDays
),
{ remainingDays }
),
message: StringUtils.interpolate(
ngettext(
message,
message.replace(/\bday\b/, 'days'),
remainingDays
),
{
programName,
remainingDays,
...data,
}
),
};
}
({ title: programName, remainingDays, ...data }) => ({
title: StringUtils.interpolate(
ngettext('Subscription trial expires in {remainingDays} day', 'Subscription trial expires in {remainingDays} days', remainingDays),
{ remainingDays }
),
message: StringUtils.interpolate(
ngettext('Your {programName} trial will expire in {remainingDays} day at {trialEndTime} on {trialEndDate} and the card on file will be charged {subscriptionPrice}/month.', 'Your {programName} trial will expire in {remainingDays} days at {trialEndTime} on {trialEndDate} and the card on file will be charged {subscriptionPrice}/month.', remainingDays),
{
programName,
remainingDays,
...data,
}
),
})
));
}
}

View File

@@ -11,24 +11,23 @@
<% if (isSubscriptionEligible) { %>
<aside class="aside js-subscription-info subscription-info">
<h2 class="divider-heading">
<%- gettext(
hasActiveTrial
? 'Trial subscription'
<%- hasActiveTrial
? gettext('Trial subscription')
: subscriptionState === 'active'
? 'Active subscription'
: 'Inactive subscription'
) %>
? gettext('Active subscription')
: gettext('Inactive subscription')
%>
</h2>
<div class="sidebar-section">
<div class="subscription-section">
<p class="my-0">
<%= HtmlUtils.interpolateHtml(
gettext(
(
subscriptionState === 'active'
? 'View your receipts or modify your subscription on the {a_start}Orders and subscriptions{a_end} page'
? gettext('View your receipts or modify your subscription on the {a_start}Orders and subscriptions{a_end} page')
: subscriptionState === 'inactive'
? 'Restart your subscription for {subscriptionPrice}/month. Your payment history is still available on the {a_start}Orders and subscriptions{a_end} page'
: 'If you had a subscription previously, your payment history is still available on the {a_start}Orders and subscriptions{a_end} page'
? gettext('Restart your subscription for {subscriptionPrice}/month. Your payment history is still available on the {a_start}Orders and subscriptions{a_end} page')
: gettext('If you had a subscription previously, your payment history is still available on the {a_start}Orders and subscriptions{a_end} page')
),
{
subscriptionPrice,
@@ -39,9 +38,7 @@
</p>
<p class="my-0">
<%= HtmlUtils.interpolateHtml(
gettext(
'Need help? Check out the {a_start}Learner Help Center{span_start}{icon}{span_end}{a_end} to troubleshoot issues or contact support '
),
gettext('Need help? Check out the {a_start}Learner Help Center{span_start}{icon}{span_end}{a_end} to troubleshoot issues or contact support'),
{
a_start: HtmlUtils.HTML(`<a class="subscription-link" href="${subscriptions_learner_help_center_url}" target="_blank" rel="noopener noreferrer">`),
a_end: HtmlUtils.HTML('</a>'),

View File

@@ -83,14 +83,14 @@
</a>
<span class="subscription-info-brief">
<%- StringUtils.interpolate(
gettext(
(
hasActiveTrial
? 'Active trial ends {trialEndDate} at {trialEndTime}'
? gettext('Active trial ends {trialEndDate} at {trialEndTime}')
: subscriptionState === 'active'
? 'Your next billing date is {nextPaymentDate}'
? gettext('Your next billing date is {nextPaymentDate}')
: subscriptionState === 'inactive'
? 'Unlock verified access to all courses for {subscriptionPrice}/month. Cancel anytime.'
: '{subscriptionPrice}/month subscription after trial ends. Cancel anytime.'
? gettext('Unlock verified access to all courses for {subscriptionPrice}/month. Cancel anytime.')
: gettext('{subscriptionPrice}/month subscription after trial ends. Cancel anytime.')
),
{
subscriptionPrice,

View File

@@ -58,14 +58,14 @@
</a>
<span class="subscription-info-brief">
<%- StringUtils.interpolate(
gettext(
(
hasActiveTrial
? 'Active trial ends {trialEndDate} at {trialEndTime}'
? gettext('Active trial ends {trialEndDate} at {trialEndTime}')
: subscriptionState === 'active'
? 'Your next billing date is {nextPaymentDate}'
? gettext('Your next billing date is {nextPaymentDate}')
: subscriptionState === 'inactive'
? 'Unlock verified access to all courses for {subscriptionPrice}/month. Cancel anytime.'
: '{subscriptionPrice}/month subscription after trial ends. Cancel anytime.'
? gettext('Unlock verified access to all courses for {subscriptionPrice}/month. Cancel anytime.')
: gettext('{subscriptionPrice}/month subscription after trial ends. Cancel anytime.')
),
{
subscriptionPrice,

View File

@@ -1,10 +1,13 @@
<span class="badge badge-warning align-self-start"><%- gettext('New') %></span>
<h4 class="m-0"><%- gettext('Monthly program subscriptions now available') %></h4>
<h4 class="m-0">
<%= HtmlUtils.interpolateHtml(
gettext('Monthly program subscriptions {emDash} more flexible, more affordable'),
{ emDash: HtmlUtils.HTML('&mdash;') }
) %>
</h4>
<p class="advertise-message">
<%- StringUtils.interpolate(
gettext(
'An easier way to access popular programs with more control over how much you spend. Starting at {minSubscriptionPrice} per month after a {trialLength}-day free trial. Cancel anytime.'
),
gettext('Now available for many popular programs, affordable monthly subscription pricing can help you manage your budget more effectively. Subscriptions start at {minSubscriptionPrice}/month USD per program, after a 7-day full access free trial. Cancel at any time.'),
{ minSubscriptionPrice, trialLength }
) %>
</p>

View File

@@ -9,10 +9,10 @@
</a>
<span class="subscription-info-upsell">
<%- StringUtils.interpolate(
gettext(
(
subscriptionState === 'inactive'
? 'Pay {subscriptionPrice}/month for all courses in this program'
: 'Pay {subscriptionPrice}/month after {trialLength}-day free trial'
? gettext('Pay {subscriptionPrice}/month for all courses in this program')
: gettext('Pay {subscriptionPrice}/month after {trialLength}-day free trial')
),
{ subscriptionPrice, trialLength },
) %>