I recently converted a large Rails 3 application into a gem.
Localization
is part of the original code base.
I modified the gettext:find task to look in the gem and in any app
that
uses the gem to find potential translations.
namespace :gettext do
def files_to_translate
files_in_application + files_in_gem
end
def files_in_application
Dir.glob(glob_pattern)
end
def files_in_gem
Dir.glob(File.join(MyGem.root, glob_pattern))
end
def glob_pattern
“{app,lib,config,locale}/**/*.{rb,erb,haml,slim,rhtml}”
end
end
Hence, the task looks in the gem root and, as before, Rails.root for
files to translate.
My question: Is there a way to find .po files in both places? I am OK
with .mo files being stored in Rails.root/locales. (The .mo files can
then be checked into the repo for the app without affecting the gem
repo.)
But I would like a way for the .po files of the gem to override any
.po
files in the app.
Any ideas?
Martin