Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/lab2023/model_to_locale
- Owner: lab2023
- License: mit
- Created: 2013-11-15T16:13:19.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-10-10T12:37:10.000Z (over 8 years ago)
- Last Synced: 2024-10-31T14:19:20.540Z (3 months ago)
- Homepage:
- Size: 123 KB
- Stars: 8
- Watchers: 16
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
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