TranslateCalledBeforeRender Avoidance #1935
-
Hello VC Practitioners! We are in the process of upgrading from 2.56 -> 3.8 with most of our challenges related to slot syntax, test helper changes, and the translate before render. We use DryInitializer and types to setup our VC options. One of our practices was to use a default translation for certain text:
This understandably caused the errors to trigger and we landed on an optional string and a default translation that would be picked when the component is rendered:
While reviewing our monster upgrade PR, some colleagues noted that we can use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@JWShuff the reason we raise on calling |
Beta Was this translation helpful? Give feedback.
@JWShuff the reason we raise on calling
t
before rendering a component is that a component can define its own local translations. If you don't use component-specific translations, callingI18n.t('some.translation.key')
will work just fine.