Project

translated

0.0
The project is in a healthy, maintained state
Simple, automatic translations for your Rails app.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Translated

Simple, automatic translations for your Rails app with https://translatedrb.com.

Usage

Translated can handle both plain text and rich text (using Action Text).

These helpers will let you work with the content attribute like you normally would. The return value of this attribute will always be in the language specified by I18n.locale. So if it's set to :es, then you'll get Spanish.

When you set the value, it will save that for the current locale and then create translations for every locale listed in the I18n.available_locales list.

For plain text, simply add this to your model:

class Message < ApplicationRecord
  has_translated_text_field :content
end

For rich text:

class Message < ApplicationRecord
  has_translated_rich_text :content
end

You can use this attribute just like any other Action Text attribute.

Installation

Add this line to your application's Gemfile:

gem "translated"

And then execute:

bundle

Install the migrations:

bin/rails translated:install:migrations

Get your API key from https://translatedrb.com

Create an initializer config/initializers/translated.rb

Translated.api_key = 'API KEY from translatedrb.com'

# Optionally, you can configure which environments you would like translated.
# By default, it will translate development and production
# Translated.environments = %w(development production)

Example Project

Check out an example Rails project with Translated already installed here.

License

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