Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 23 days 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 (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-22T20:36:20.000Z (about 2 years ago)
- Last Synced: 2023-03-06T22:57:19.949Z (over 1 year ago)
- Topics: i18n, java, pluralization, translation
- Language: Java
- Homepage:
- Size: 14.6 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Okaeri Pluralize
![License](https://img.shields.io/github/license/OkaeriPoland/okaeri-pluralize)
![Total lines](https://img.shields.io/tokei/lines/github/OkaeriPoland/okaeri-pluralize)
![Repo size](https://img.shields.io/github/repo-size/OkaeriPoland/okaeri-pluralize)
![Contributors](https://img.shields.io/github/contributors/OkaeriPoland/okaeri-pluralize)
[![Discord](https://img.shields.io/discord/589089838200913930)](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
```