https://github.com/OkaeriPoland/okaeri-pluralize
Simple pluralization library with support for the rules of 143 locales
https://github.com/OkaeriPoland/okaeri-pluralize
i18n java pluralization translation
Last synced: about 2 months ago
JSON representation
Simple pluralization library with support for the rules of 143 locales
- Host: GitHub
- URL: https://github.com/OkaeriPoland/okaeri-pluralize
- Owner: OkaeriPoland
- License: mit
- Created: 2021-04-08T04:06:49.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-22T20:36:20.000Z (over 2 years ago)
- Last Synced: 2025-03-08T15:50:05.557Z (about 2 months ago)
- Topics: i18n, java, pluralization, translation
- Language: Java
- Homepage:
- Size: 14.6 KB
- Stars: 10
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Okaeri Pluralize




[](https://discord.gg/hASN5eX)Simple pluralization library with support for the rules of 143 locales.
Based on [translate/l10n-guide](https://github.com/translate/l10n-guide/blob/master/docs/l10n/pluralforms.rst).
Part of the [okaeri-placeholders](https://github.com/OkaeriPoland/okaeri-placeholders).## Installation
### Maven
Add repository to the `repositories` section:
```xml
okaeri-repo
https://storehouse.okaeri.eu/repository/maven-public/```
Add dependency to the `dependencies` section:
```xml
eu.okaeri
okaeri-pluralize
1.1.1```
### Gradle
Add repository to the `repositories` section:
```groovy
maven { url "https://storehouse.okaeri.eu/repository/maven-public/" }
```Add dependency to the `maven` section:
```groovy
implementation 'eu.okaeri:okaeri-pluralize:1.1.1'
```## Usage
```java
// import static eu.okaeri.pluralize.Pluralize.pluralize;pluralize(Locale.ENGLISH, -1, "apple", "apples") // apples
pluralize(Locale.ENGLISH, 0, "apple", "apples") // apples
pluralize(Locale.ENGLISH, 1, "apple", "apples") // apple
pluralize(Locale.ENGLISH, 2, "apple", "apples") // apples
pluralize(Locale.forLanguageTag("pl"), -1, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 0, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 1, "pies", "psy", "psów") // pies
pluralize(Locale.forLanguageTag("pl"), 2, "pies", "psy", "psów") // psy
pluralize(Locale.forLanguageTag("pl"), 3, "pies", "psy", "psów") // psy
pluralize(Locale.forLanguageTag("pl"), 4, "pies", "psy", "psów") // psy
pluralize(Locale.forLanguageTag("pl"), 5, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 6, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 20, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 21, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 22, "pies", "psy", "psów") // psy
pluralize(Locale.forLanguageTag("pl"), 23, "pies", "psy", "psów") // psy
pluralize(Locale.forLanguageTag("pl"), 24, "pies", "psy", "psów") // psy
pluralize(Locale.forLanguageTag("pl"), 25, "pies", "psy", "psów") // psów
pluralize(Locale.forLanguageTag("pl"), 26, "pies", "psy", "psów") // psów
```