Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ICU custom translation ids #48668

Copy link
Copy link
Open
Open
Copy link
@LukasAV

Description

@LukasAV
Issue body actions

Which @angular/* package(s) are relevant/related to the feature request?

localize

Description

I would like to use custom IDs on ICU expression translations.

The following template

<h1 i18n="@@IcuPluralTest">ICU plural test {test, plural, =0 {now} other {{{test}} minutes}}</h1>

Results in two translations in json output format:

"IcuPluralTest": "ICU plural test {$ICU}",
"5042638883563958958": "{VAR_PLURAL, plural, =0 {now} other {{INTERPOLATION} minutes}}",

However, I have no way to assign a custom ID to the nested ICU expression

Proposed solution

Enable a syntax like

<h1 i18n="@@IcuPluralTest">ICU plural test {:@@IcuPluralTestNested:test, plural, =0 {now} other {{{test}} minutes}}</h1>

that allows assigning an ID to the nested ICU expression

Alternatives considered

As a workaround, a simple interpolation can be used in the template

<h1 i18n="@@IcuPluralTest">ICU plural test {{testPlural}}</h1>

with the ICU expression being defined in the .ts file using intl-messageformat

testPlural = new IntlMessageFormat($localize`:@@IcuPluralTestNested:{test, plural, =0 {now} other {# minutes}}`, $localize.locale).format(this as any);

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18nIssues related to localization and internationalizationIssues related to localization and internationalizationfeatureIssue that requests a new featureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsLabel to add when the not a sufficient number of votes or comments from unique authors

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.