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

translation missing error: with vague: and locale: used together #44

Open
redbar0n opened this issue Feb 6, 2015 · 4 comments
Open
Labels

Comments

@redbar0n
Copy link
Contributor

redbar0n commented Feb 6, 2015

It seems like it isn't possible to specify both :vague and :locale at the same time.

PS: "rundt 1 år" means "about 1 year" in Norwegian.

>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, {vague: true, locale: :nb})
=> "rundt 1 år"
>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, {vague: true, locale: :en})
=> "rundt 1 år"
>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, {locale: :en, vague: true})
=> "rundt 1 år"
>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, locale: :en, vague: true)
=> "rundt 1 år"
>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, vague: true, locale: :en)
=> "rundt 1 år"
>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, vague: true)
=> "rundt 1 år"
>> helper.distance_of_time_in_words(Time.now, Time.now + 1.year + 2.months, false, locale: :en)
=> "1 year', '2 months', '3 days', '3 hours', and '5 minutes"
@radar
Copy link
Owner

radar commented Feb 8, 2015

@redbar0n Thanks for reporting this bug. Do you have time to write a regression test and investigate a fix for this?

@radar
Copy link
Owner

radar commented Feb 14, 2015

Ping @redbar0n again.

@redbar0n
Copy link
Contributor Author

Hey, sorry, been a bit busy, and this bug didn't really impede my work, since I didn't want :vague.
But I'll put it on my todo list for the first spare time opportunity that presents itself. :)

dblock added a commit to dblock/distance_of_time_in_words that referenced this issue Jul 2, 2020
@dblock
Copy link
Collaborator

dblock commented Jul 2, 2020

The vague option is just a fallback to the Rails/ActionView version of distance_of_time_in_words. Sort of a repro in dblock@d38961f, if anyone wants to fix.

  1) A better distance_of_time_in_words with output options ActionView should be rundt 1 år
     Failure/Error: expect(distance_of_time_in_words(start, finish, true, options)).to eq(output)
     
       expected: "rundt 1 år"
            got: "translation missing: nb.datetime.distance_in_words.about_x_years"
     
       (compared using ==)
     # ./spec/lib/dotiw_spec.rb:287:in `block (5 levels) in <top (required)>'

Looks like a locale file is not being loaded, it could just be a configuration problem in the test setup for locale files, not sure what's the best way to fix.

@dblock dblock added the bug? label Jul 2, 2020
@dblock dblock changed the title Using :vague nullifies the specified :locale translation missing error: with vague: and locale: used together Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants