Skip to content

Fix/bobbor/i18n texts#6968

Open
bobbor wants to merge 4 commits into
mainfrom
fix/bobbor/i18n-texts
Open

Fix/bobbor/i18n texts#6968
bobbor wants to merge 4 commits into
mainfrom
fix/bobbor/i18n-texts

Conversation

@bobbor
Copy link
Copy Markdown
Member

@bobbor bobbor commented Apr 24, 2026

Description of changes

This change introduces a more fine-grained control over translation texts in the Authenticator.

1.) strings do accept placeholders and values now.

translations with different positions of values is allowed. no more fragile construction in the source code.

// in english
an email has been sent to {emailAddress}.

// in german
Wir haben eine Email an {emailAddress} gesendet.

2.) punctuation is part of translation

Since the japanese language uses different period signs for delimiting sentences and in thai it is common to not use any at all. the translation controls punctuation.
This allows for a more natural way of communcation.

3.) backwards compatibility
a small number of keys has been introduced to the translation files for backwards compatibility and to even out cognito inconsistencies.

Issue #, if available

#6966

Description of how you validated changes

  • the textUtils class contains unit-tests. these still pass.
  • the Authenticator still renders.

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • yarn test passes and tests are updated/added
  • PR title and commit messages follow conventional commit syntax
  • If this change should result in a version bump, changeset added (This can be done after creating the PR.) This does not apply to changes made to docs, e2e, examples, or other private packages.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Add optional values parameter to translate() for {placeholder} replacement.
Uses replaceAll() for safe literal string substitution — no regex injection
risk. Fully backward compatible with existing callers.
@bobbor bobbor requested a review from a team as a code owner April 24, 2026 15:00
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

🦋 Changeset detected

Latest commit: 32ab739

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@aws-amplify/ui Patch
@aws-amplify/ui-react-core-notifications Patch
@aws-amplify/ui-react-core Patch
@aws-amplify/ui-react-liveness Patch
@aws-amplify/ui-react-native Patch
@aws-amplify/ui-react-notifications Patch
@aws-amplify/ui-react-storage Patch
@aws-amplify/ui-react Patch
@aws-amplify/ui-svelte Patch
@aws-amplify/ui-vue Patch
@aws-amplify/ui-angular Patch
@aws-amplify/ui-react-geo Patch
@aws-amplify/ui-test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

bobbor added 3 commits April 24, 2026 18:07
…Texts

- Move hardcoded periods from template literals into translated strings,
  fixing #6966 (wrong punctuation in Japanese and other non-Latin locales)
- Add composite delivery message keys with {destination} and
  {arrivalMessage} placeholders — all punctuation now controlled by
  translators
- Promote CONFIGURATION_ERROR (was hardcoded with en-dash U+2013),
  COPIED, SETUP_TOTP_INSTRUCTIONS, INVALID_EMAIL, FIELD_REQUIRED to
  DefaultTexts constants
- Rewrite getDeliveryMessageText to use translate() interpolation
  instead of template literal concatenation
…tions

- Add period-inclusive translation keys for delivery messages across all
  19 locale dictionaries with locale-appropriate punctuation (。for
  Japanese/Chinese, no periods for Thai)
- Add composite delivery message translations with {destination} and
  {arrivalMessage} placeholders
- Add both period variants of Cognito error keys as aliases (additive
  only, no keys removed) to prevent silent translation failures
- Existing keys preserved for backward compatibility
@bobbor bobbor force-pushed the fix/bobbor/i18n-texts branch from a727612 to 32ab739 Compare April 24, 2026 16:08
*/
export function translate<T extends string>(phrase: T): string {
return I18n.get(phrase);
export function translate<T extends string>(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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