Project

General

Profile

Defect #36461 ยป 36461.patch

Yuichi HARADA, 2022-01-21 06:59

View differences:

test/unit/lib/redmine/i18n_test.rb
257 257
  end
258 258

  
259 259
  def test_custom_pluralization_rules
260
    pluralizers = I18n.backend.instance_variable_get(:@pluralizers)
261
    I18n.backend.instance_variable_set(:@pluralizers, nil)
260 262
    I18n.backend.store_translations :pt, i18n: {plural: {rule: ->(n) {[0, 1].include?(n) ? :one : :other }}}
261 263
    I18n.backend.store_translations :pt, apples: {one: 'one or none', other: 'more than one'}
262 264
    assert_equal 'one or none', ll(:pt, :apples, count: 0)
263 265
    assert_equal 'more than one', ll(:pt, :apples, count: 2)
264 266
  ensure
265
    I18n.reload!
267
    I18n.backend.instance_variable_set(:@pluralizers, pluralizers)
266 268
  end
267 269
end
    (1-1/1)