项目作者: holyshared

项目描述 :
Verification of translation of Ruby source and Haml template
高级语言: Ruby
项目地址: git://github.com/holyshared/i18n-checker.git
创建时间: 2017-03-04T01:57:24Z
项目社区:https://github.com/holyshared/i18n-checker

开源协议:MIT License

下载


i18n-checker

Build Status
Coverage Status

Screen shot

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.

  1. require 'i18n_checker/rake_task'
  2. I18nChecker::RakeTask::ReferenceCheck.new do |task|
  3. task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
  4. task.locale_file_paths = FileList['config/locales/*'] # locale file paths
  5. end
  6. I18nChecker::RakeTask::UnusedCheck do |task|
  7. task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
  8. task.locale_file_paths = FileList['config/locales/*'] # locale file paths
  9. end

After that we just execute the task.

  1. bundle exec rake locale_reference_check
  2. 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.

  1. require 'i18n_checker/rake_task'
  2. I18nChecker::RakeTask::ReferenceCheck.new do |task|
  3. task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
  4. task.locale_file_paths = FileList['config/locales/*'] # locale file paths
  5. end

After that we just execute the task.

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

  1. require 'i18n_checker/rake_task'
  2. I18nChecker::RakeTask::UnusedClean do |task|
  3. task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
  4. task.locale_file_paths = FileList['config/locales/*'] # locale file paths
  5. end

After that we just execute the task.

  1. bundle exec rake locale_unused_clean

Run the test

  1. bundle install
  2. bundle exec rake spec