Defect #21856

I18n backend does not support original i18n Pluralization

Added by Vasil Kovalevsky almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:I18n
Target version:3.3.0
Resolution:Fixed Affected version:

Description

Hello, again me.
In our projects (redmines 3.2.0) we are using russian language sometimes. And sometimes we have problems with int plural in words (In our own others projects everything fine).
I know how to fix this, just need to implemet CLDR rules. I figured out how to do it, but yours backend of i18n breaks all my dreams ^^.
So, please, restore i18n logic. There is lot of related issues to #12645 in redmine.org, but you still does not fix this simple miss.

Why this happened:
I18n::Backend::Base which you are include to module Implementation of Redmine::I18n::Backend contains pluralize method only for English language (:one or :other from locales).

How to:
In module Implementation of Redmine::I18n::Backend class need to add this:

include ::I18n::Backend::Pluralization

Original implementation of I18n::Backend

    autoload :Base,                  'i18n/backend/base'
    autoload :InterpolationCompiler, 'i18n/backend/interpolation_compiler'
    autoload :Cache,                 'i18n/backend/cache'
    autoload :Cascade,               'i18n/backend/cascade'
    autoload :Chain,                 'i18n/backend/chain'
    autoload :Fallbacks,             'i18n/backend/fallbacks'
    autoload :Flatten,               'i18n/backend/flatten'
    autoload :Gettext,               'i18n/backend/gettext'
    autoload :KeyValue,              'i18n/backend/key_value'
    autoload :Memoize,               'i18n/backend/memoize'
    autoload :Metadata,              'i18n/backend/metadata'
    autoload :Pluralization,         'i18n/backend/pluralization'
    autoload :Simple,                'i18n/backend/simple'
    autoload :Transliterator,        'i18n/backend/transliterator'

As you can see, there is Pluralization exists.
I18n::Backend::Pluralization contains rails logic for extandable plural for different languages. We can easily place our ru.rb file to config\locales and write some simple logic from CLDR.

Thats all.

Today i just wrote small patch for one of our plugin, but it s stupid, we need general solution.

Thanks in advance.

21856.patch Magnifier (552 Bytes) Vasil Kovalevsky, 2016-02-24 04:52

Associated revisions

Revision 15281
Added by Toshi MARUYAMA almost 2 years ago

include ::I18n::Backend::Pluralization (#21856)

Contributed by Vasil Kovalevsky.

History

#1 Updated by Toshi MARUYAMA almost 2 years ago

  • Category set to I18n

#2 Updated by Toshi MARUYAMA almost 2 years ago

  • Status changed from New to Needs feedback

Could you give us patch for Redmine core?

#3 Updated by Vasil Kovalevsky almost 2 years ago

Ok. Here is patch. As i wrote, only 1 line +

#4 Updated by Toshi MARUYAMA almost 2 years ago

  • Status changed from Needs feedback to Closed
  • Target version set to 3.3.0
  • Resolution set to Fixed

Committed in trunk r15281, thanks.

Also available in: Atom PDF