avo icon indicating copy to clipboard operation
avo copied to clipboard

Locale set by `force_locale` should apply to all links on index pages

Open Annedj opened this issue 3 years ago • 1 comments
trafficstars

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:

  1. Go to a record and switch to another language with force_locale=ja
  2. Translate some of the fields of that record
  3. Go back to the index page of that resource
  4. All the links will be set to force_locale=ja
  5. Switch the app to en with force_locale=en
  6. Record links are still set to force_locale=ja and all the fields show the ja translation, 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

error screenshot

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.

Annedj avatar Aug 12 '22 16:08 Annedj

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

adrianthedev avatar Aug 12 '22 18:08 adrianthedev

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:

image

Annedj avatar Aug 15 '22 08:08 Annedj

This issue has been marked as stale because there was no activity for the past 15 days.

github-actions[bot] avatar Aug 31 '22 04:08 github-actions[bot]

Closing this because there was no activity for the past 15 days. Feel free to reopen if new information pops up ✌️

github-actions[bot] avatar Sep 16 '22 04:09 github-actions[bot]