Skip to content

Gen3: Use i18next instead of loc#3689

Open
denysoblohin-okta wants to merge 34 commits into
masterfrom
od-test-i18next
Open

Gen3: Use i18next instead of loc#3689
denysoblohin-okta wants to merge 34 commits into
masterfrom
od-test-i18next

Conversation

@denysoblohin-okta

@denysoblohin-okta denysoblohin-okta commented Aug 9, 2024

Copy link
Copy Markdown
Contributor

Description:

Use i18next library for Gen3 instead of Courage's loc function for pluralization support

Example: use

password.complexity.length.description_one = At least one character
password.complexity.length.description_other = At least {0} characters
# fallback (same as _other)
password.complexity.length.description = At least {0} characters

instead of single

password.complexity.length.description = At least {0} characters

PR Checklist

Issue:

Reviewers:

Screenshot/Video:

Downstream Monolith Build:

Comment thread src/v3/src/util/locUtil.ts Outdated
// No need to escape
// Need to use raw value for phone numbers containing `‎`
// React is already safe from XSS
escapeValue: false,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +691 to +693
password.complexity.minAgeMinutes.description = At least {0} minute(s) must have elapsed since you last changed your password
password.complexity.minAgeMinutes.description_one = At least {0} minute must have elapsed since you last changed your password
password.complexity.minAgeMinutes.description_other = At least {0} minutes must have elapsed since you last changed your password

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of using plural forms

Comment thread src/v3/src/util/languageUtils.ts Outdated

@lesterchoi-okta lesterchoi-okta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to ask folks from g11n to review as well

Comment thread src/v3/src/util/languageUtils.ts Outdated
Comment thread src/v3/src/util/languageUtils.ts Outdated
Comment on lines -25 to +26
const authCoinConfiguration = getAuthCoinConfiguration();
const authCoinConfigByAuthKey = props?.authenticatorKey
&& authCoinConfiguration[props?.authenticatorKey];
&& getAuthCoinConfiguration()[props.authenticatorKey];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a necessary change, just small optimisation.
Noticed that for pages that don't have auth coin there will be a lot of unnecessary loc calls inside getAuthCoinConfiguration()

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

Successfully merging this pull request may close these issues.

2 participants