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
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:
option(:title), type: Types::String.optional, optional: true
# some code
def displayable_title
title || default_title
end
def default_title
t('some.translation.key')
end
While reviewing our monster upgrade PR, some colleagues noted that we can use I18n.t('some.translation.key') for our default proc and it doesn't raise the method. I'm curious as to the thoughts on the subject after reviewing the exposed translate/t methods in VC Translatable. Would we expect this to also raise the Translate, or is it safe due to I18n rather than the VCs translate method?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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
I18n.t('some.translation.key')
for our default proc and it doesn't raise the method. I'm curious as to the thoughts on the subject after reviewing the exposed translate/t methods in VC Translatable. Would we expect this to also raise the Translate, or is it safe due to I18n rather than the VCs translate method?Beta Was this translation helpful? Give feedback.
All reactions