This project is archived and is in readonly mode.
Array#to_sentence raises with missing translations
Reported by abriening | February 18th, 2009 @ 08:37 PM | in 2.x
The Array#to_sentence raises errors if a locale other than :en is used and is missing the default values. ( Think custom I18n.backend that is user editable ).
Also, anywhere that uses to_sentence for errors and logging probably shouldn't be localized.
Duration.inspect was also making weird use of to_sentence ( ie, "5 minutes und 30 seconds" for a I18n.locale of :de" ).
Added a patch that will only lookup the defaults if not passed in. Stores defaults in an Array constant. Patches any internal use of to_sentence to always pass in the defaults hash. Test for ensuring that defaults are not looked-up when defaults are passed in.
This will need to be merged with Ticket #1847 if accepted.
Comments and changes to this ticket
-
DHH February 22nd, 2009 @ 03:18 PM
- Assigned user set to Sven Fuchs
-
abriening February 22nd, 2009 @ 05:58 PM
Just wanted to clarify, this does not raise with the I8n.default_exception_handler but makes ugly logs and error messages.
irb(main):002:0> require 'activesupport.rb' => true irb(main):003:0> [1,2,3].to_sentence => "1, 2, and 3" irb(main):004:0> [1,2,3].to_sentence :locale => :de => "1translation missing: de, support, array, words_connector2translation missing: de, support, array, last_word_connector3"
This was raising with my overridden exception_handler didn't realize this till after I posted this ticket.
Either way Rails' internal errors and logging shouldn't be localized.
-
abriening February 22nd, 2009 @ 06:35 PM
- Tag changed from activesupport, array, duration, i18n, to_sentence to activesupport, array, duration, i18n, patch, to_sentence
Adding a new patch.
Includes changes from commit ff1afb, #1847.
Note this patch assumes that you are either using the old :connector and :skip_last_comma options or the new options but not both.
I also followed the guidelines this time :)
-
Repository February 27th, 2009 @ 01:23 PM
- State changed from new to resolved
(from [6de83562f91028629bd24447aa521bc72ef8277a]) Force all internal calls to Array#to_sentence to use English [#2010 state:resolved] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
Attachments
Referenced by
- 2010 Array#to_sentence raises with missing translations (from [6de83562f91028629bd24447aa521bc72ef8277a]) Force a...