Skip to content

Instantly share code, notes, and snippets.

@Ripper346
Ripper346 / locale_yaml_formatter.rb
Last active April 18, 2019 12:55 — forked from wteuber/locale_yaml_formatter.rb
Sort your rails locale yamls alphabetically and adds an empty line when indent lowers 2 or more levels. Prints everything to stdout. Watch your yaml anchors and aliases (fix manually, if needed).usage: chmod +x ./locale_yaml_formatter.rb ./locale_yaml_formatter.rb <path/to/locale.yml>In a rails project, runfind . -type f -name *.yml | grep -v sp…
#!/usr/bin/env ruby
# Sort your rails locale yamls alphabetically and adds an empty line when indent lowers 2 or more levels
# Prints everything to stdout. Watch your yaml anchors and aliases (fix manually, if needed).
# usage:
# chmod +x ./locale_yaml_formatter.rb
# ./locale_yaml_formatter.rb <path/to/locale.yml>
#
# In a rails project, run
# find . -type f -name *.yml | grep -v spec | grep locales | _