Open DeeDeeG opened 3 years ago
Hi @brunoocasali, I hope you are doing well.
I've been working on finishing the locale switcher feature for Refuge Restrooms. I think it's ready now!
If you are interested in helping with adding tests for locales other than English, I think this could be a reasonable place to do that. It would, of course, be much appreciated.
Best Regards,
- DeeDeeG
@brunoocasali I added the changes you suggested, matching the Rubocop-linted style.
During testing, I found out that there is a problem still. Might you be able to help troubleshoot this?
When starting a new search for restrooms using the search bar, the locale parameter is not preserved. It appears to me that the search results page is generated only with the following parameters (with the example search "San Francisco").
/restrooms?utf8=✓&lat=37.7749295&long=-122.4194155&search=san+francisco
utf8
lat
long
search
But no locale
parameter.
It's not immediately clear to me how these parameters are generated, as I'm not familiar with that part of the codebase. (I suspect it might be part of Refuge Restrooms' JavaScript code, but I'm not sure.) If I knew where these were generated, then perhaps it would be easier to ensure the locale
parameter was preserved there, too, if set.
@DeeDeeG I could help you with this tomorrow, okay? :)
That would be great!
I'm getting more confident that it's in app/javascript/packs/lib/
--> geocoder.js
or maps.js.erb
. Not totally sure, though.
@DeeDeeG checkout the #657 ;)
Thanks for reviewing/merging #657, @tkwidmer.
I think the last thing for me to do on this is to check the "new restroom" submission process works properly with these locale switchers. I would like to do the dependency bumps first and get those out as a patch release.
Context
application_controller.rb
to add locales to dynamic links, and set the current locale based on the URL parameter if present. Updates hard-coded links within the app to dynamic ones.Summary of Changes
locale
that will appear as?locale=[your-locale-code-here]
in the URL. For example:/restrooms/new?locale=es
is the "Add a New Restroom" page, explicitly in Spanish.link_to
), automagically use the URL parameter?locale=[some_locale_here]
now.Enable optional routing to locale-prefixed versions of most URLs in the app. For example:(Disabled for now, as this wasn't working as intended.)/fr/restrooms/new
is the "Add a New Restroom" page, explicitly in French.Checklist
Screenshots
Before
After