Actions
Defect #42580
closedArray#to_sentence produces incorrect output due to missing translation keys
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
Currently, most locales define translations for Array#to_sentence using sentence_connector
and skip_last_comma
. However, these keys were replaced in Rails 2.3 (Release note) by last_word_connector
, two_words_connector
, and words_connector
.
This patch updates the old keys to the new ones so that Array#to_sentence
works as expected. The changes follow these rules:
- Values for the new keys are taken from the rails-i18n gem's locale settings .
- Locales that already define the new keys are left unchanged.
- zh (zh-CN) is aligned with the zh-TW settings.
Redmine currently does not use Array#to_sentence
, so this patch should not affect any functionality or UI. However, some third-party plugins might use it.
I confirmed that all tests, including system tests, pass after applying this patch. Here’s how Array#to_sentence
behaves with the updated translations:
$ bin/rails console redmine-app(dev)> array = ['Redmine', 'Ruby', 'Rails', 'ルビー', '紅寶石'] => ["Redmine", "Ruby", "Rails", "ルビー", "紅寶石"] redmine-app(dev)> array.to_sentence(locale: :en) => "Redmine, Ruby, Rails, ルビー, and 紅寶石" redmine-app(dev)> array.to_sentence(locale: :ja) => "Redmine、Ruby、Rails、ルビー、紅寶石" redmine-app(dev)> array.to_sentence(locale: :zh) => "Redmine, Ruby, Rails, ルビー, 和 紅寶石"
Files
Actions