https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292022-01-07T11:08:10ZRedmineRedmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1051342022-01-07T11:08:10ZFelix Schäfer
<ul><li><strong>File</strong> <a href="/attachments/28642">36396-apply_custom_pluralization_rules.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/28642/36396-apply_custom_pluralization_rules.patch">36396-apply_custom_pluralization_rules.patch</a> added</li></ul><p>The attached Patch changes the inclusion of <code>::I18n::Backend::Pluralization</code> to the correct class.</p> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1051642022-01-10T05:10:26ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/21856">Defect #21856</a>: I18n backend does not support original i18n Pluralization</i> added</li></ul> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1051662022-01-10T06:53:08ZGo MAEDA
<ul></ul><p>Felix, do you think the following code I wrote properly tests the issue?</p>
<pre><code class="diff syntaxhl"><span class="gh">diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb
index 4856c5190..8d076a385 100644
</span><span class="gd">--- a/test/unit/lib/redmine/i18n_test.rb
</span><span class="gi">+++ b/test/unit/lib/redmine/i18n_test.rb
</span><span class="p">@@ -255,4 +255,13 @@</span> class Redmine::I18nTest < ActiveSupport::TestCase
set_language_if_valid 'fr'
assert_equal 'French (Français)', l(:general_lang_name)
end
<span class="gi">+
+ def test_custom_pluralization_rules
+ I18n.backend.store_translations :en, i18n: {plural: {rule: ->(n) {[0, 1].include?(n) ? :one : :other }}}
+ I18n.backend.store_translations :en, apples: {one: 'one or none', other: 'more than one'}
+ assert_equal 'one or none', ll(:en, :apples, count: 0)
+ assert_equal 'more than one', ll(:en, :apples, count: 2)
+ ensure
+ I18n.reload!
+ end
</span> end
</code></pre> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1051682022-01-10T08:30:14ZGo MAEDA
<ul><li><strong>Category</strong> changed from <i>Translations</i> to <i>I18n</i></li></ul> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1051692022-01-10T09:32:25ZFelix Schäfer
<ul></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>Felix, do you think the following code I wrote properly tests the issue?</p>
</blockquote>
<p>Thank you very much for the suggestion. The proposed test should catch a misconfiguration of the `::I18n::Backend::Pluralization` backend in `::Redmine::I18n`.</p> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1051702022-01-10T09:56:32ZGo MAEDA
<ul><li><strong>Target version</strong> set to <i>4.1.6</i></li></ul><p>Setting the target version to 4.1.6.</p> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1052232022-01-15T03:18:45ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Committed the fix. Thank you.</p> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1053162022-01-21T01:59:09ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/36461">Defect #36461</a>: I18nTest#test_custom_pluralization_rules randomly fails</i> added</li></ul> Redmine - Defect #36396: Custom I18n Pluralization rules are not applied correctlyhttps://www.redmine.org/issues/36396?journal_id=1053532022-01-22T09:17:27ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>Target version</strong> changed from <i>4.1.6</i> to <i>5.0.0</i></li></ul>