Class: RailsAssetLocalization::LocalesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/rails_asset_localization/locales_controller.rb

Instance Method Summary collapse

Instance Method Details

#localeObject



5
6
7
8
9
10
11
# File 'app/controllers/rails_asset_localization/locales_controller.rb', line 5

def locale
  locale = params.fetch(:locale) { I18n.default_locale.to_s }
  locale = $1 if locale =~ /(\w+)\-(\w+)/

  locales_exporter = ::RailsAssetLocalization::LocalesExporter.new
  respond_with (locales_exporter.translations[locale.to_sym] || {}).to_json
end