Skip to content

Add Turkish (tr) UI translation - #1

Merged
celaldrg merged 1 commit into
masterfrom
feat/turkish-ui
Nov 12, 2026
Merged

celaldrg merged 1 commit into
masterfrom
feat/turkish-ui

Conversation

@celaldrg

Copy link
Copy Markdown
Owner

Summary

Adds a Turkish (tr) locale for the GUI and a Turkish macOS privilege prompt, following lib/gui/app/i18n/README.md.

  • lib/gui/app/i18n/tr.ts (new): full translation of en.ts with the same keys (122/122, same order), the same {{...}} placeholders and the same HTML links. Product names ("Etcher", "balenaEtcher", "Etcher Pro", Rufus, WoeUSB) are not translated.
  • lib/gui/app/i18n.ts: imports the Turkish resources, registers them as tr and adds 'tr' to supportedLocales.
  • lib/shared/sudo/sudo-askpass.osascript-tr.js (new): Turkish macOS sudo prompt. The file name is what lib/shared/sudo/darwin.ts builds (sudo-askpass.osascript-${lang}.js); mode 100755 like the en/zh scripts.
  • forge.config.ts: adds the Turkish prompt to packagerConfig.extraResource next to the en/zh scripts. In development, darwin.ts resolves the script with require.resolve and a template string, so webpack's context module already includes the new file.

Type safety

tr.ts ends with satisfies typeof en (type-only import of en.ts). tsc rejects missing, extra and misspelled keys, including nested keys and plural variants. The existing CI step npx tsc -p tsconfig.i18n.json covers it because i18n.ts imports tr.ts. ts-loader erases both import type and satisfies, so runtime output is unchanged. The zh-CN and zh-TW files are not touched.

Terminology

  • flash: "yaz" (write), e.g. "Yaz!", "Dosyadan yaz", "URL'den yaz", "Yazılıyor..."
  • image: "disk görüntüsü" (the term used in Windows and GNOME Turkish UIs; "görüntü" alone is ambiguous)
  • drive "sürücü", target "hedef", source "kaynak", validate "doğrula", partition table "bölüm tablosu", bootable "önyüklenebilir", port "bağlantı noktası", unallocated "ayrılmamış"
  • decompressing: "Ayıklanıyor..." (Windows' term for extracting archives, short enough for the 200 px progress row)
  • Turkish uses the singular after numerals, so _one and _other share the same text ("3 hedef"). Intl.PluralRules('tr') has the categories one/other, so the keys match en.
  • Composite messages: toDrive and toTarget are dative phrases ("... sürücüsüne", "3 hedefe"), so they read correctly in both succeedTo and flashError. Turkish puts the verb last, so andFailTarget is a parenthetical: "ubuntu.img, 2 hedefe (1 hedefe yazılamadı) başarıyla yazıldı".
  • No suffix is attached to a placeholder. Suffixes on product names follow pronunciation (Etcher'ı, Etcher'dan, balena.io'ya).
  • macOS menu items follow macOS Turkish wording ("Etcher'ı Gizle", "Diğerlerini Gizle", "Tümünü Göster", "Etcher'dan Çık"). The sudo prompt uses the macOS button names "Vazgeç" and "Tamam" and the system phrase "Buna izin vermek için parolanızı girin."
  • Safety texts (system drive, large drive, closing while flashing, validation failure) keep the English meaning sentence by sentence.
  • drives.openInBrowser: the English string contains literal backticks; they are not carried over (zh-CN and zh-TW drop them too).

How it was tested

Locally on Windows 11, Node 24.16.0, in a clean worktree after npm ci --ignore-scripts:

  • npx balena-lint --typescript typings lib tests forge.config.ts forge.sidecar.ts forge.pkg-node.ts webpack.config.ts without --fix: passes with no findings.
  • npx prettier --check "lib/**/*.css", plus npx prettier --check on the changed TypeScript files: pass.
  • npx tsc -p tsconfig.i18n.json: passes.
  • satisfies check: five broken copies of tr.ts (missing key, extra nested key, extra top-level key, misspelled key, missing plural variant) each fail tsc (TS2741, TS2353, TS2561); the unmodified copy passes.
  • Key parity script (en vs tr): 122/122 keys in the same order, identical placeholder sets, identical <a> tags, identical line-break counts, product names present, no string left in English except "Etcher Pro".
  • Runtime check: the real lib/gui/app/i18n.ts and lib/shared/messages.ts loaded through ts-node with a mocked system locale and LANG unset.
    • tr-TR and tr: langParser() returns tr, i18next.language and resolvedLanguage are tr, and the darwin.ts logic picks sudo-askpass.osascript-tr.js.
    • en-US gives English and the en prompt; zh-CN gives zh-CN and the zh prompt (unchanged).
    • Sample output: "ubuntu.img, SanDisk Ultra (/dev/sdb) sürücüsüne başarıyla yazıldı", "ubuntu.img, 2 hedefe yazılırken bir sorun oluştu.", "Seçilen kaynak bu sürücüden 1 GB daha büyük."

Not verified

  • Visual check in the running app (text length and wrapping in buttons, the progress row and modals). The app was not started, built or packaged.
  • The macOS sudo prompt on a real Mac, and that a packaged app contains the new extra resource.
  • Native notifications and Electron menus on each OS.

Observed, not changed (out of scope)

  • langParser() returns en whenever LANG is set (a workaround for mocha). Linux desktop sessions usually set LANG, so Linux users likely get English whatever their locale (checked with LANG=tr_TR.UTF-8).
  • flash-results.tsx calls i18next.t('failedTarget') and i18next.t('failedRetry'), but these keys live under flash., so the raw key names are shown in every language.
  • Hard-coded English: notification titles in Flash.tsx ("Flash complete!", "Oops! Looks like the flash failed."), the "found" count in the drive selector title, and the ETA units from formatSeconds ("1m5s").
  • lib/gui/app/i18n/README.md still points to lib/shared/catalina-sudo/ and does not mention supportedLocales or the extraResource list.
  • zh-CN.ts lacks settings.trimExtPartitions, so that setting falls back to English.
  • The progress "Skip"/"Cancel" label is passed to imageWriter.cancel(), but the child process routes only on the message type (cancel), so translating the label does not change behaviour.

🤖 Generated with Claude Code

Add a Turkish (tr) locale for the GUI and the macOS privilege prompt.

- lib/gui/app/i18n/tr.ts: full translation of en.ts with the same keys,
  placeholders and HTML links. The object is checked with
  `satisfies typeof en`, so tsc (tsconfig.i18n.json, run in CI) reports
  missing, extra or misspelled keys.
- lib/gui/app/i18n.ts: register the tr resources and add 'tr' to
  supportedLocales, which selects the macOS sudo prompt script.
- lib/shared/sudo/sudo-askpass.osascript-tr.js: Turkish password
  prompt, executable like the en and zh scripts.
- forge.config.ts: ship the new prompt as an extra resource.
@celaldrg
celaldrg force-pushed the feat/turkish-ui branch 2 times, most recently from 8ff7981 to bb2687a Compare October 29, 2026 08:26
@celaldrg
celaldrg merged commit 0bf1733 into master Nov 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant