[openstreetmap/openstreetmap-website] Add locale selector (PR #5077)
David Tsiklauri
notifications at github.com
Wed Aug 14 14:45:43 UTC 2024
This PR addresses "Language switcher on the homepage" issue mentioned in https://github.com/openstreetmap/openstreetmap-website/issues/1115
The code is based on @tomhughes 's PR https://github.com/openstreetmap/openstreetmap-website/pull/3618, which, as Tom mentioned in the [comment](https://github.com/openstreetmap/openstreetmap-website/pull/4461#issuecomment-1879660419), after rebasing had some styling issues. Most of the functional part of this PR was written by @tomhughes.
Language selector button, to be consistent, now is not hidden when the user is logged in. Instead, it redirects to the "My Preferences" page, where user can change language preferences. When the user is logged out, it still works like in https://github.com/openstreetmap/openstreetmap-website/pull/3618 _ shows "jquery uls" language selector popup / dropdown.
The reason for logged in user redirection instead of any complex functionality of preferred language change while clicking language selector, was compatibility with the PR https://github.com/openstreetmap/openstreetmap-website/pull/4461. After both PRs will be merged, there will be one smooth simple UX flow for logged in users.
In addition to these, this PR also adds:
- Tests for checking if redirection works correctly
- Both LTR and RTL language supported icon
- Language selector icon with the same default and hover colors as other menu items
Default view of the language selector:

This PR has many different visual impacts, so to make description shorter instead of directly adding images, I'll add links to them.
LTR screenshots:
- [Opened language selector](https://github.com/user-attachments/assets/92b0fe32-0f14-42e0-a924-9ec4cee737e5)
- [Medium resolution menu](https://github.com/user-attachments/assets/772b883a-7911-4f34-a81f-90a0c46a5f68)
- [Medium resolution menu hover](https://github.com/user-attachments/assets/cede63b4-447c-430e-b23a-28904dbdc3a2)
- [Small resolution menu](https://github.com/user-attachments/assets/18daace0-c617-4483-b7b0-9137906603bd)
RTL screenshots:
- [Default view](https://github.com/user-attachments/assets/6cc3b52d-09a6-4795-ab6c-6c56d2f361c2)
- [Medium resolution menu](https://github.com/user-attachments/assets/cb5306c5-96fa-418e-836e-71ef965f7fc5)
- [Small resolution menu](https://github.com/user-attachments/assets/7a0e913f-e59d-47a2-85c3-8db9e0e1c3e3)
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/5077
-- Commit Summary --
* Add locale selector
-- File Changes --
M Vendorfile (8)
M app/assets/javascripts/application.js (1)
M app/assets/javascripts/osm.js.erb (1)
A app/assets/javascripts/uls.js (30)
M app/assets/stylesheets/screen-ltr.scss (1)
M app/assets/stylesheets/screen-rtl.rtlcss.scss (1)
A app/assets/stylesheets/uls.scss (74)
M app/controllers/application_controller.rb (2)
M app/controllers/users_controller.rb (6)
M app/views/layouts/_header.html.erb (14)
M test/system/site_test.rb (16)
A vendor/assets/jquery.uls/css/jquery.uls.css (117)
A vendor/assets/jquery.uls/css/jquery.uls.grid.css (307)
A vendor/assets/jquery.uls/css/jquery.uls.lcd.css (144)
A vendor/assets/jquery.uls/css/jquery.uls.mobile.css (307)
A vendor/assets/jquery.uls/images/close.svg (8)
A vendor/assets/jquery.uls/images/language.svg (7)
A vendor/assets/jquery.uls/images/search.svg (7)
A vendor/assets/jquery.uls/src/jquery.uls.core.js (504)
A vendor/assets/jquery.uls/src/jquery.uls.data.js (7191)
A vendor/assets/jquery.uls/src/jquery.uls.data.utils.js (335)
A vendor/assets/jquery.uls/src/jquery.uls.languagefilter.js (380)
A vendor/assets/jquery.uls/src/jquery.uls.lcd.js (622)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/5077.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5077.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5077
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5077 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240814/e258a07b/attachment-0001.htm>
More information about the rails-dev
mailing list