Closed hww closed 1 year ago
Thanks for your interest in using bootstrap_form
!
I haven't done a lot of work with bootstrap_form
and internationalization. What I remember is that internationalization is hard.
What's mentioned here is basicallly that, if you don't need to specify your own label text, then bootstrap_form
will act just like regular Rails forms, as covered in the Rails guides. If I recall correctly, even that can be a bit tricky. Rails doesn't come out of the box with translations, so you need to find a gem (rails-i18n
) that provides translations for the standard Rails error messages.
If you want to provide your own translated labels, then you need to use the label
option, but providing a string from Rails' translations, typically by saying something like: label: I18n.t("key.to.translation")
in the parameters of the bootstrap_form
method you're calling. That means you've set up the locale files with translations, and that you have the right language selected.
You could take a look at the views in this gem for some ideas. The same gem has a Spanish test app that might help.
Let me know if this helps, or if you have other questions.
You are right, everything works as you said. To translate the lablel and help -- I use this text
ru:
activerecord:
attributes:
user:
email: "Адрес электронной почты"
help:
user:
email: "Должен использоваться уникальный электронный адрес"
The README.md has info about translation 'helps' but I do not see the way how to do translation of labels. So, how to do it?
Ruby 3.2.1 Rails 7.0.4.2