Forum: Rails I18n Using get text in gem and code

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7e6cc29aaa8366e72eb705bbc1f2fc92?d=identicon&s=25 Martin Streicher (Guest)
on 2014-10-16 21:25
(Received via mailing list)
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
This topic is locked and can not be replied to.