GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(site): finish the docs UI labels and stamp intentional English (#… · erickwill/opencode@2204311

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • services/site
    • src/i18n
      • ar.ts
      • br.ts
      • check.ts
      • da.ts
      • de.ts
      • en.ts
      • es.ts
      • fr.ts
      • it.ts
      • ja.ts
      • ko.ts
      • no.ts
      • pl.ts
      • ru.ts
      • stamps
        • ar.json
        • br.json
        • da.json
        • de.json
        • es.json
        • fr.json
        • it.json
        • ja.json
        • ko.json
        • no.json
        • pl.json
        • ru.json
        • th.json
        • tr.json
        • uk.json
        • zh.json
        • zht.json
      • th.ts
      • tr.ts
      • uk.ts
      • zh.ts
      • zht.ts
    • test
      • consoleMarketing.test.ts
      • i18n.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎services/site/src/i18n/ar.ts‎

Copy file name to clipboardExpand all lines: services/site/src/i18n/ar.ts
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const dict = {
3131
"legal.englishOnly": "هذا المستند متاح باللغة الإنجليزية فقط.",
3232
"notFound.title": "الصفحة غير موجودة | OpenCode",
3333
"notFound.heading": "404 - الصفحة غير موجودة",
34-
"notFound.home": "الرئيسية",
3534
"notFound.docs": "الوثائق",
3635
"notFound.github": "GitHub",
3736
"notFound.discord": "Discord",
@@ -48,7 +47,6 @@ export const dict = {
4847
"home.title": "OpenCode | وكيل برمجة مفتوح المصدر لأي نموذج",
4948
"temp.title": "OpenCode | وكيل برمجة صُمّم للطرفية",
5049
"temp.hero.title": "وكيل برمجة صُمّم للطرفية",
51-
"temp.zen": "OpenCode Models",
5250
"temp.feature.models.beforeLink": "يدعم أكثر من 200 مزوّد لنماذج LLM عبر",
5351
"home.banner.badge": "جديد",
5452
"home.promo.title": "علامات التبويب تصل إلى Desktop",
@@ -189,7 +187,6 @@ export const dict = {
189187
"go.faq.a4.p2.accountLink": "حسابك",
190188
"go.faq.a4.p3": "ألغِ في أي وقت.",
191189
"go.faq.q5": "ماذا عن البيانات والخصوصية؟",
192-
"go.faq.a5.model": "النموذج",
193190
"go.faq.a5.training": "تدريب النموذج",
194191
"go.faq.a5.retention": "الاحتفاظ بالبيانات",
195192
"go.faq.a5.retention30": "30 يومًا",
@@ -211,7 +208,6 @@ export const dict = {
211208
"go.faq.q9": "ما الفرق بين النماذج المجانية وGo؟",
212209
"go.faq.a9":
213210
"تشمل النماذج المجانية Big Pickle والنماذج الترويجية المتاحة حينها. يقدّم Go نماذج مختارة بحصص طلبات أعلى على فترات متجدّدة: 20% من الحد الشهري لكل 5 ساعات، و50% لكل أسبوع، و100% لكل شهر. وقد يختلف الحد من نموذج إلى آخر، ويختلف العدد الفعلي للطلبات حسب النموذج والاستخدام.",
214-
"workspace.nav.zen": "OpenCode Models",
215211
"workspace.newUser.feature.lockin.body":
216212
"استخدم OpenCode Models مع أي وكيل برمجة، وواصل استخدام مزوّدين آخرين مع OpenCode متى شئت.",
217213
"download.hero.title": "نزّل OpenCode Desktop",
@@ -371,7 +367,7 @@ export const dict = {
371367
"docs.codeExamples": "أمثلة الكود",
372368
"docs.code.terminal": "الطرفية",
373369
"docs.code.files": "الملفات",
374-
"docs.code.diff": "Diff",
370+
"docs.code.diff": "الفروق",
375371
"docs.callout.note": "ملاحظة",
376372
"docs.callout.tip": "نصيحة",
377373
"docs.callout.caution": "تنبيه",
@@ -660,7 +656,6 @@ export const dict = {
660656
"site.action.forOsBeta": "تنزيل لـ {{os}}، نسخة Apple TestFlight التجريبية",
661657
"site.action.storeBeta": "{{os}}، نسخة Apple TestFlight التجريبية",
662658
"home.companies.labelShort": "ثقة أكثر من 22 مليون مطوّر",
663-
"nav.subscription": "الاشتراك",
664659
"go.referral.ended.label": "تحذير",
665660
"go.referral.ended": "انتهى برنامج الإحالة. لم تعد روابط الإحالة تمنح رصيدًا لك أو للشخص الذي شاركها.",
666661
"legal.status.operational": "كل الأنظمة تعمل",
Collapse file

‎services/site/src/i18n/br.ts‎

Copy file name to clipboardExpand all lines: services/site/src/i18n/br.ts
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export const dict = {
2020
"nav.context.copyLogo": "Copiar logo como SVG",
2121
"nav.context.copyWordmark": "Copiar logotipo em SVG",
2222
"nav.context.brandAssets": "Kit da marca",
23-
"nav.subscription": "Assinatura",
2423
"footer.github": "GitHub",
2524
"footer.docs": "Docs",
2625
"footer.changelog": "Changelog",
@@ -32,7 +31,6 @@ export const dict = {
3231
"legal.englishOnly": "Este documento está disponível apenas em inglês.",
3332
"notFound.title": "Página não encontrada | OpenCode",
3433
"notFound.heading": "404 — Página não encontrada",
35-
"notFound.home": "Início",
3634
"notFound.docs": "Documentação",
3735
"notFound.github": "GitHub",
3836
"notFound.discord": "Discord",
@@ -43,13 +41,12 @@ export const dict = {
4341
"common.create": "Criar",
4442
"common.videoUnsupported": "Seu navegador não suporta a tag de vídeo.",
4543
"common.figure": "Fig {{n}}.",
46-
"common.faq": "FAQ",
44+
"common.faq": "Perguntas frequentes",
4745
"common.learnMore": "Saiba mais",
4846
"app.meta.description": "OpenCode - O agente de codificação de código aberto.",
4947
"home.title": "OpenCode | O agente de codificação de código aberto para qualquer modelo",
5048
"temp.title": "OpenCode | Agente de codificação feito para o terminal",
5149
"temp.hero.title": "O agente de codificação feito para o terminal",
52-
"temp.zen": "OpenCode Models",
5350
"temp.feature.models.beforeLink": "Compatível com mais de 200 provedores de LLM via",
5451
"home.banner.badge": "Novo",
5552
"home.promo.title": "Conheça as abas do Desktop",
@@ -204,7 +201,6 @@ export const dict = {
204201
"go.faq.a4.p2.accountLink": "conta",
205202
"go.faq.a4.p3": "Cancele a qualquer momento.",
206203
"go.faq.q5": "E quanto aos dados e à privacidade?",
207-
"go.faq.a5.model": "Modelo",
208204
"go.faq.a5.training": "Treinamento de modelos",
209205
"go.faq.a5.retention": "Retenção de dados",
210206
"go.faq.a5.retention30": "30 dias",
@@ -228,7 +224,6 @@ export const dict = {
228224
"go.faq.q9": "Qual a diferença entre os modelos grátis e o Go?",
229225
"go.faq.a9":
230226
"Os modelos grátis incluem Big Pickle e os modelos em promoção no momento. O Go oferece uma seleção de modelos com cotas de requisições mais altas em janelas móveis de 5 horas, uma semana e um mês, limitadas a 20%, 50% e 100% da cota mensal, respectivamente. A cota de uso pode variar por modelo. O número efetivo de requisições depende do modelo e do uso.",
231-
"workspace.nav.zen": "OpenCode Models",
232227
"workspace.newUser.feature.lockin.body":
233228
"Use OpenCode Models com qualquer agente de codificação e continue usando outros provedores com OpenCode quando quiser.",
234229
"download.title": "OpenCode | Baixe para macOS, Windows, Linux e celular",
Collapse file

‎services/site/src/i18n/check.ts‎

Copy file name to clipboardExpand all lines: services/site/src/i18n/check.ts
+55-13Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
// the page copy (src/i18n/content/<locale>.ts). Run it from services/site:
33
//
44
// bun src/i18n/check.ts [locale ...] [--stamp]
5+
// bun src/i18n/check.ts locale --stamp --keep-english=entry [--keep-english=entry ...]
56
//
67
// Errors (exit 1, and test/i18n.test.ts fails): a dictionary key the English doesn't have, and a
78
// translation whose {{params}}, [text](link) ids or `code` spans differ from the English.
89
// Warnings: entries still in English that were never reviewed, entries whose English changed since
910
// they were translated, and page copy the English no longer has (an item whose English title
1011
// changed, for example), which no page shows. A stamp (src/i18n/stamps/<locale>.json) records a hash of the English
11-
// each entry was translated from; --stamp records the current English for every translated entry,
12-
// so run it once everything the check lists is translated.
12+
// each entry was translated from; --stamp records the current English for every translated entry.
13+
// Use --keep-english=entry for each reviewed entry that should stay as written.
1314
import path from "node:path"
1415
import { dict as en } from "~/i18n/en"
1516
import { LOCALES, type Locale } from "~/lib/language"
@@ -24,32 +25,42 @@ type Report = {
2425
stale: string[]
2526
unused: string[]
2627
stamps: Record<string, string>
28+
review: Record<string, string>
2729
}
2830

2931
const stampDir = path.join(import.meta.dir, "stamps")
3032

33+
type Entry = { id: string; english: string; value?: string; inherited?: boolean }
34+
3135
/** Every check for one locale. `stamps` is what --stamp would write. */
3236
export async function checkLocale(locale: Exclude<Locale, "en">): Promise<Report> {
3337
const dict: Record<string, string> = (await import(`./${locale}.ts`)).dict
3438
const content: unknown = (await import(`./content/${locale}.ts`)).content
3539
const file = Bun.file(path.join(stampDir, `${locale}.json`))
3640
const stamps: Record<string, string> = (await file.exists()) ? await file.json() : {}
37-
const report: Report = { locale, errors: [], untranslated: [], stale: [], unused: [], stamps: {} }
41+
const report: Report = { locale, errors: [], untranslated: [], stale: [], unused: [], stamps: {}, review: {} }
3842

3943
const english = en as Record<string, string>
4044
Object.keys(dict)
4145
.filter((key) => !(key in english))
4246
.forEach((key) => report.errors.push(`${key}: not in the English dictionary`))
43-
const entries = [
47+
const englishContent = contentSource((key, params) => interpolate(english[key], params))
48+
const localizedContent = contentSource((key, params) => interpolate(dict[key] || english[key], params))
49+
const entries: Entry[] = [
4450
...Object.keys(english).map((key) => ({ id: key, english: english[key], value: dict[key] })),
45-
...contentEntries(contentSource((key, params) => interpolate(english[key], params)), content, "", report.unused).map((entry) => ({ ...entry, id: `content:${entry.id}` })),
51+
...contentEntries(englishContent, localizedContent, content, "", report.unused),
4652
]
4753
for (const entry of entries) {
54+
// A translation inherited from the dictionary is already tracked under its dictionary key.
55+
if (entry.inherited) continue
4856
const hash = Bun.hash(entry.english).toString(36)
4957
const translated = entry.value !== undefined && entry.value !== "" && entry.value !== entry.english
5058
if (translated) report.errors.push(...mismatches(entry.id, entry.english, entry.value!))
5159
if (translated || stamps[entry.id]) report.stamps[entry.id] = translated ? hash : stamps[entry.id]
52-
if (!translated && !stamps[entry.id]) report.untranslated.push(entry.id)
60+
if (!translated && !stamps[entry.id]) {
61+
report.untranslated.push(entry.id)
62+
report.review[entry.id] = hash
63+
}
5364
if (stamps[entry.id] && stamps[entry.id] !== hash) report.stale.push(entry.id)
5465
}
5566
return report
@@ -77,28 +88,42 @@ function mismatches(id: string, english: string, value: string) {
7788
* path content/index.ts merges on (keyed list items by item id). Entries the English doesn't have go
7889
* to `unused`.
7990
*/
80-
function contentEntries(base: unknown, overlay: unknown, at: string, unused: string[]): { id: string; english: string; value?: string }[] {
91+
function contentEntries(base: unknown, localized: unknown, overlay: unknown, at: string, unused: string[]): Entry[] {
8192
if (typeof base === "string") {
8293
if (structuralPaths.some((pattern) => matches(pattern, at))) return []
83-
return [{ id: at, english: base, value: typeof overlay === "string" ? overlay : undefined }]
94+
const value = typeof overlay === "string" && overlay ? overlay : undefined
95+
return [
96+
{
97+
id: `content:${at}`,
98+
english: base,
99+
value,
100+
inherited: value === undefined && typeof localized === "string" && localized !== base,
101+
},
102+
]
84103
}
85104
const join = (key: string) => (at ? `${at}.${key}` : key)
86105
if (Array.isArray(base)) {
87106
const list: readonly unknown[] = base
107+
const translated: readonly unknown[] = Array.isArray(localized) ? localized : []
88108
if (keyedList(list)) {
89109
const ids = itemIds(list)
90110
const items = (isRecord(overlay) ? overlay : {}) as Record<string, unknown>
91111
Object.keys(items)
92112
.filter((id) => !ids.includes(id))
93113
.forEach((id) => unused.push(`content:${join(id)}`))
94-
return list.flatMap((item, index) => contentEntries(item, items[ids[index]], join(ids[index]), unused))
114+
return list.flatMap((item, index) =>
115+
contentEntries(item, translated[index], items[ids[index]], join(ids[index]), unused),
116+
)
95117
}
96118
const items = Array.isArray(overlay) ? overlay : []
97119
items.slice(list.length).forEach((_, index) => unused.push(`content:${join(String(list.length + index))}`))
98-
return list.flatMap((item, index) => contentEntries(item, items[index], join(String(index)), unused))
120+
return list.flatMap((item, index) =>
121+
contentEntries(item, translated[index], items[index], join(String(index)), unused),
122+
)
99123
}
100124
if (!isRecord(base)) return []
101125
const values = (isRecord(overlay) ? overlay : {}) as Record<string, unknown>
126+
const translated = isRecord(localized) ? localized : {}
102127
const fields = Object.keys(base).filter(
103128
(key) =>
104129
!(structural as readonly string[]).includes(key) &&
@@ -107,7 +132,7 @@ function contentEntries(base: unknown, overlay: unknown, at: string, unused: str
107132
Object.keys(values)
108133
.filter((key) => !fields.includes(key))
109134
.forEach((key) => unused.push(`content:${join(key)}`))
110-
return fields.flatMap((key) => contentEntries(base[key], values[key], join(key), unused))
135+
return fields.flatMap((key) => contentEntries(base[key], translated[key], values[key], join(key), unused))
111136
}
112137

113138
function isRecord(value: unknown): value is Record<string, unknown> {
@@ -123,14 +148,26 @@ function matches(pattern: string, at: string) {
123148
if (import.meta.main) {
124149
const args = process.argv.slice(2)
125150
const stamp = args.includes("--stamp")
151+
const keepEnglish = args
152+
.filter((arg) => arg.startsWith("--keep-english="))
153+
.map((arg) => arg.slice("--keep-english=".length))
126154
const asked = args.filter((arg) => !arg.startsWith("--"))
155+
if (keepEnglish.length && (!stamp || asked.length !== 1)) {
156+
console.error("--keep-english requires --stamp and exactly one locale")
157+
process.exit(2)
158+
}
127159
const unknown = asked.filter((arg) => !(LOCALES as readonly string[]).includes(arg) || arg === "en")
128160
if (unknown.length) {
129161
console.error(`unknown locale ${unknown.join(", ")}; use one of ${LOCALES.slice(1).join(" ")}`)
130162
process.exit(2)
131163
}
132164
const locales = (asked.length ? asked : LOCALES.slice(1)) as Exclude<Locale, "en">[]
133165
const reports = await Promise.all(locales.map(checkLocale))
166+
const invalid = keepEnglish.filter((id) => !Object.hasOwn(reports[0].review, id))
167+
if (invalid.length) {
168+
console.error(`not awaiting English review: ${invalid.join(", ")}`)
169+
process.exit(2)
170+
}
134171
for (const report of reports) {
135172
console.log(
136173
`${report.locale}: ${report.errors.length} errors, ${report.untranslated.length} untranslated, ${report.stale.length} changed in English, ${report.unused.length} unused`,
@@ -141,8 +178,13 @@ if (import.meta.main) {
141178
report.stale.forEach((id) => console.log(` todo ${id} (English changed)`))
142179
report.unused.forEach((id) => console.log(` unused ${id} (no English to translate)`))
143180
}
144-
if (stamp && !report.errors.length)
145-
await Bun.write(path.join(stampDir, `${report.locale}.json`), `${JSON.stringify(sortKeys(report.stamps), null, 2)}\n`)
181+
if (stamp && !report.errors.length) {
182+
keepEnglish.forEach((id) => (report.stamps[id] = report.review[id]))
183+
await Bun.write(
184+
path.join(stampDir, `${report.locale}.json`),
185+
`${JSON.stringify(sortKeys(report.stamps), null, 2)}\n`,
186+
)
187+
}
146188
}
147189
if (reports.some((report) => report.errors.length)) process.exit(1)
148190
}
Collapse file

‎services/site/src/i18n/da.ts‎

Copy file name to clipboardExpand all lines: services/site/src/i18n/da.ts
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const dict = {
3131
"legal.englishOnly": "Dette dokument findes kun på engelsk.",
3232
"notFound.title": "Siden blev ikke fundet | OpenCode",
3333
"notFound.heading": "404 – Siden blev ikke fundet",
34-
"notFound.home": "Hjem",
3534
"notFound.docs": "Dokumentation",
3635
"notFound.github": "GitHub",
3736
"notFound.discord": "Discord",
@@ -48,7 +47,6 @@ export const dict = {
4847
"home.title": "OpenCode | Open source-kodningsagenten til alle modeller",
4948
"temp.title": "opencode | Kodningsagent bygget til terminalen",
5049
"temp.hero.title": "Kodningsagenten til terminalen",
51-
"temp.zen": "OpenCode Models",
5250
"temp.feature.models.beforeLink": "Understøtter 200+ LLM-udbydere gennem",
5351
"home.banner.badge": "Ny",
5452
"home.promo.title": "Nye faner i Desktop",
@@ -202,7 +200,6 @@ export const dict = {
202200
"go.faq.a4.p2.accountLink": "konto",
203201
"go.faq.a4.p3": "Opsig når som helst.",
204202
"go.faq.q5": "Hvad med data og privatliv?",
205-
"go.faq.a5.model": "Model",
206203
"go.faq.a5.training": "Modeltræning",
207204
"go.faq.a5.retention": "Dataopbevaring",
208205
"go.faq.a5.retention30": "30 dage",
@@ -225,7 +222,6 @@ export const dict = {
225222
"go.faq.q9": "Hvad er forskellen på gratis modeller og Go?",
226223
"go.faq.a9":
227224
"De gratis modeller omfatter Big Pickle og de kampagnemodeller, der er tilgængelige lige nu. Go tilbyder udvalgte modeller med højere anmodningskvoter i rullende perioder: 20 % af månedskvoten pr. 5 timer, 50 % pr. uge og 100 % pr. måned. Kvoterne kan variere fra model til model. Det faktiske antal anmodninger afhænger af model og forbrug.",
228-
"workspace.nav.zen": "OpenCode Models",
229225
"workspace.newUser.feature.lockin.body":
230226
"Brug OpenCode Models med din foretrukne kodningsagent, og brug stadig andre udbydere i OpenCode, når du vil.",
231227
"download.title": "OpenCode | Download til macOS, Windows, Linux og mobil",
@@ -518,7 +514,7 @@ export const dict = {
518514
"OpenCode er en open source-agent, der hjælper dig med at skrive og køre kode med enhver AI-model. Den findes som desktopapp, terminalbrugerflade, mobilapp og SDK.",
519515
"home.faq.a5.body":
520516
"Nej. OpenCode findes også som [desktopapp](desktop) og [mobilapp](mobile), og med [SDK'et](sdk) kan du styre det fra din egen kode.",
521-
"brand.ui.downloadLabel": "Download {{label}}",
517+
"brand.ui.downloadLabel": "Hent {{label}}",
522518
"brand.ui.downloadItem": "Download {{label}} til {{detail}}",
523519
"brand.ui.moreFormats": "Flere formater af {{detail}}",
524520
"brand.ui.badgeSize": "Badgestørrelse",
@@ -718,7 +714,7 @@ export const dict = {
718714
"enterprise.form.inferenceSpend.label": "Hvad bruger din virksomhed på inferens om måneden (USD)?",
719715
"enterprise.form.inferenceSpend.placeholder": "Vælg et interval (valgfrit)",
720716
"enterprise.form.inferenceSpend.none": "Intet forbrug endnu",
721-
"enterprise.form.inferenceSpend.under1k": "Under $1K",
717+
"enterprise.form.inferenceSpend.under1k": "Under 1.000 USD",
722718
"enterprise.form.inferenceSpend.1kTo10k": "$1K–$10K",
723719
"enterprise.form.inferenceSpend.10kTo50k": "$10K–$50K",
724720
"enterprise.form.inferenceSpend.50kTo100k": "$50K–$100K",
@@ -728,5 +724,4 @@ export const dict = {
728724
"home.openSource.avatarProfile": "{{login}} på GitHub",
729725
"home.install.or": "eller",
730726
"brand.ui.actionOf": "{{label}} af {{detail}}",
731-
"nav.subscription": "Abonnement",
732727
} satisfies Dict

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.