Skip to content

Instantly share code, notes, and snippets.

@stefanoverna
Created March 28, 2014 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanoverna/9828275 to your computer and use it in GitHub Desktop.
Save stefanoverna/9828275 to your computer and use it in GitHub Desktop.
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