require 'fast_gettext'

module Vmdb
  module Gettext
    module Domains
      TEXT_DOMAIN = 'manageiq'.freeze

      def self.domains
        @domains ||= []
        @domains
      end

      def self.add_domain(name, path, type = :po)
        domains << FastGettext::TranslationRepository.build(name, :path           => path,
                                                                  :type           => type,
                                                                  :report_warning => false)
      end

      def self.initialize_chain_repo
        FastGettext.translation_repositories[TEXT_DOMAIN] =
          FastGettext.add_text_domain(TEXT_DOMAIN, :type => :chain, :chain => @domains)
      end

      def self.reload
        FastGettext.translation_repositories[TEXT_DOMAIN].reload
      end
    end
  end
end

require 'fast_gettext'

module Vmdb
  module Gettext
    module Domains
      TEXT_DOMAIN ||= 'manageiq'.freeze

      def self.domains
        @domains ||= []
        @domains
      end

      def self.add_domain(name, path, type = :po)
        domains << FastGettext::TranslationRepository.build(name, :path           => path,
                                                                  :type           => type,
                                                                  :report_warning => false)
      end

      def self.initialize_chain_repo
        FastGettext.translation_repositories[TEXT_DOMAIN] =
          FastGettext.add_text_domain(TEXT_DOMAIN, :type => :chain, :chain => @domains)
      end

      def self.reload
        FastGettext.translation_repositories[TEXT_DOMAIN].reload
      end
    end
  end
end

Fix warning about already initialized TEXT_DOMAIN constant
Fix warning about already initialized TEXT_DOMAIN constant

This would happen during application start with rails engines / plugins
using their own gettext catalogs

$ rails console
lib/vmdb/gettext/domains.rb:6: warning: already initialized constant
Vmdb::Gettext::Domains::TEXT_DOMAIN
lib/vmdb/gettext/domains.rb:6: warning: previous definition of TEXT_DOMAIN was here
...
irb(main):001:0>
