ransack icon indicating copy to clipboard operation
ransack copied to clipboard

Ransack add :cs and :es to app available_locales

Open jrdi opened this issue 13 years ago • 6 comments

Since ransack gem includes locales for Czech and Spanish it's include automatically to your app I18n.available_locales

I think that we should have this files out of the gem (and keep only the english file) like https://github.com/plataformatec/devise or we need a proper configuration methods to set what locales we want to use. Otherwise we should introduce unnecessary locales that could break our application.

jrdi avatar Dec 18 '12 10:12 jrdi

+1, problem appears with 0.7.1 release

markets avatar Dec 18 '12 10:12 markets

I don't know what the exact problem here. How is what I18n.available_locales includes a problem?

radar avatar Dec 20 '12 22:12 radar

Add extra locales to I18n.available_locales should break set_locale logic on some applications, if you add some locales that application don't really have, you can break this workaround.

def set_locale
  I18n.locale = extract_locale_from_subdomain || I18n.default_locale
end

def extract_locale_from_subdomain
  parsed_locale = request.subdomains.first
  I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
end

Examples from http://guides.rubyonrails.org/i18n.html but it's the same situation if you use params[:locale] or if you extract locale from browser.

jrdi avatar Dec 21 '12 17:12 jrdi

+1

francesc avatar Jan 10 '13 16:01 francesc

+1

NielsKSchjoedt avatar Oct 07 '13 11:10 NielsKSchjoedt

Closing this for now as it's been adressed by #186. In hindsight, many Ransack users/contributors did not seem to understand or use the locale project for adding translations. They continued to contribute them via PRs here to the locales folder in Ransack.

jonatack avatar Aug 29 '14 12:08 jonatack