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

Fix literal interpolation for curly brackets for Translation Strings #16235

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

azrikahar
Copy link
Contributor

Description

Fixes #16164

#15872 applied the general literal interpolation fix for Translation Strings. However as we can use them in custom extensions and have the flexibility of using named formatting (eg. my {custom} string), this PR opts to keep curly brackets intact for Translations Strings.

For example, when we have the following translation string setup:

and when we subsequently use named formatting in our extension such as t("custom_string", { first: "My", second: "test here" }), it will now be formatted correctly:

Before After

Type of Change

  • Bugfix
  • Improvement
  • New Feature
  • Refactor / codestyle updates
  • Other, please describe:

Requirements Checklist

  • New / updated tests are included
  • All tests are passing locally
  • Performed a self-review of the submitted code

If adding a new feature:

  • Documentation was added/updated. PR:

Copy link
Member

@br41nslug br41nslug left a comment

Choose a reason for hiding this comment

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

LGTM! tested with a custom module using translation strings with placeholders which do stay intact now as expected in this branch.

@rijkvanzanten rijkvanzanten merged commit 2c0ad89 into main Nov 1, 2022
@rijkvanzanten rijkvanzanten deleted the issue/16164 branch November 1, 2022 20:04
@rijkvanzanten rijkvanzanten added this to the Next Release milestone Nov 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Placeholders/interpolations with curly braces in translations stopped working
3 participants