-
I need to show inside Bento (e.g. a Label) components some text that is a user input and that will be not translated. It is correct to pass such text through |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @mperrando, it's correct, Two more things:
|
Beta Was this translation helpful? Give feedback.
Hi @mperrando, it's correct,
LocalizedString
is there to ensure you don't forget localizing a component, but if you're sure this is user generated content you can definitely useunsafeLocalizedString
.Two more things:
if these strings come from an external source, you may want to validate those and convert them to
LocalizedString
during the validation (e.g. using something like https://github.com/colinhacks/zod)I would recommend to limit the number of
unsafeLocalizedString
around the app, so if possible I would create a dedicated component likeUserGeneratedLabel
or something, which acceptsstring
and wraps the actualunsafeLocalizedString
usage