Jelajahi Sumber

chore: updated locale glossaries and docs sync workflow

Adam 1 bulan lalu
induk
melakukan
dbf2c45869

+ 53 - 6
.github/workflows/docs-locale-sync.yml

@@ -12,13 +12,14 @@ jobs:
     if: github.actor != 'opencode-agent[bot]'
     runs-on: blacksmith-4vcpu-ubuntu-2404
     permissions:
-      id-token: write
       contents: write
     steps:
       - name: Checkout repository
         uses: actions/checkout@v4
         with:
+          persist-credentials: false
           fetch-depth: 0
+          ref: ${{ github.ref_name }}
 
       - name: Setup Bun
         uses: ./.github/actions/setup-bun
@@ -51,9 +52,54 @@ jobs:
         uses: sst/opencode/github@latest
         env:
           OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
+          GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
+          OPENCODE_CONFIG_CONTENT: |
+            {
+              "permission": {
+                "*": "deny",
+                "read": {
+                  "*": "deny",
+                  "packages/web/src/content/docs": "allow",
+                  "packages/web/src/content/docs/*": "allow",
+                  "packages/web/src/content/docs/*.mdx": "allow",
+                  "packages/web/src/content/docs/*/*.mdx": "allow",
+                  ".opencode": "allow",
+                  ".opencode/agent": "allow",
+                  ".opencode/agent/glossary": "allow",
+                  ".opencode/agent/translator.md": "allow",
+                  ".opencode/agent/glossary/*.md": "allow"
+                },
+                "edit": {
+                  "*": "deny",
+                  "packages/web/src/content/docs/*/*.mdx": "allow"
+                },
+                "glob": {
+                  "*": "deny",
+                  "packages/web/src/content/docs*": "allow",
+                  ".opencode/agent/glossary*": "allow"
+                },
+                "task": {
+                  "*": "deny",
+                  "translator": "allow"
+                }
+              },
+              "agent": {
+                "translator": {
+                  "permission": {
+                    "*": "deny",
+                    "read": {
+                      "*": "deny",
+                      ".opencode/agent/translator.md": "allow",
+                      ".opencode/agent/glossary/*.md": "allow"
+                    }
+                  }
+                }
+              }
+            }
         with:
-          model: opencode/gpt-5.2
+          model: opencode/gpt-5.3-codex
           agent: docs
+          use_github_token: true
           prompt: |
             Update localized docs to match the latest English docs changes.
 
@@ -67,10 +113,11 @@ jobs:
             2. You MUST use the Task tool for translation work and launch subagents with subagent_type `translator` (defined in .opencode/agent/translator.md).
             3. Do not translate directly in the primary agent. Use translator subagent output as the source for locale text updates.
             4. Run translator subagent Task calls in parallel whenever file/locale translation work is independent.
-            5. Preserve frontmatter keys, internal links, code blocks, and existing locale-specific metadata unless the English change requires an update.
-            6. Keep locale docs structure aligned with their corresponding English pages.
-            7. Do not modify English source docs in packages/web/src/content/docs/*.mdx.
-            8. If no locale updates are needed, make no changes.
+            5. Use only the minimum tools needed for this task (read/glob, file edits, and translator Task). Do not use shell, web, search, or GitHub tools for translation work.
+            6. Preserve frontmatter keys, internal links, code blocks, and existing locale-specific metadata unless the English change requires an update.
+            7. Keep locale docs structure aligned with their corresponding English pages.
+            8. Do not modify English source docs in packages/web/src/content/docs/*.mdx.
+            9. If no locale updates are needed, make no changes.
 
       - name: Commit and push locale docs updates
         if: steps.changes.outputs.has_changes == 'true'

+ 3 - 0
.opencode/agent/glossary/README.md

@@ -9,6 +9,7 @@ The global glossary in `translator.md` remains the source of truth for shared do
 - One file per locale
 - Use lowercase locale slugs that match docs locales when possible (for example, `zh-cn.md`, `zh-tw.md`)
 - If only language-level guidance exists, use the language code (for example, `fr.md`)
+- Some repo locale slugs may be aliases/non-BCP47 for consistency (for example, `br` for Brazilian Portuguese / `pt-BR`)
 
 ## What To Put In A Locale File
 
@@ -17,6 +18,7 @@ The global glossary in `translator.md` remains the source of truth for shared do
 - **Preferred Terms**: recurring UI/docs words with preferred translations
 - **Guidance**: tone, style, and consistency notes
 - **Avoid** (optional): common literal translations or wording we should avoid
+- If the repo uses a locale alias slug, document the alias in **Guidance** (for example, prose may mention `pt-BR` while config/examples use `br`)
 
 Prefer guidance that is:
 
@@ -58,3 +60,4 @@ Prefer guidance that is:
 - Mark entries as preferred when they may evolve
 - Keep examples short
 - Add or update the `Sources` section whenever you add a new rule
+- Prefer PR-backed guidance over invented term mappings; start with general guidance if no term-level corrections exist yet

+ 28 - 0
.opencode/agent/glossary/ar.md

@@ -0,0 +1,28 @@
+# ar Glossary
+
+## Sources
+
+- PR #9947: https://github.com/anomalyco/opencode/pull/9947
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural Arabic phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+- For RTL text, treat code, commands, and paths as LTR artifacts and keep their character order unchanged
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple Arabic terms for the same recurring UI action once a preferred term is established

+ 34 - 0
.opencode/agent/glossary/br.md

@@ -0,0 +1,34 @@
+# br Glossary
+
+## Sources
+
+- PR #10086: https://github.com/anomalyco/opencode/pull/10086
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Locale code `br` in repo config, code, and paths (repo alias for Brazilian Portuguese)
+
+## Preferred Terms
+
+These are PR-backed locale naming preferences and may evolve.
+
+| English / Context                        | Preferred                      | Notes                                                         |
+| ---------------------------------------- | ------------------------------ | ------------------------------------------------------------- |
+| Brazilian Portuguese (prose locale name) | `pt-BR`                        | Use standard locale naming in prose when helpful              |
+| Repo locale slug (code/config)           | `br`                           | PR #10086 uses `br` for consistency/simplicity                |
+| Browser locale detection                 | `pt`, `pt-br`, `pt-BR` -> `br` | Preserve this mapping in docs/examples about locale detection |
+
+## Guidance
+
+- This file covers Brazilian Portuguese (`pt-BR`), but the repo locale code is `br`
+- Use natural Brazilian Portuguese phrasing over literal translation
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+- Keep repo locale identifiers as implemented in code/config (`br`) even when prose mentions `pt-BR`
+
+## Avoid
+
+- Avoid changing repo locale code references from `br` to `pt-br` in code snippets, paths, or config examples
+- Avoid mixing Portuguese variants when a Brazilian Portuguese form is established

+ 33 - 0
.opencode/agent/glossary/bs.md

@@ -0,0 +1,33 @@
+# bs Glossary
+
+## Sources
+
+- PR #12283: https://github.com/anomalyco/opencode/pull/12283
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+These are PR-backed locale naming preferences and may evolve.
+
+| English / Context                  | Preferred  | Notes                                             |
+| ---------------------------------- | ---------- | ------------------------------------------------- |
+| Bosnian language label (UI)        | `Bosanski` | PR #12283 tested switching language to `Bosanski` |
+| Repo locale slug (code/config)     | `bs`       | Preserve in code, config, paths, and examples     |
+| Browser locale detection (Bosnian) | `bs`       | PR #12283 added `bs` locale auto-detection        |
+
+## Guidance
+
+- Use natural Bosnian phrasing over literal translation
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+- Keep repo locale references as `bs` in code/config, and use `Bosanski` for the user-facing language name when applicable
+
+## Avoid
+
+- Avoid changing repo locale references from `bs` to another slug in code snippets or config examples
+- Avoid translating product and protocol names that are fixed identifiers

+ 27 - 0
.opencode/agent/glossary/da.md

@@ -0,0 +1,27 @@
+# da Glossary
+
+## Sources
+
+- PR #9821: https://github.com/anomalyco/opencode/pull/9821
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural Danish phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple Danish terms for the same recurring UI action once a preferred term is established

+ 27 - 0
.opencode/agent/glossary/de.md

@@ -0,0 +1,27 @@
+# de Glossary
+
+## Sources
+
+- PR #9817: https://github.com/anomalyco/opencode/pull/9817
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural German phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple German terms for the same recurring UI action once a preferred term is established

+ 27 - 0
.opencode/agent/glossary/es.md

@@ -0,0 +1,27 @@
+# es Glossary
+
+## Sources
+
+- PR #9817: https://github.com/anomalyco/opencode/pull/9817
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural Spanish phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple Spanish terms for the same recurring UI action once a preferred term is established

+ 27 - 0
.opencode/agent/glossary/fr.md

@@ -0,0 +1,27 @@
+# fr Glossary
+
+## Sources
+
+- PR #9821: https://github.com/anomalyco/opencode/pull/9821
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural French phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple French terms for the same recurring UI action once a preferred term is established

+ 33 - 0
.opencode/agent/glossary/ja.md

@@ -0,0 +1,33 @@
+# ja Glossary
+
+## Sources
+
+- PR #9821: https://github.com/anomalyco/opencode/pull/9821
+- PR #13160: https://github.com/anomalyco/opencode/pull/13160
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+These are PR-backed wording preferences and may evolve.
+
+| English / Context           | Preferred               | Notes                                 |
+| --------------------------- | ----------------------- | ------------------------------------- |
+| WSL integration (UI label)  | `WSL連携`               | PR #13160 prefers this over `WSL統合` |
+| WSL integration description | `WindowsのWSL環境で...` | PR #13160 improved phrasing naturally |
+
+## Guidance
+
+- Prefer natural Japanese phrasing over literal translation
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+- In WSL integration text, follow PR #13160 wording direction for more natural Japanese phrasing
+
+## Avoid
+
+- Avoid `WSL統合` in the WSL integration UI context where `WSL連携` is the reviewed wording
+- Avoid translating product and protocol names that are fixed identifiers

+ 27 - 0
.opencode/agent/glossary/ko.md

@@ -0,0 +1,27 @@
+# ko Glossary
+
+## Sources
+
+- PR #9817: https://github.com/anomalyco/opencode/pull/9817
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural Korean phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple Korean terms for the same recurring UI action once a preferred term is established

+ 38 - 0
.opencode/agent/glossary/no.md

@@ -0,0 +1,38 @@
+# no Glossary
+
+## Sources
+
+- PR #10018: https://github.com/anomalyco/opencode/pull/10018
+- PR #12935: https://github.com/anomalyco/opencode/pull/12935
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Sound names (PR #10018 notes these were intentionally left untranslated)
+
+## Preferred Terms
+
+These are PR-backed corrections and may evolve.
+
+| English / Context                   | Preferred    | Notes                         |
+| ----------------------------------- | ------------ | ----------------------------- |
+| Save (data persistence action)      | `Lagre`      | Prefer over `Spare`           |
+| Disabled (feature/state)            | `deaktivert` | Prefer over `funksjonshemmet` |
+| API keys                            | `API Nøkler` | Prefer over `API Taster`      |
+| Cost (noun)                         | `Kostnad`    | Prefer over verb form `Koste` |
+| Show/View (imperative button label) | `Vis`        | Prefer over `Utsikt`          |
+
+## Guidance
+
+- Prefer natural Norwegian Bokmal (Bokmål) wording over literal translation
+- Keep tone clear and practical in UI labels
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+- Keep recurring UI terms consistent once a preferred term is chosen
+
+## Avoid
+
+- Avoid `Spare` for save actions in persistence contexts
+- Avoid `funksjonshemmet` for disabled feature states
+- Avoid `API Taster`, `Koste`, and `Utsikt` in the corrected contexts above

+ 27 - 0
.opencode/agent/glossary/pl.md

@@ -0,0 +1,27 @@
+# pl Glossary
+
+## Sources
+
+- PR #9884: https://github.com/anomalyco/opencode/pull/9884
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural Polish phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple Polish terms for the same recurring UI action once a preferred term is established

+ 27 - 0
.opencode/agent/glossary/ru.md

@@ -0,0 +1,27 @@
+# ru Glossary
+
+## Sources
+
+- PR #9882: https://github.com/anomalyco/opencode/pull/9882
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+No PR-backed term mappings yet. Add entries here when review PRs introduce repeated wording corrections.
+
+## Guidance
+
+- Prefer natural Russian phrasing over literal translation
+- Keep tone clear and direct in UI labels and docs prose
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+
+## Avoid
+
+- Avoid translating product and protocol names that are fixed identifiers
+- Avoid mixing multiple Russian terms for the same recurring UI action once a preferred term is established

+ 34 - 0
.opencode/agent/glossary/th.md

@@ -0,0 +1,34 @@
+# th Glossary
+
+## Sources
+
+- PR #10809: https://github.com/anomalyco/opencode/pull/10809
+- PR #11496: https://github.com/anomalyco/opencode/pull/11496
+
+## Do Not Translate (Locale Additions)
+
+- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
+- `OpenCode CLI`
+- `CLI`, `TUI`, `MCP`, `OAuth`
+- Commands, flags, file paths, and code literals (keep exactly as written)
+
+## Preferred Terms
+
+These are PR-backed preferences and may evolve.
+
+| English / Context                     | Preferred             | Notes                                                                            |
+| ------------------------------------- | --------------------- | -------------------------------------------------------------------------------- |
+| Thai language label in language lists | `ไทย`                 | PR #10809 standardized this across locales                                       |
+| Language names in language pickers    | Native names (static) | PR #11496: keep names like `English`, `Deutsch`, `ไทย` consistent across locales |
+
+## Guidance
+
+- Prefer natural Thai phrasing over literal translation
+- Keep tone short and clear for buttons and labels
+- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
+- Keep language names static/native in language pickers instead of translating them per current locale (PR #11496)
+
+## Avoid
+
+- Avoid translating language names differently per current locale in language lists
+- Avoid changing `ไทย` to another display form for the Thai language option unless the product standard changes

+ 1 - 0
.opencode/agent/translator.md

@@ -29,6 +29,7 @@ When a locale glossary exists, use it to:
 - Apply preferred wording for recurring UI/docs terms in that locale
 - Preserve locale-specific do-not-translate terms and casing decisions
 - Prefer natural phrasing over literal translation when the locale file calls it out
+- If the repo uses a locale alias slug, apply that file too (for example, `pt-BR` maps to `br.md` in this repo)
 
 Locale guidance does not override code/command preservation rules or the global Do-Not-Translate glossary below.