https://github.com/holyshared/i18n-checker
Verification of translation of Ruby source and Haml template
https://github.com/holyshared/i18n-checker
checker haml i18n locale ruby
Last synced: 4 days ago
JSON representation
Verification of translation of Ruby source and Haml template
- Host: GitHub
- URL: https://github.com/holyshared/i18n-checker
- Owner: holyshared
- License: mit
- Created: 2017-03-04T01:57:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-07-27T18:26:11.000Z (almost 6 years ago)
- Last Synced: 2025-02-17T13:45:18.494Z (over 1 year ago)
- Topics: checker, haml, i18n, locale, ruby
- Language: Ruby
- Homepage:
- Size: 365 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i18n-checker
[](https://travis-ci.org/holyshared/i18n-checker)
[](https://coveralls.io/github/holyshared/i18n-checker?branch=master)

This gem provides a **Rake task** to check translation file mistakes and translated text references from template files etc.
Current version supports Ruby source code, Haml template file.
* Ruby source
* Haml template
## Basic usage
Detected out of reference text, Delete unused translation text at once.
Add the following tasks to your **Rakefile**.
```ruby
require 'i18n_checker/rake_task'
I18nChecker::RakeTask::ReferenceCheck.new do |task|
task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
task.locale_file_paths = FileList['config/locales/*'] # locale file paths
end
I18nChecker::RakeTask::UnusedCheck do |task|
task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
task.locale_file_paths = FileList['config/locales/*'] # locale file paths
end
```
After that we just execute the task.
```shell
bundle exec rake locale_reference_check
bundle exec rake locale_unused_check
```
## Check translation of translated text
Detect translated text references that are broken.
It is useful for detecting text that is not in the translation file of a particular language.
```ruby
require 'i18n_checker/rake_task'
I18nChecker::RakeTask::ReferenceCheck.new do |task|
task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
task.locale_file_paths = FileList['config/locales/*'] # locale file paths
end
```
After that we just execute the task.
```shell
bundle exec rake locale_reference_check
```
## Delete unused translated text
Using the **locale_clean** task you can delete unused translated text from the file.
Since you can delete translated text that you do not use safely, you can reduce the maintenance cost by running it periodically.
```ruby
require 'i18n_checker/rake_task'
I18nChecker::RakeTask::UnusedClean do |task|
task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
task.locale_file_paths = FileList['config/locales/*'] # locale file paths
end
```
After that we just execute the task.
```shell
bundle exec rake locale_unused_clean
```
## Run the test
```shell
bundle install
bundle exec rake spec
```