Skip to content
This gem creates locale file from model attributes.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
CHANGELOG.md
Gemfile
LICENSE.txt
README.md
Rakefile
model_to_locale.gemspec

README.md

ModelToLocale

This gem creates locale file from model attributes.

Installation

Add this line to your application's Gemfile:

gem 'model_to_locale'

And then execute:

$ bundle

Or install it yourself as:

$ gem install model_to_locale

Usage

Create a new locale file

rails g model_to_locale:create tr

models.tr.yml file created.

---
tr:
  activerecord:
    models:
      profile: Profile
      group: Group
    attributes:
      profile:
        id: Id
        first_name: First_name
        last_name: Last_name
        gsm: Gsm
        birthday: Birthday
        user_id: User_id
        created_at: Created_at
        updated_at: Updated_at
      group:
        id: Id
        number: Number
        name: Name
        domain_id: Domain_id
        created_at: Created_at
        updated_at: Updated_at

Add model attributes to locale file

rails g model_to_locale:add_model tr --model City

City model attributes added to models.tr.yml.

---
tr:
  activerecord:
    models:
      profile: Profile
      group: Group
      city: City
    attributes:
      profile:
        id: Id
        first_name: First_name
        last_name: Last_name
        gsm: Gsm
        birthday: Birthday
        user_id: User_id
        created_at: Created_at
        updated_at: Updated_at
      group:
        id: Id
        number: Number
        name: Name
        domain_id: Domain_id
        created_at: Created_at
        updated_at: Updated_at
      city:
        id: Id
        name: Name

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
You can’t perform that action at this time.