mainio / decidim-module-term_customizer

Decidim module that allows customizing the localization terms in the system for specific contexts.
GNU Affero General Public License v3.0
15 stars 21 forks source link

Add I18n::Backend::Pluralization into I18nBackend #84

Closed takahashim closed 2 years ago

takahashim commented 2 years ago

I have tried this module in a Japanese locale, but the following error occurs.

i18n-error

This error occurs when there is only :other key for count: 1, but since singular and plural are the same in Japanese, it is normal that only :other is registered.

This error does not occur in a normal Rails application. I think the reason is due to the additional processing of I18n::Backend::Pluralization, which is done by the rails-i18n gem. On the other hand, Decidim::TermCustomizer introduced its own I18nBackend, which was not applied to this backend and thus seemed to cause the error.

To solve this, it is easy to add I18n::Backend::Pluralization in I18nBackend. Is there a problem with making this the default?

ahukkanen commented 2 years ago

Thanks @takahashim !

Could you add a test for this case to prevent regression?

takahashim commented 2 years ago

@ahukkanen Thanks, I've add a spec. If you comment out the include I18n::Backend::Pluralization line in 18n_backend.rb, this spec should fail.