Download packages/ui/src/context/i18n.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 629 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/ui/src/context/i18n.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/ui/src/context/i18n.test.ts
-
curl -L -o i18n.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/ui/src/context/i18n.test.ts
629 Bytes
| import { describe, expect, test } from "bun:test" | |
| import { pluralCategory } from "./i18n" | |
| describe("pluralCategory", () => { | |
| test.each([ | |
| ["en", 0, "other"], | |
| ["en", 1, "one"], | |
| ["fr", 0, "one"], | |
| ["fr", 1_000_000, "many"], | |
| ["ru", 1, "one"], | |
| ["ru", 2, "few"], | |
| ["ru", 5, "many"], | |
| ["ru", 21, "one"], | |
| ["ar", 0, "zero"], | |
| ["ar", 1, "one"], | |
| ["ar", 2, "two"], | |
| ["ar", 3, "few"], | |
| ["ar", 11, "many"], | |
| ["ar", 100, "other"], | |
| ["ja", 1, "other"], | |
| ] as const)("selects %s for %d as %s", (locale, count, expected) => { | |
| expect(pluralCategory(locale, count)).toBe(expected) | |
| }) | |
| }) | |