From 1e0afb718d5e0eaa581a7203b61b69c2ce5b4413 Mon Sep 17 00:00:00 2001 From: Godwin Date: Tue, 13 Jun 2017 10:06:29 -0700 Subject: [PATCH] Fixed locale not available page --- app/controllers/application_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d880949..2ae5dcf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -152,6 +152,15 @@ class ApplicationController < BaseController @page_title = 'page_titles.404.Locale_Not_Available' @main_title_vars = { vars: { language: view_context.language_name(locale) } } @main_title = 'error.locale_not_available.title' + + unless @alt_lang_urls.present? + @alt_lang_urls = {} + I18n.backend.enabled_locales.sort.each do |locale| + locale = locale.to_s + @alt_lang_urls[locale] = view_context.url_for_locale(locale) # don't show the current locale + end + end + render 'application/locale_not_available', status: 404 end