bitwalker / timex

A complete date/time library for Elixir projects.
https://hexdocs.pm/timex
MIT License
1.76k stars 379 forks source link

Avoid GetText deprecation warning when using newer GetText #733

Closed JasonTrue closed 1 year ago

JasonTrue commented 1 year ago

Summary of changes

(Please note: this summary has been substantially edited to reflect my current understanding per @Sinc63's comments).

Newer versions of gettext are pickier about the Plural-Forms header structure than before, and will ignore the nplurals behavior unless there is 1) a rule for which plural form to support and 2) the rule is in the expected format.

To avoid deprecation warnings, the Plural form rules need to be corrected. Alternatively, custom implementations of the GetText.Plural behavior can be used, especially if custom behavior is required. See GetText.Plural module documentation

As far as I can tell, the rules used by Timex mirror the rules implemented by the transitive dependency gettext 0.22 now has on Expo, so I don't see an immediate need for a custom implementation of Gettext.Plural.

This PR also removes an incorrectly specified plural rule for Indonesian.

There may be some remaining issues with Russian and possibly languages with similar pluralization rules, like Croatian, Polish, and Serbian, as several unit tests for Russian still fail.

Checklist

JasonTrue commented 1 year ago

Fixes #734.

maennchen commented 1 year ago

so I don't see an immediate need for a custom implementation of Gettext.Plural

That would only be needed if you implement pluralization yourself. Here this is not needed.

travismorrison commented 1 year ago

Hi--any thoughts on when this will get merged? we're mildly blocked on updating deps on one of our apps.

KernelMadness commented 1 year ago

Hi, also want to support this PR, looks like it needs only one review from @maennchen

bitwalker commented 1 year ago

I'll get this released ASAP

warmwaffles commented 1 year ago

@bitwalker any chance for a release with this fix included?

bitwalker commented 1 year ago

Done