-
-
Notifications
You must be signed in to change notification settings - Fork 151
Routing with locale? #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd like to upvote this. Is there no way this could be resolved? |
Hi @jmuheim @mmhan I'm copying this response over from a previous HighVoltage issue. I suggest that you read over the Rails I18n page here: There are several components to getting Rails to work with localization. Add a before filter to your Application controller# app/controllers/application_controller.rb
before_action :set_locale
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end Disable the default High Voltage routes# config/initializers/high_voltage.rb
HighVoltage.configure do |config|
config.routes = false
end Set up nested URLs with locales the routes file# config/routes.rb
scope "/:locale", locale: /en|bn|hi/ do
get "/pages/:id" => 'high_voltage/pages#show', :as => :page, :format => false
end Add a page to the site
Make sure that there are corresponding locale files
One last note is there is a know issue with High Voltage. You'll need to specify routes like this Hopefully this is enough information to get you started with localization |
I've added a PR to update the REAME with instructions for localization. #156 Closing the issue, feel free to leave comments on the PR if any of the instruction here don't make sense. |
Got it, Thanks! On Mon, Jul 21, 2014 at 3:49 AM, Harlow Ward [email protected]
|
I'd like to you high_voltage, but it doesn't seem to know about handling a locale in the path itself.
I stumbled over this post on stack overflow:
http://stackoverflow.com/questions/19809898/high-voltage-gem-routing-with-locale
So I suggest you guys take a look there and provide an answer. This would be really useful.
Thanks a lot!
Josh
The text was updated successfully, but these errors were encountered: