Created
March 28, 2014 08:56
-
-
Save stefanoverna/9828275 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
module I18n | |
def self.missing_keys | |
@missing_keys | |
end | |
def self.t(*args, &block) | |
opts = args.dup.extract_options! | |
opts[:default] = Array(opts[:default]).delete_if do |d| | |
d.is_a? String | |
end | |
if super(*args, opts) =~ /missing/ | |
@missing_keys ||= [] | |
@missing_keys << [opts[:scope].to_s, args.first.to_s].select(&:present?).join(".") | |
end | |
super | |
end | |
end | |
RSpec.configure do |config| | |
config.after(:suite) do | |
puts I18n.missing_keys.uniq.sort.to_yaml | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment