This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I wrote this up one evening while auditing an app for localization. It can almost certainly be optimized, but it works! | |
namespace :i18n do | |
# This method is doing most of the heavy lifting. It accepts a full filename with path and returns | |
# a hash of arrays, where each key is one of the different groupings | |
def scan_file_for_literals file_with_path | |
file = File.read(file_with_path) | |
# First off, omit any straight ruby code that isn't emitted, since it won't need to be localized | |
file.gsub! /^<%[^=].*%>/m, '' |