Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rootstrap/i18n_linter
Rails i18n Linter Gem
https://github.com/rootstrap/i18n_linter
hacktoberfest i18n linter rails ruby rubygem
Last synced: 1 day ago
JSON representation
Rails i18n Linter Gem
- Host: GitHub
- URL: https://github.com/rootstrap/i18n_linter
- Owner: rootstrap
- License: mit
- Created: 2018-11-16T17:54:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T21:45:29.000Z (almost 3 years ago)
- Last Synced: 2024-08-07T08:13:14.584Z (3 months ago)
- Topics: hacktoberfest, i18n, linter, rails, ruby, rubygem
- Language: Ruby
- Homepage: https://rootstrap.com
- Size: 117 KB
- Stars: 44
- Watchers: 11
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# I18nLinter
[![CircleCI](https://circleci.com/gh/rootstrap/i18n_linter/tree/master.svg?style=svg&circle-token=15c1ee79b304665b14e47e04dc7577c715de293c)](https://circleci.com/gh/rootstrap/i18n_linter/tree/master)
[![Maintainability](https://api.codeclimate.com/v1/badges/50f3ec30e8147c3df712/maintainability)](https://codeclimate.com/repos/5c6b0bbdd561465d35008579/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/50f3ec30e8147c3df712/test_coverage)](https://codeclimate.com/repos/5c6b0bbdd561465d35008579/test_coverage)Internationalization linter for your Ruby on Rails projects.
## Installation
All you have to do is run the following command:
```bash
$ gem install i18n_linter
```
If you want to install using `bundler`, add this to the `Gemfile` under the `development` group:
```ruby
gem 'i18n_linter', require: false
```## Usage
Just type `i18n_linter` in a Ruby on Rails project's folder and watch the strings that could be internationalized. Note: only strings in ruby files will be reported.
```
$ cd my/ruby_on_rails/project
$ i18n_linter [options]
```## Options
The available options are:
```
-f PATTERN, --files=PATTERN Pattern to find files, default: -f '**/*.rb'
-o FILE, --out=FILE, Write output to a file instead of STDOUT
```For example:
```
$ i18n_linter -f users_controller.rb
```
```
$ i18n_linter -f app/controllers/**/*.rb -o i18n_linter_output.txt
```## Configuration
The behavior of I18nLinter can be controlled via the `.i18n_linter.yml` configuration file.
It's possible to enable or disable Rules and exclude files from the validations as follows:
```ruby
Linter:
Include:
- '**/*.rb'
Exclude:
- 'spec/**/*'
Rules:
Uppercase:
Enabled: true
MiddleSpace:
Enabled: false
```## Example
Imagine a source file sample.rb containing:
```ruby
class UserController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, with: :render_not_founddef show
@user = User.find(params[:id])
endprivate
def render_not_found
render json: { error: "Couldn't find the record" }, status: :not_found
end
end
```
I18nLinter will return the following warnings in this file:
```
$ i18n_linter -f sample.rbsample.rb:11:26
10: def render_not_found
11: render json: { error: "Couldn't find the record" }, status: :not_found
12: end
----------------
```## Contributing
Bug reports (please use Issues) and pull requests are welcome on GitHub at https://github.com/rootstrap/i18n_linter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).## Credits
**I18nLinter** is maintained by [Rootstrap](http://www.rootstrap.com) with the help of our [contributors](https://github.com/rootstrap/i18n_linter/contributors).[](http://www.rootstrap.com)