Is there an existing issue for this?
Which Transloco package(s) are the source of the bug?
Transloco, MessageFormat
Is this a regression?
No
Current behavior
I am currently migrating a project to @jsverse/transloco and I am facing the following issue:
Some of our localization files include translations within translations in addition to MessageFormat use cases which both use the same interpolation characters ({ }) so we updated the provideTransloco config with the following parameter: interpolation: ['{', '}'],
When calling the transloco pipe in our components, the MessageFormatTranspiler calls the default transpiler before compiling MessageFormat, which causes issues when MessageFormat patterns are processed as regular interpolation placeholders (it attempts to interpolate the MessageFormat patterns as translation keys and since these are not found in the translations, it returns an empty string).
Could you explain a potential workaround to fix this use case? Or a potential fix to the MessageFormatCompiler?
Expected behavior
We expect the translations to be updated and if not found then passed to the MessageFormat compiler
Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.
https://codesandbox.io/p/sandbox/jsverse-transloco-kn52hs
Transloco Config
provideTransloco({
config: {
...
interpolation: ['{', '}'],
}
}),
provideTranslocoMessageformat()
Please provide the environment you discovered this bug in
Transloco: ~8.0.0
Angular: ~20.3.0
Node: >=22.11.0
Package Manager: yarn
OS:
Browser
Additional context
As you can see in the code sandbox preview, when changing the config to interpolation: ["{", "}"] in the app.config.ts, the examples on the Transpilers page no longer work.
I would like to make a pull request for this bug
No
Is there an existing issue for this?
Which Transloco package(s) are the source of the bug?
Transloco, MessageFormat
Is this a regression?
No
Current behavior
I am currently migrating a project to
@jsverse/translocoand I am facing the following issue:Some of our localization files include translations within translations in addition to MessageFormat use cases which both use the same interpolation characters (
{}) so we updated theprovideTranslococonfig with the following parameter:interpolation: ['{', '}'],When calling the transloco pipe in our components, the
MessageFormatTranspilercalls the default transpiler before compiling MessageFormat, which causes issues when MessageFormat patterns are processed as regular interpolation placeholders (it attempts to interpolate the MessageFormat patterns as translation keys and since these are not found in the translations, it returns an empty string).Could you explain a potential workaround to fix this use case? Or a potential fix to the
MessageFormatCompiler?Expected behavior
We expect the translations to be updated and if not found then passed to the MessageFormat compiler
Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.
https://codesandbox.io/p/sandbox/jsverse-transloco-kn52hs
Transloco Config
provideTransloco({ config: { ... interpolation: ['{', '}'], } }), provideTranslocoMessageformat()Please provide the environment you discovered this bug in
Browser
Additional context
As you can see in the code sandbox preview, when changing the config to
interpolation: ["{", "}"]in theapp.config.ts, the examples on the Transpilers page no longer work.I would like to make a pull request for this bug
No