-
-
Save sixtyfive/dafc1fd138705d500909ce03f0a696d8 to your computer and use it in GitHub Desktop.
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
def collect_translation_keys | |
big_string = String.new | |
# File#read should be fine given that all the files are quite short. | |
Dir.glob(File.join(Rails.root, 'app', '**', '*.{rb,haml}')) {|path| big_string += File.read(path)} | |
big_string.scan(/_\(['"](.*)['"]\)/) do |result| | |
# Do things with each result. | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment