README.md in i18n-tasks-0.3.9 vs README.md in i18n-tasks-0.3.10

- old
+ new

@@ -1,26 +1,26 @@ -# i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coveralls]][coveralls] [![Code Climate][badge-code-climate]][code-climate] [![Flattr this][badge-flattr]][flattr] +# i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coveralls]][coveralls] [![Code Climate][badge-code-climate]][code-climate] [![Gemnasium][badge-gemnasium]][gemnasium] i18n-tasks finds and manages missing and unused translations in your application. The default approach to locale data management with gems such as [i18n][i18n-gem] is flawed. If you use a key that does not exist, this will only blow up at runtime. Keys left over from removed code accumulate in the resource files and introduce unnecessary overhead on the translators. Translation files can quickly turn to disarray. i18n-tasks improves this by using static analysis. It scans calls such as `I18n.t('some.key')` and provides reports on key usage, missing, and unused keys. -It can also can pre-fill missing keys, including from Google Translate, and it can remove unused keys as well. +It can also pre-fill missing keys, including from Google Translate, and it can remove unused keys as well. i18n-tasks can be used with any project using [i18n][i18n-gem] (default in Rails), or similar, even if it isn't ruby. <img width="534" height="288" src="https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-tasks.png"> ## Installation Add to Gemfile: ```ruby -gem 'i18n-tasks', '~> 0.3.7' +gem 'i18n-tasks', '~> 0.3.10' ``` i18n-tasks does not load or execute any of the application's code but performs static-only analysic. This means you can install the gem and run it on a project without adding it to Gemfile. @@ -53,10 +53,12 @@ To add missing values to the base locale only: ```bash # most task accept locales as first argument. `base` and `all` are special i18n-tasks add-missing base +# add-missing accepts a placeholder argument, with optional base_value interpolation +i18n-tasks add-missing -p 'PLEASE-TRANSLATE %{base_value}' fr ``` Translate missing values with Google Translate ([more below on the API key](#translation-config)). ```bash @@ -140,10 +142,15 @@ write: # save all devise keys in it's own file (per locale): - ['devise.*', 'config/locales/devise.%{locale}.yml'] # default catch-all: - 'config/locales/%{locale}.yml' # path is short for ['*', path] + # configure YAML / JSON serializer options (when using the default adapter) + yaml: + write: + # do not wrap lines at 80 characters (default) + line_width: -1 ``` #### Key pattern syntax | syntax | description | @@ -252,27 +259,27 @@ You might want to test for missing and unused translations as part of your test suite. This is how you can do it with rspec: ```ruby -# spec/i18n_keys_spec.rb: +# spec/i18n_spec.rb: require 'spec_helper' - require 'i18n/tasks' -describe 'Translation keys' do +describe 'I18n' do let(:i18n) { I18n::Tasks::BaseTask.new } - it 'are all present' do - expect(i18n.missing_keys).to have(0).keys + it 'does not have missing keys' do + count = i18n.missing_keys.count + fail "There are #{count} missing i18n keys! Run 'i18n-tasks missing' for more details." unless count.zero? end - it 'are all used' do - expect(i18n.unused_keys).to have(0).keys + it 'does not have unused keys' do + count = i18n.unused_keys.count + fail "There are #{count} unused i18n keys! Run 'i18n-tasks unused' for more details." unless count.zero? end end - ``` ## XLSX Export missing and unused data to XLSX: @@ -290,14 +297,14 @@ This was originally developed for [Zuigo](http://zuigo.com/), a platform to organize and discover events. [MIT license]: /LICENSE.txt [travis]: https://travis-ci.org/glebm/i18n-tasks -[badge-travis]: https://travis-ci.org/glebm/i18n-tasks.png?branch=master +[badge-travis]: http://img.shields.io/travis/glebm/i18n-tasks.svg [coveralls]: https://coveralls.io/r/glebm/i18n-tasks?branch=master -[badge-coveralls]: https://coveralls.io/repos/glebm/i18n-tasks/badge.png?branch=master +[badge-coveralls]: http://img.shields.io/coveralls/glebm/i18n-tasks.svg +[gemnasium]: https://gemnasium.com/glebm/i18n-tasks +[badge-gemnasium]: https://gemnasium.com/glebm/i18n-tasks.svg [code-climate]: https://codeclimate.com/github/glebm/i18n-tasks -[badge-code-climate]: https://codeclimate.com/github/glebm/i18n-tasks.png -[badge-flattr]: https://api.flattr.com/button/flattr-badge-large.png -[flattr]: https://flattr.com/submit/auto?user_id=glebm&url=https%3A%2F%2Fgithub.com%2Fglebm%2Fi18n-tasks +[badge-code-climate]: http://img.shields.io/codeclimate/github/glebm/i18n-tasks.svg [i18n-gem]: https://github.com/svenfuchs/i18n "svenfuchs/i18n on Github" [screenshot-find]: https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-usages.png "i18n-tasks find output screenshot"