Skip to content

Persian context-tool count labels are translated as verbs #50443

Done

Description

@MiRHaDi

Description

The Persian context-tool summaries translate operation counts as verbs: {{count}} می خواند (reads) and {{count}} جستجو می کند (searches), while the singular read label is {{count}} خوانده شود (should be read). These are counts of operations in ContextToolGroup, not instructions or sentences about the number. The changed-file plural label also adds an unnecessary plural suffix after a number.

Version

Source at f54ce313b99a6661d7758ad042f7a6e05c8e0972 on dev (app package 1.18.31).

Reproduction

Inspect packages/ui/src/i18n/fa.ts, keys ui.messagePart.context.{read,search,list}.{one,other} and ui.sessionTurn.diffs.changed.{one,other}. Substitute count 1 or 2. These keys are used by the context-tool summary and changed-file summary.

Expected: concise count labels such as 2 بار خواندن, 2 جستجو, and 2 فایل تغییریافته, consistent across Persian plural categories. This is a source/catalog reproduction; I have not reproduced it in a full running application.

Operating System

Windows; the affected resource is shared across web/desktop platforms.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I confirmed this from the string catalog. I built the Persian labels the same way packages/ui/src/context/i18n.tsx does (Intl.PluralRules('fa') category, then {{count}} substitution) for counts 1, 2 and 5:

    • context.read: 1 خوانده شود / 2 می خواند, where English has 1 read / 2 reads
    • context.search: جستجوی 1 / 2 جستجو می کند, where English has 1 search / 2 searches
    • context.list: لیست 1 / لیست های 2, where English has 1 list / 2 lists
    • diffs.changed: 1 فایل تغییر یافته است / 2 فایل های تغییر یافته است, where English has 1 Changed file / 2 Changed files

    The English strings are short count labels; the Persian ones read as verbs or sentences. It still happens on the latest dev (fa1260d). The script below prints these labels next to English for any git ref.

    Reproduction script (fa-labels.sh)
    #!/usr/bin/env bash
    # Usage: fa-labels.sh <path-to-opencode-checkout> [git-ref]
    # Prints the Persian (fa) count labels used by the context-tool and changed-file
    # summaries, resolved like packages/ui/src/context/i18n.tsx does (Intl.PluralRules
    # category -> `${key}.${category}` -> {{count}} substitution), next to English.
    set -euo pipefail
    REPO=${1:-/workspace/repo}; REF=${2:-HEAD}
    TMP=$(mktemp -d)
    git -C "$REPO" show "$REF:packages/ui/src/i18n/fa.ts" > "$TMP/fa.ts"
    git -C "$REPO" show "$REF:packages/ui/src/i18n/en.ts" > "$TMP/en.ts"
    cat > "$TMP/run.ts" <<'TS'
    import { dict as fa } from "./fa.ts"
    import { dict as en } from "./en.ts"
    const keys = ["ui.messagePart.context.read", "ui.messagePart.context.search", "ui.messagePart.context.list", "ui.sessionTurn.diffs.changed"]
    const label = (d: Record<string, string>, locale: string, key: string, count: number) => {
      const cat = new Intl.PluralRules(locale).select(count)
      const v = d[`${key}.${cat}`] ?? d[`${key}.other`]
      return `[${cat}] ` + v.replace(/{{\s*count\s*}}/g, String(count))
    }
    for (const key of keys) for (const n of [1, 2, 5])
      console.log(`${key} n=${n}\n  en: ${label(en, "en", key, n)}\n  fa: ${label(fa, "fa", key, n)}`)
    TS
    bun "$TMP/run.ts"

    Run it: bash fa-labels.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions