-
Notifications
You must be signed in to change notification settings - Fork 143
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
Bug: host_locales does not set the locale #320
Comments
Hi! Thanks for being part of the Route Translator Community. I don't know when I will have time to take a look here, because route translator issues are time consuming to review, however
I strongly suggest to avoid this, because the locale will leak to other requests: Route Translator's current implementation, with Please also post your controller code, or better, please host on github a test application showing the issue |
Hi, Thank you for your response! I appreciate it! Please have a look at the repository https://github.com/staskolukasz/route-translator-test In Also thank you for the great tip regarding #44 - I will adjust my code. |
Hello, After a fast look at the application controller, I'm not seeing
From readme:
Ref: https://github.com/enriclluelles/route_translator?tab=readme-ov-file#quick-start |
Sir, you are right. Added I'm closing the issue. |
Glad you solved |
Bug description
Hello,
I would like to report an issue related to
host_locales
property.I followed the guide and configured
host_locales
inroute_translator.rb
as shown below:Unfortunately, after starting the server and visiting a controller with a single action -
index
, which renders the value of locale, I noticed that the value did not change despite the above configuration. To solve the problem, it was necessary to apply a workaround in theApplicationController
:The problem -
config.host_locales
does not set the locale.Steps to reproduce
/etc/hosts
file:development.rb
file:route_translator
gembundle install
bundle exec rails g route_translator:install
rails g controller products
ProductsController
-index
de
andcz
:and
de
(index.de.html.erb
) andcz
(index.cz.html.erb
) language:and
index.html.erb
):./bin/dev
http://abc.my-domain.de:3000/produkte
http://abc.my-domain.cz:3000/produkty
Expected behavior
When I visit
http://abc.my-domain.de:3000/produkte
I would like to see this in the view:When I visit
http://abc.my-domain.cz:3000/produkty
I would like to see this in the view:Actual behavior
When I visit
http://abc.my-domain.de:3000/produkte
I see this in the view:When I visit
http://abc.my-domain.cz:3000/produkty
I see this in the view:Reproducible reduced test case
No response
Ruby version
3.3.5
Ruby on Rails version
8.0
Route Translator version
14.2.0
I18n configuration
No custom configuration
Route Translator configuration
Rails routes source
Rails locales
Rails routes
Bug report checklist
The text was updated successfully, but these errors were encountered: