Module: ActionDispatch::Routing::Translator

Defined in:
lib/rails-translate-routes.rb

Class Method Summary collapse

Class Method Details

.i18n(*locales) ⇒ Object



400
401
402
# File 'lib/rails-translate-routes.rb', line 400

def i18n *locales
  RailsTranslateRoutes.init_with_i18n(*locales).translate Rails.application.routes
end

.translate(&block) ⇒ Object



387
388
389
# File 'lib/rails-translate-routes.rb', line 387

def translate &block
  RailsTranslateRoutes.init_with_yield(&block).translate Rails.application.routes
end

.translate_from_file(file_path, options = {}) ⇒ Object



391
392
393
394
395
396
397
398
# File 'lib/rails-translate-routes.rb', line 391

def translate_from_file(file_path, options = {})
  file_path = %w(config locales routes.yml) if file_path.blank?
  r = RailsTranslateRoutes.init_from_file(file_path)
  r.prefix_on_default_locale = true if options && options[:prefix_on_default_locale] == true
  r.no_prefixes = true if options && options[:no_prefixes] == true
  r.keep_untranslated_routes = true if options && options[:keep_untranslated_routes] == true
  r.translate Rails.application.routes
end