Ransack add :cs and :es to app available_locales #177

Closed
jrdi opened this Issue Dec 18, 2012 · 6 comments

Comments

Projects
None yet
6 participants
@jrdi

jrdi commented Dec 18, 2012

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.

@markets

This comment has been minimized.

Show comment Hide comment
@markets

markets Dec 18, 2012

+1, problem appears with 0.7.1 release

markets commented Dec 18, 2012

+1, problem appears with 0.7.1 release

@radar

This comment has been minimized.

Show comment Hide comment
@radar

radar Dec 20, 2012

Member

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

Member

radar commented Dec 20, 2012

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

@jrdi

This comment has been minimized.

Show comment Hide comment
@jrdi

jrdi Dec 21, 2012

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 commented Dec 21, 2012

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.

@francesc

This comment has been minimized.

Show comment Hide comment
@francesc

francesc Jan 10, 2013

+1

+1

@NielsKSchjoedt

This comment has been minimized.

Show comment Hide comment
@NielsKSchjoedt

NielsKSchjoedt Oct 7, 2013

Contributor

+1

Contributor

NielsKSchjoedt commented Oct 7, 2013

+1

@jonatack

This comment has been minimized.

Show comment Hide comment
@jonatack

jonatack Aug 29, 2014

Member

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.

Member

jonatack commented Aug 29, 2014

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 jonatack closed this Aug 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment