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

I18n::InvalidLocaleData: can not load translations from <path> #<Psych::SyntaxError: (<path>): found unknown escape character while parsing a quoted scalar #467

Open
hardik-plume opened this issue Feb 11, 2019 · 5 comments

Comments

@hardik-plume
Copy link

hardik-plume commented Feb 11, 2019

What I tried to do

Use I18n outside rails for my rspec test. One of the yaml strings is invalid_email_address: "L\'adresse e-mail n\'est pas valide"

What I expected to happen

When i call I18n.t(:invalid_email_address) in my rspec, it should return string "L'adresse e-mail n'est pas valide"

What actually happened

I actually get an error

Versions of i18n, rails, and anything else you think is necessary

i18n gem version 1.5.3, ruby 2.6.1, osx 10.14.3

same code worked on ruby 2.4.2

@knapo
Copy link
Collaborator

knapo commented Feb 11, 2019

Hey @hardik-plume !

  1. What is the psych version you're using ?
  2. Do you edit your files manually or you're using some 3-rd party tool (e.g. localeapp) ?
  3. Can you provide the yaml file or can you check if you can load it manually (YAML.load_file(file)) ?
    Thanks!

@radar
Copy link
Collaborator

radar commented Feb 11, 2019 via email

@hardik-plume
Copy link
Author

hardik-plume commented Feb 11, 2019

Hey @hardik-plume !

  1. What is the psych version you're using ?

`Hardiks-MacBook-Pro-3:~ hardik$ rvm list
ruby-2.4.1 [ x86_64 ]
ruby-2.4.2 [ x86_64 ]
=* ruby-2.6.1 [ x86_64 ]

=> - current

=* - current && default

* - default

Hardiks-MacBook-Pro-3:~ hardik$ gem list libyaml

*** LOCAL GEMS ***

Hardiks-MacBook-Pro-3:~ hardik$ gem list yaml

*** LOCAL GEMS ***

Hardiks-MacBook-Pro-3:~ hardik$ gem list psych

*** LOCAL GEMS ***

psych (default: 3.1.0)
Hardiks-MacBook-Pro-3:~ hardik$ gem list i18n

*** LOCAL GEMS ***

i18n (1.5.3, 0.9.5)
`
2. Do you edit your files manually or you're using some 3-rd party tool (e.g. localeapp) ?

  • I edit my yaml file manually
  1. Can you provide the yaml file or can you check if you can load it manually (YAML.load_file(file)) ?

Hardiks-MacBook-Pro-3:~ hardik$ irb 2.6.1 :001 > irb 2.6.1 :001 > require 'yaml' => true 2.6.1 :002 > YAML.load_file File.open("/Users/Hardik/projects/mobile-automation/spec/fixtures/translations/fr.yml") Traceback (most recent call last): 8: from (irb#1):2 7: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:577:in load_file'
6: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:577:in open' 5: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:578:in block in load_file'
4: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:277:in load' 3: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:390:in parse'
2: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:456:in parse_stream' 1: from /Users/hardik/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/psych.rb:456:in parse'
Psych::SyntaxError ((#File:0x00007fd1ca906520): found unknown escape character while parsing a quoted scalar at line 3 column 26)
`

@radar
Copy link
Collaborator

radar commented Feb 25, 2019

@hardik-plume Please format stacktraces with triple-backticks. This is pretty unreadable at the moment.

@courtsimas
Copy link

where did this end up?

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

4 participants