-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
highvoltage routing with locale. #109
Comments
Is any one there to checkout this issue? |
Hello @talhait07 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 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 applcation
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 |
Closing the thread. Feel free to open back up if the last response isn't working as expected. |
Hi when i try to scope high_voltage with locale i get this error :
Do you make your test with Rails 4 ? Thanks in advance for your answer. |
@BGuimberteau I believe you'll need to disable to default routes that High Voltage creates. # config/initializers/high_voltage.rb
HighVoltage.configure do |config|
config.routes = false
end |
Neat! Just perfect, thank you very much. |
I am using this gem.I am facing a problem with routing.
I am getting something like this :
localehost:3000/pages/privacy-policy?locale=en
But i need the url to be :
localhost:3000/en/pages/privacy-policy
In my routes file i wrote:
scope ":locale", locale: /en|bn|hi/ do
match "/pages/:id" => 'pages#show', :as => :page, :format => false
end
what should i do now.
The text was updated successfully, but these errors were encountered: