Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lab2023/model_to_locale

This gem creates locale file from model attributes.
https://github.com/lab2023/model_to_locale

Last synced: about 2 months ago
JSON representation

This gem creates locale file from model attributes.

Awesome Lists containing this project

README

        

# 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.

```yml
---
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`.

```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