Skip to content
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

Resource translation_key is being disregarded with Rails 8.0.1 #3538

Open
4 of 11 tasks
jpawlyn opened this issue Dec 17, 2024 · 6 comments · May be fixed by #3565
Open
4 of 11 tasks

Resource translation_key is being disregarded with Rails 8.0.1 #3538

jpawlyn opened this issue Dec 17, 2024 · 6 comments · May be fixed by #3565
Assignees
Labels
Bug Something isn't working

Comments

@jpawlyn
Copy link
Contributor

jpawlyn commented Dec 17, 2024

Describe the bug

The upgrade from Rails 8.0.0 to 8.0.1 has caused resource translation keys to be ignored. This is occurring for Avo 3.15.1, 3.15.2 and 3.15.3. Looking at the Rails changelog perhaps rails/rails#53640 has caused this change in behaviour ?

Field translations remain working as expected.

Reproduction repository for the bug

Happy to provide this if required.

Steps to use in the reproduction repository

Steps to reproduce the behavior:

Expected behavior & Actual behavior

System configuration

Avo version: 3.15.1 - 3

Rails version: 8.0.1

Ruby version: 3.3.6

License type:

  • Community
  • Pro
  • Advanced

Are you using Avo monkey patches, overriding views or view components?

  • Yes. If so, please post code samples.
  • No

Screenshots or screen recordings

This is with Rails 8.0.0 showing the correct translations:

Image

And this is with Rails 8.0.1 showing no translations for the menu items and create resource button model name:

Image

Additional context

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • Low impact (It's really a tiny thing that I could live with.)

Urgency

  • High urgency (I can't continue development without it.)
  • Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • Low urgency (It can wait. I just wanted you to know about it.)
@adrianthedev
Copy link
Collaborator

Hey @jpawlyn. We are looking into this.

@jpawlyn
Copy link
Contributor Author

jpawlyn commented Dec 18, 2024

Hey @jpawlyn. We are looking into this.

Thanks @adrianthedev. Just came across rails/rails#53640. Looks as if it might be related ?

@Paul-Bob Paul-Bob self-assigned this Dec 18, 2024
@Paul-Bob Paul-Bob moved this to In Progress in Issues Dec 18, 2024
@Paul-Bob Paul-Bob added the Bug Something isn't working label Dec 18, 2024
@Paul-Bob
Copy link
Contributor

Hi @jpawlyn could you please include a way to reproduce it?

I updated rails on our dummy app to 8.0.1 configured the pt locale file as:

---
pt:
  avo:
    resource_translations:
      product: "Produto"
      user:
        zero: 'usuarios'
        one: 'usuario'
        other: 'usuarios'

and visited http://localhost:3030/admin/resources/users?set_locale=pt

Image

On my side the translations are applied correctly, am I missing something?

I committed the reproduction code here.

@Paul-Bob Paul-Bob added the Waiting on Reproduction Pending reproduction repository or detailed reproduction steps to proceed with issue resolution. label Dec 18, 2024
@jpawlyn
Copy link
Contributor Author

jpawlyn commented Dec 18, 2024

@Paul-Bob Nice one. I changed the translation_key for the user resource to a value other than the default and the issue is apparent. And then when I downgraded the Rails version to 8.0.0 the correct translation appears. Please see jpawlyn@82e983e.

@Paul-Bob Paul-Bob removed the Waiting on Reproduction Pending reproduction repository or detailed reproduction steps to proceed with issue resolution. label Dec 18, 2024
@Paul-Bob
Copy link
Contributor

Reproduced, thank you!

@Paul-Bob
Copy link
Contributor

There has been a behavioral change in the internals of Rails' class_attribute, and we may need to adjust some of the associated logic. The translation_key is indeed impacted, though there could be additional attributes affected.

I've opened an issue on Rails to gain clarity on the appropriate steps for us to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants