String! Translate yourself! A very хорошо gem!
Finnish, English, Japanese, Russian!
Translate Ruby strings in Rails to a language of your choice! Any and all languages supported, as long as they're also supported by DeepL. If your language is not supported at the moment, you just need to wait a bit. Or make a PR for TranslateSelf to add Google Translate backend to it.
supported languages are: Bulgarian, Chinese, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Greek, Hungarian, Italian, Japanese, Latvian, Lithuanian, Polish, Portuguese, Romanian, Russian, Slovak, Slovenian, Spanish, and Swedish.
Easy to use!
Now your models get superpowers if they have string fields:
user = User.find(2020) user.favorite_food # or any field name that is a string in Ruby # hamburgers user.favorite_food.to_ru # or to_fi, to_es, to_ja... # гамбургер
Just get a DeepL auth key (free!), and create an initializer(
config/initializers/active_translate_self.rb), add the auth key to your Rails credentials file with the following command:
$ EDITOR="vim" rails credentials:edit
Inside, the file should look like below:
deepl: auth_key: 'my-auth-key'
And the initializer should just read that value like below:
ActiveTranslateSelf.auth_key = Rails.application.credentials.dig(:deepl, :auth_key)
The TranslateSelf gem uses the free DeepL servers by default, but you can also set
ActiveTranslateSelf.host if you want to use the pro license servers.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install active_translate_self
Build on top of TranslateSelf and DeepL for Ruby.
Contributions are welcome! Взносы приветствуются! Las contribuciones son bienvenidas! 投稿(コントリビューション)を歓迎します！
The gem is available as open source under the terms of the MIT License.