The project is in a healthy, maintained state
ActiveTranslateSelf is a Rails engine that hacks the Ruby string class and lets them translate \ themselves. Supports English, Finnish, Japanese, and others!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
 Dependencies

Development

>= 0

Runtime

>= 5.2
 Project Readme

ActiveTranslateSelf

Gem Version Gem Downloads

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:

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.

Usage

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.

Installation

Add this line to your application's Gemfile:

gem 'active_translate_self'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_translate_self

Build on top of TranslateSelf and DeepL for Ruby.

TranslateSelf.

DeepL for ruby.

Contributing

Contributions are welcome! Взносы приветствуются! Las contribuciones son bienvenidas! 投稿(コントリビューション)を歓迎します!

License

The gem is available as open source under the terms of the MIT License.