GithubHelp home page GithubHelp logo

david-a / i18n_tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tkadauke/i18n_tools

0.0 1.0 1.0 100 KB

Very simple rake tasks for finding missing and unused translations in Rails applications using the I18n library.

Ruby 100.00%

i18n_tools's Introduction

i18n_tools
==========

Very simple rake tasks for finding missing and unused translations in Rails applications using the
I18n library.


Installation
============

  (sudo) gem install i18n_tools


Usage
=====

Include the following snippet into your Rakefile:

  begin
    require 'i18n_tools/tasks'
  rescue LoadError
  end

Now you can run the following tasks:

* LOCALE=xyz rake translations:missing -- detects missing translations from your project in locale xyz
  and outputs them to stdout in YAML format.
* LOCALE=xyz rake translations:unused -- detects translations in locale xyz that are not used by any of
  your code and outputs the translation keys.


Tweaking it
===========

By default, i18n_tools looks for controllers, helpers, models and views in the usual directories. If you
use non-standard file types (such as "app/mailers" or something like that), add the following to your
Rakefile:

  I18nTools::Scanner.file_types << "mailers"

Some files might contain parts that look like calls to the translation library, but actually aren't. To
exclude these files from the output, write them into the file .i18nignore in your RAILS_ROOT, as regular
expressions, one per line. Empty lines or lines starting with # are ignored.

There is something special about the "translations:unused" task. In its default configuration it might
report things that are actually used. To exclude these false positives, enter each key prefix to ignore
into the file .i18nignore_unused (omit the locale). For example, a good start is to use the following
key prefixes for your .i18nignore_unused:

  activerecord
  # if you use authlogic
  authlogic
  date.formats
  datetime
  number
  support.array
  time


Contributing
============

As usual, fork, commit, pull request.

i18n_tools's People

Watchers

David Avikasis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.