ToolsForLocales

Description

A small collection of tools for locales wannabe project. Currently supports only sort_tokens.

Sort Tokens

When working with lot of tokens it’s best practice to arrange the keys in alphabetical order. That is what this task does.

Give a yaml file like this:

en:
  admin:
    menu:
      company: "Company"
      about_us: "About Us"
    flashes:
      success: "Success"
      failure: "Failure"

The result will be:

en:
  admin:
    flashes:
      failure: "Failure"
      success: "Success"
    menu:
      about_us: "About Us"
      company: "Company"

Install

In your Gemfile

gem 'tools_for_locales'

Currently is tested on rails3+ and ruby 1.9.3

Usage

rake tools_for_locales:sort_tokens

WARNING All locale files will be overwritten

Tests

rspec spec/