[openstreetmap/openstreetmap-website] Update to i18n-js 4.x (PR #5811)
Tom Hughes
notifications at github.com
Mon Mar 17 17:12:29 UTC 2025
@tomhughes commented on this pull request.
>
// '-' are replaced with '_' in https://github.com/eemeli/make-plural/tree/main/packages/plurals
const pluralizer = plurals[locale.replace(/\W+/g, "_")] || plurals[locale.split("-")[0]];
if (pluralizer) {
- I18n.pluralization[locale] = (count) => [pluralizer(count), "other"];
+ OSM.i18n.pluralization.register(locale, I18n.useMakePlural({ pluralizer: locale }));
The actual example upstream is:
```js
register("ru", useMakePlural({ pluralizer: ru })
```
which I misread as I didn't notice the difference between the constant string `ru` and the variable `ru` so I'll fix that now.
I had been struggling to understand your fallback simply because upstream doesn't seem to document the return value of the pluralizer so while I thought it was some sort of fallback but I've found the code in the source now and understand it so I'll fix that as well.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5811#discussion_r1999266630
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5811/review/2691425390 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250317/ae74d2a9/attachment.htm>
More information about the rails-dev
mailing list