mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 10:43:47 +00:00
The desktop app and the macOS menu bar can now run in English, French, Japanese, Korean, Simplified Chinese and Traditional Chinese. A Language setting in the desktop Settings picks the language or follows the system, and the choice is shared so the menu bar switches with it, relaunching to pick up the language with a retry so a switch never leaves it down. Every user-facing string in the desktop renderer goes through a local lookup table, 1,249 keys per language, no framework and no network. The menu bar gains four .lproj to join English and Simplified Chinese, 626 keys each. A completeness gate fails the build if any language is missing a key, in both the desktop catalogs and the menu bar coverage suite. Fonts fall back per language so Japanese, Korean and both Chinese render their correct glyph forms, and dates and numbers format for the locale with values unchanged. English output is byte-identical. Strings produced by the CLI engine stay English until the CLI is localized, a separate effort. Validated live in all six languages: no missing text, no clipping, correct fonts, numbers unchanged, and the menu bar switching for every language.
41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
import { useState } from 'react'
|
|
|
|
import { t } from '../i18n'
|
|
import { updateDownloadUrl, useUpdateStatus } from '../hooks/useUpdateStatus'
|
|
import { codeburn } from '../lib/ipc'
|
|
|
|
const DISMISS_KEY = 'codeburn.updateDismissed'
|
|
|
|
function readDismissed(): string | null {
|
|
try { return globalThis.localStorage?.getItem(DISMISS_KEY) ?? null } catch { return null }
|
|
}
|
|
|
|
/**
|
|
* Subtle, dismissible "update available" nudge, in the budget-banner visual
|
|
* language. Dismiss persists per release tag (codeburn.updateDismissed), so the
|
|
* same version never nags twice but the next release shows fresh. Download opens
|
|
* the release page via the https-only openExternal bridge. Never auto-installs.
|
|
*/
|
|
export function UpdateBanner() {
|
|
const status = useUpdateStatus()
|
|
const [dismissedTag, setDismissedTag] = useState<string | null>(readDismissed)
|
|
|
|
if (!status || !status.updateAvailable || !status.tag) return null
|
|
if (dismissedTag === status.tag) return null
|
|
|
|
const tag = status.tag
|
|
const dismiss = () => {
|
|
try { globalThis.localStorage?.setItem(DISMISS_KEY, tag) } catch { /* storage can be unavailable */ }
|
|
setDismissedTag(tag)
|
|
}
|
|
|
|
return (
|
|
<div role="status" className="update-banner">
|
|
<span>
|
|
{t('shell.update.available', { version: status.latestVersion ?? '' })}{' '}
|
|
<button type="button" className="set-text-button" onClick={() => { void codeburn.openExternal(updateDownloadUrl(tag)) }}>{t('shell.action.download')}</button>
|
|
</span>
|
|
<button type="button" className="set-text-button" onClick={dismiss}>{t('shell.action.dismiss')}</button>
|
|
</div>
|
|
)
|
|
}
|