WeblateOrg / WeblateOrg/weblate

Introduce plurality handling based on message format for ngx-translate schema

Open
#2,967 9 comments 14 reactions 0 assignees View on GitHub
Blocked by upstream enhancement Waiting for: Demand
Dominant language
Python
Stars
6.1k
Forks
1.4k
Avg merge
9h 53m
Merged PRs (30d)
395

Description

## Situation
Having angular applications where ngx-translate is used as translation handler, the basic JSON output is used as translation resource. This itself does not support pluralization. Therefore, plug-ins are available to properly handle this based on ICU MessageFormat.

## Request
In order to use ngx-translate with proper pluralization, the schema needs to follow MessageFormat according ICU. Reference:
- NPM: https://www.npmjs.com/package/messageformat
- github: https://github.com/messageformat/messageformat
- https://messageformat.github.io/messageformat/

### Example
English source
```json
{
"TIMECOUNT": {
"YEAR": "{count, plural, one{year} other{years}}"
}
}
```
Czech translation
```json
{
"TIMECOUNT": {
"YEAR": "{count, plural, one{rok} few{roky} other{let}}"
}
}
```

### Requires
- importer / exporter for MessageFormat schema as JSON with Weblate

Follow-up to #2855

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.