Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OEP-58 feat needed: convert all hadrdcoded strings to use react-intl/FormattedMessage #974

Open
OmarIthawi opened this issue Mar 8, 2023 · 0 comments

Comments

@OmarIthawi
Copy link
Member

OmarIthawi commented Mar 8, 2023

i18n support is being added via #973 with two strings using FormattedMessage. The rest of the hard-coded strings need to be converted to use FormattedMessage.

Examples:

{isBrowseAndRequestFeatureAlertShown && <NewFeatureAlertBrowseAndRequest />}
<div className="ml-4">
<h4 style={{ display: 'inline-block' }}>Licenses:</h4>
<Badge className="mr-2 ml-2" variant="light">Unassigned: {subscription.licenses?.unassigned}
{' of '}
{subscription.licenses?.total} total
</Badge>
<Badge variant="light">Activated: {subscription.licenses?.activated}
{' of '}
{activatedAndAssigned} assigned

<InviteLearnersButton
onSuccess={({ numAlreadyAssociated, numSuccessfulAssignments }) => {
forceRefresh();
forceRefreshDetailView();
setToastMessage(`${numAlreadyAssociated} email addresses were previously assigned. ${numSuccessfulAssignments} email addresses were successfully added.`);
setShowToast(true);
}}
disabled={subscription.isLockedForRenewalProcessing}
/>
</div>

<Field
name="email-addresses"
component={TextAreaAutoSize}
label="Email Address"
description="To add more than one user, enter one email address per line."
data-hj-suppress
/>
<p className="pb-2">
OR
</p>
<Field
id="csv-email-addresses"
name="csv-email-addresses"
component={FileInput}
label="Upload Email Addresses"
description="The file must be a CSV containing a single column of email addresses."
accept=".csv"
normalize={normalizeFileUpload}
data-hj-suppress
/>
<h3>Email Template</h3>
<Field
name="email-template-greeting"
component={TextAreaAutoSize}
label="Customize Greeting"
data-hj-suppress
/>
<Field
name="email-template-body"
component={TextAreaAutoSize}
label="Body"
disabled
/>
<Field
name="email-template-closing"
component={TextAreaAutoSize}
label="Customize Closing"
data-hj-suppress
/>
</div>

const emailTemplate = {
greeting: 'Congratulations!',
body: `{ENTERPRISE_NAME} has partnered with edX to give you an unlimited subscription to learn on edX! Take the best courses in the most in-demand subject areas and upskill for a new career opportunity. Earn a professional certificate, start a program or just learn for fun.
{LICENSE_ACTIVATION_LINK}
About edX
Since 2012, edX has been committed to increasing access to high-quality education for everyone, everywhere. By harnessing the transformative power of education through online learning, edX empowers learners to unlock their potential and become changemakers.
We are excited to welcome you to our growing community of over 35 million users and 15 thousand instructors from 160 partner universities and organizations.
`,
closing: getSubscriptionContactText,
};

Loading...
<span className="sr-only">Loading</span>

export const FILE_SIZE_EXCEEDS_ERROR = 'Total files size exceeds 250kb';

export const ACTIVATED = 'activated';
export const ASSIGNED = 'assigned';
export const REVOKED = 'revoked';
export const REVOCABLE_STATUSES = [ACTIVATED, ASSIGNED];
export const ENROLLABLE_STATUSES = [ACTIVATED, ASSIGNED];
export const SUBSCRIPTIONS = 'Subscriptions';
export const SUBSCRIPTION_USERS = 'Subscription Users';
export const SUBSCRIPTION_USERS_OVERVIEW = 'Subscription Users Overview';
export const NETWORK_ERROR_MESSAGE = 'Error occurred while loading the data.';
export const DEFAULT_PAGE = 1;
// used to determine whether to show the revocation cap messaging in the license revoke modal
export const SHOW_REVOCATION_CAP_PERCENT = 80;
// Subscription expiration
// Days until expiration constants
export const SUBSCRIPTION_DAYS_REMAINING_MODERATE = 120;
export const SUBSCRIPTION_DAYS_REMAINING_SEVERE = 60;
export const SUBSCRIPTION_DAYS_REMAINING_EXCEPTIONAL = 30;
export const SUBSCRIPTION_PLAN_RENEWAL_LOCK_PERIOD_HOURS = 12;
// Prefix for cookies that determine if the user has seen the modal for that range of expiration
export const SEEN_SUBSCRIPTION_EXPIRATION_MODAL_COOKIE_PREFIX = 'seen-expiration-modal-';
// Multiple subscription picker
export const DEFAULT_LEAD_TEXT = 'Invite your learners to access your course catalog and manage your subscription cohorts.';
// user status badge mapping, takes user status as key returns label and badge style defined by ux
export const USER_STATUS_BADGE_MAP = {
[ACTIVATED]: { label: 'Active', variant: 'success' },
[ASSIGNED]: { label: 'Pending', variant: 'warning' },
[REVOKED]: { label: 'Revoked', variant: 'light' },
};
// Subscription statuses
export const ACTIVE = 'Active';
export const ENDED = 'Ended';
export const SCHEDULED = 'Scheduled';
export const SUBSCRIPTION_STATUS_BADGE_MAP = {
[ACTIVE]: { variant: 'primary' },
[SCHEDULED]: { variant: 'secondary' },
[ENDED]: { variant: 'light' },
};
// Browse and request constants `BrowseAndRequestAlert`
export const BROWSE_AND_REQUEST_ALERT_COOKIE_PREFIX = 'dismissed-browse-and-request-alert';
export const BROWSE_AND_REQUEST_ALERT_TEXT = 'New! You can now allow all learners to browse'
+ ' your catalog and request enrollment to courses.';
export const REDIRECT_SETTINGS_BUTTON_TEXT = 'Go to settings';
// Tabs
export const MANAGE_LEARNERS_TAB = 'manage-learners';
export const MANAGE_REQUESTS_TAB = 'manage-requests';
const MANAGE_LEARNERS_TAB_LABEL = 'Manage Learners';
const MANAGE_REQUESTS_TAB_LABEL = 'Manage Requests';

@OmarIthawi OmarIthawi changed the title feat needed: convert all hadrdcoded strings to use react-intl/FormattedMessage OEP-58 feat needed: convert all hadrdcoded strings to use react-intl/FormattedMessage Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant