avo
avo copied to clipboard
Locale set by `force_locale` should apply to all links on index pages
Describe the bug
We have set up a Rails 7 app with Avo admin, with a multilingual content.
We use force_locale to set the language and translate our resources, which, as the documentation states:
also append force_locale to all your links going forward.
The issue is that, after translating a resource in, say Japanese, when going back to the index page of a resource, even with force_locale=en, we will still see all the content in Japanese since all the links have been appended with :ja previously.
Steps to Reproduce
Steps to reproduce the behavior:
- Go to a record and switch to another language with
force_locale=ja - Translate some of the fields of that record
- Go back to the index page of that resource
- All the links will be set to
force_locale=ja - Switch the app to
enwithforce_locale=en - Record links are still set to
force_locale=jaand all the fields show thejatranslation, see screenshot below.
Expected behavior & Actual behavior
In my understanding, at least when setting back to force_locale=en, we should be seeing all index links with locale set to en and we should see the en Mobility version of our fields
System configuration
Avo version: 2.9.1.pre7 Rails version: 7.0 Ruby version: 3.1.2
License type:
- [X] Pro
Screenshots
Impact
This is impacting the translation of our website and records as it can be confusing for translators to see fields in other locales than the one they have just switched to, and can easily lead to mistakes.
- [ ] High impact
- [X] Medium impact
- [ ] Low impact
Urgency
- [ ] High urgency
- [ ] Medium urgency
- [X] low urgency
Happy to provide additional details if needed.
Can you check this video and see if I followed the steps correctly? I don't get the same result as you do.
Also, can you please try the latest version? I remember I pushed some updates regarding forcing the locale.
https://user-images.githubusercontent.com/1334409/184423344-eed0b577-a7fe-41e9-914f-57e46e6fe2cf.mp4
Hi @adrianthedev,
For me it happens after I update something in one of the record. So after switching to Romanian, go and edit a field of one of the users, and once back on the user index page, the record that has been just updated will stay in Romanian, and the links are stuck with force_locale=ro, regardless of whether you add force_locale=ro in the URL :/
I just tried with avo 2.12.0 and I'm having the same issue - you can see at the bottom that one of the links I hovered still has the force_locale=ja even though force_locale=en is in the URL:
This issue has been marked as stale because there was no activity for the past 15 days.
Closing this because there was no activity for the past 15 days. Feel free to reopen if new information pops up ✌️