You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// en/messages.po
msgid "{price} for {numberOfDays} days"
this is great as it provides context for translators about the available parameters.
All non-simple identifiers; not so great
However, it is only supported with simple identifiers, and anything else is replaced with positional parameters. The result is that identifiers/paths of nested references also get thrown out the window:
t(`${product.price} for ${product.numberOfDays} days`)
This behavior is defined here, but I would like it to not include nested paths as they are named. For nested paths it would be great if the leaf node or full path could be included so that it works like:
t(`${product.price} for ${product.numberOfDays} days`)
Actually, there is a new feature in the v5 pre-release that aims to provide additional context about placeholders in exactly the same case as you describe.
Problem
Simple identifier works great
When using string interpolation for message arguments like:
the parameter extracted is named:
this is great as it provides context for translators about the available parameters.
All non-simple identifiers; not so great
However, it is only supported with simple identifiers, and anything else is replaced with positional parameters. The result is that identifiers/paths of nested references also get thrown out the window:
Proposed solution
This behavior is defined here, but I would like it to not include nested paths as they are named. For nested paths it would be great if the leaf node or full path could be included so that it works like:
The text was updated successfully, but these errors were encountered: