wxt-dev / wxt-dev/wxt

i18n - support defining plural counts dynamically

Open
#1,848 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Feature Request

Let's say you got this:

popup:
  speed:
    affectedVideos:
      0: Żaden film nie miał zmienionej prędkości.
      1: 1 film miał zmienioną prędkość.
      n: $1 filmów miało zmienioną prędkość.

The 3rd n option is not gramatically valid for all cases in Polish. It'd need to be split into two cases:

  • 2-4 - "$1 filmy miały zmienioną prędkość."
  • 5-inf - "$1 filmów miało zmienioną prędkość."

I tried adding all 2, 3 and 4 separately as repeats, but WXT throws an error that the plural count is unknown, I suggest adding minimum the option to define translations for any counts. It'd be great if it also supported ranged like mentioned 2-4 - I don't know if that's what i18n libs do usually, I'm not expert at them, but I know bunch of them definitely support more cases than just 0/1/n.

Is your feature request related to a bug?

N/A

What are the alternatives?

You tell me. Well, one alternative is for sure to change the string to be different, e.g. "Liczba filmów ze zmienioną prędkością: $1." in this case, as I just did, but it's not always a possibility.

Additional context

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, entry points, or tests. Start by locating WXT's i18n plural-count parsing and its existing pluralization tests, then determine how arbitrary counts and ranges such as 2-4 should be represented. Done means Polish-style plural cases can be defined without an unknown-count error and are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
internationalization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.