Allows using component to render i18n strings and substitute attributes with components.
translation.key: '<p>Lets test {count, plural, =1 {# complex part} other {# complex parts}} with {type}. [[[link]]] to the outer world. Or [[[component]]].</p>',
- Ember.js v3.20 or above
- Ember CLI v3.20 or above
- Node.js v12 or above
ember install ember-intl-component
i18n
component creates new components dynamically in runtime
for each individual translation key. As a first step, translation
will be passed through ember-intl t
helper, then processed with
withing i18n component.
Simple case
welcome: 'Welcome, {name}!',
P.S in cases like that, it's better to use just {{t}}
helper.
With component usage
translation.key: 'With component: [[[welcome]]]',
Inline component in translation
translation.key: 'Welcome, <WelcomeComponent @name="Zoe" />!',
Output will be
P.S Keep in mind, as it will render any html passed to it, even <script>
tags.
Only use that where you are 100% sure that content is safe.
See the Contributing guide for details.
This project is licensed under the MIT License.