InodeLabs/fern
1
14
Fork
You've already forked fern
2

i18n: CLDR support for Locales with multiple plurals #14

Closed
opened 2026年04月17日 12:51:00 +02:00 by bugwhisperer · 2 comments

Summary

In recent PR (#13), the author mentioned the fact that there are languages that will require more than two plural forms. While the current setup supports languages with no plurals (ex. Chinese, Japanese) and two forms (ex. Spanish, English), many Slavic languages (ex. Polish) have three or more form and languages like Arabic have six!

Fern i18n package needs to be reworked to support these languages as well. As mentioned in the PR, we need N plural forms and N is fixed per language. We'll move to using the CLDR standard to handle this in a good way: https://lingohub.com/blog/pluralization#cldr-overview

Conditions of Satisfaction

(削除) - [ ] locale [meta] should have a plural_forms int count to note how many plural forms (max) a language has (削除ここまで) [A/N: Didn't add anything really. The translation TOMLs hold everything in the plurals that they choose to encode.]

  • Use CLDR naming for [terms.nouns]
    • change singular >> one
    • change plural >> other
    • add two, few, and many
  • refactor existing locales [terms.nouns] to use new system
  • Helper function P11N(n) method picks the right plural form for the active language
  • rewire in code to use new nouns p11n setup
## Summary In recent PR (#13), the author mentioned the fact that there are languages that will require more than two plural forms. While the current setup supports languages with no plurals (ex. Chinese, Japanese) and two forms (ex. Spanish, English), many Slavic languages (ex. Polish) have three or more form and languages like Arabic have six! Fern i18n package needs to be reworked to support these languages as well. As mentioned in the PR, we need N plural forms and N is fixed per language. We'll move to using the CLDR standard to handle this in a good way: https://lingohub.com/blog/pluralization#cldr-overview ## Conditions of Satisfaction ~~- [ ] locale `[meta]` should have a `plural_forms` `int` count to note how many plural forms (max) a language has~~ [A/N: Didn't add anything really. The translation TOMLs hold everything in the plurals that they choose to encode.] - [x] Use CLDR naming for `[terms.nouns]` - [x] change `singular` >> `one` - [x] change `plural` >> `other` - [x] add `two`, `few`, and `many` - [x] refactor existing locales `[terms.nouns]` to use new system - [x] Helper function `P11N(n)` method picks the right plural form for the active language - [x] rewire in code to use new nouns p11n setup
Contributor
Copy link

I think the name plural is a good name, it should just be a function.

I think the name plural is a good name, it should just be a function.
Author
Owner
Copy link

@zyga wrote in #14 (comment):

I think the name plural is a good name, it should just be a function.

Maybe name it like (削除) PluralForm(n) (削除ここまで) P11N(n), so that it's more clear what it does, versus Form which could be confused with an input form?

EDIT: It's also not going to pluralize the noun necessarily (ie. n == 1), so settled on P11N (shorter to type and conveys it's intent[kind of? 😅]).

@zyga wrote in https://codeberg.org/InodeLabs/fern/issues/14#issuecomment-13256157: > I think the name plural is a good name, it should just be a function. Maybe name it like ~~`PluralForm(n)`~~ `P11N(n)`, so that it's more clear what it does, versus `Form` which could be confused with an input form? EDIT: It's also not going to pluralize the noun necessarily (ie. `n == 1`), so settled on P11N (shorter to type and conveys it's intent[kind of? 😅]).
Sign in to join this conversation.
No Branch/Tag specified
main
v1.5.6
v1.5.5
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.1
v1.4.0
v1.3.9
v1.3.8
v1.3.7
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.2.1
v1.2.0
v1.1.0-beta
v1.0.3-beta
v1.0.2-beta
v1.0.1-beta
v1.0.0-beta
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.3
v0.8.2
v0.8.1
v0.8.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
InodeLabs/fern#14
Reference in a new issue
InodeLabs/fern
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?