i18n
i18n copied to clipboard
I18n::InvalidLocaleData: can not load translations from <path> #<Psych::SyntaxError: (<path>): found unknown escape character while parsing a quoted scalar
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
Hey @hardik-plume !
- What is the
psych
version you're using ? - Do you edit your files manually or you're using some 3-rd party tool (e.g. localeapp) ?
- Can you provide the yaml file or can you check if you can load it manually (
YAML.load_file(file)
) ? Thanks!
Please provide exact steps to reproduce this issue. On 11 Feb 2019, 19:18 +1100, Krzysztof Knapik [email protected], wrote:
Hey @hardik-plume !
- What is the psych version you're using ?
- Do you edit your files manually or you're using some 3-rd party tool (e.g. localeapp) ?
- Can you provide the yaml file or can you check if you can load it manually (YAML.load_file(file)) ? Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hey @hardik-plume !
- 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
- 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)
`
@hardik-plume Please format stacktraces with triple-backticks. This is pretty unreadable at the moment.
where did this end up?