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

Ruby 3.1 compatibility (Psych 4 breaking change) #47

Closed
saboter opened this issue Apr 4, 2022 · 7 comments
Closed

Ruby 3.1 compatibility (Psych 4 breaking change) #47

saboter opened this issue Apr 4, 2022 · 7 comments

Comments

@saboter
Copy link

saboter commented Apr 4, 2022

Hello,

rake translation:sync rake task fails with: Psych::BadAlias: Unknown alias: male_first_name under Ruby 3.1.1.

YAML::load calls across sources need to be updated.

Example adjustment (if you want to support older and newer Psych with same gem version):

read_options = RUBY_VERSION >= "3.1.0" ? { :aliases => true } : {}
configurations = YAML.load(File.read(file_path, **read_options)

Thank you.

@MichaelHoste
Copy link
Member

Hello @saboter,

We don't seem to use the aliases option in this gem, could you please tell us where this error comes from?
From one of our dependency maybe?

@saboter
Copy link
Author

saboter commented Apr 4, 2022

Hello @MichaelHoste,

this is the exception thrown by rake translation:sync with backtrace:

Psych::BadAlias: Unknown alias: male_first_name
/.rvm/gems/ruby-3.1.1/gems/translation-1.30/lib/translation_io/client/sync_operation/create_yaml_pot_file_step.rb:17:in `block in run'
/.rvm/gems/ruby-3.1.1/gems/translation-1.30/lib/translation_io/client/sync_operation/create_yaml_pot_file_step.rb:15:in `each'
/.rvm/gems/ruby-3.1.1/gems/translation-1.30/lib/translation_io/client/sync_operation/create_yaml_pot_file_step.rb:15:in `run'
/.rvm/gems/ruby-3.1.1/gems/translation-1.30/lib/translation_io/client/sync_operation.rb:39:in `run'
/.rvm/gems/ruby-3.1.1/gems/translation-1.30/lib/translation_io/client.rb:19:in `sync'
/.rvm/gems/ruby-3.1.1/gems/translation-1.30/lib/translation_io/tasks.rb:23:in `block (2 levels) in <main>'

@saboter
Copy link
Author

saboter commented Apr 4, 2022

I have used different exception thrown by other gem (yet caused by analogical problem) in the initial description.
Sorry for that (have already changed in the first post).

@MichaelHoste
Copy link
Member

Don't worry, I found the real issue here: https://stackoverflow.com/a/71192990/1243212

male_first_name comes from faker that uses YAML aliases, issue here: faker-ruby/faker#2330

That was fixed in Rails like this for the locales: https://github.com/ruby-i18n/i18n/pull/569/files

And like this for the configuration file: rails/rails@179d0a1

We'll release something similar as soon as possible, thank you for the warning 🙂

MichaelHoste added a commit that referenced this issue Apr 4, 2022
@MichaelHoste
Copy link
Member

It should be fixed on the master branch, could you please confirm?

If it works, we'll quickly release a new version.

@saboter
Copy link
Author

saboter commented Apr 4, 2022

It works.

Thank you.

@MichaelHoste
Copy link
Member

Version 1.31 is released with this fix.

Thank you for alerting us to this problem, it is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants