2
3
4
5
6
7
8
9
10
11
12
|
# File 'lib/rails-localization/router.rb', line 2
def localized(*locales)
symbolized_locales = locales.map(&:to_sym)
I18n.config.available_locales = symbolized_locales
if @set == Rails.application.routes
I18n.route_locales[:main_app] = symbolized_locales
else
sub_app_name = @scope[:module] || :main_app
I18n.route_locales[sub_app_name] = symbolized_locales
end
scope("(:locale)", constraints: {locale: /#{symbolized_locales.join('|')}/}, defaults: {locale: ""}) { yield }
end
|