Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(ui): Zahlen sprechen die Sprache der Oberflaeche, nicht die des Rechners

purple8d6f348572c9
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 1e6a779e..b7a1ebc1 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -9,6 +9,7 @@ import { waitForModelsVisible } from "../lib/bundle-install"
import type { DownloadProgress } from "../types/downloads"
import { asNumber, asRecordArray, asString, isRecord, prop, propPath } from "../types/json-guards"
import type { DiscoverModel, ModelBundle } from "./model-bundles"
+import { formatCount } from '../lib/formatters'
import {
CUSTOM_NODE_REGISTRY,
getImageBundles, getVideoBundles, getAudioBundles, getLipsyncBundles, getMotionBundles,
@@ -1902,7 +1903,7 @@ export async function searchCivitaiModels(
const descParts: string[] = []
const rawDesc = (asString(prop(item, 'description')) ?? '').replace(/<[^>]*>/g, '').trim()
if (rawDesc) descParts.push(rawDesc.slice(0, 120))
- if (downloadCount) descParts.push(`${downloadCount.toLocaleString()} downloads`)
+ if (downloadCount) descParts.push(`${formatCount(downloadCount)} downloads`)
if (creator) descParts.push(`by ${creator}`)
return {
diff --git a/src/api/workflows.ts b/src/api/workflows.ts
index 636d672b..002df9b6 100644
--- a/src/api/workflows.ts
+++ b/src/api/workflows.ts
@@ -20,6 +20,7 @@ import {
inputNumber, linkTarget,
} from '../types/comfy-graph'
import { prop } from '../types/json-guards'
+import { formatCount } from '../lib/formatters'
// ─── Validation ───
//
@@ -739,8 +740,8 @@ export async function searchCivitai(query: string, host: string = 'civitai.com')
if (rawDesc) descParts.push(rawDesc.slice(0, 150))
if (item.stats) {
const stats: string[] = []
- if (item.stats.downloadCount) stats.push(`${item.stats.downloadCount.toLocaleString()} Downloads`)
- if (item.stats.thumbsUpCount) stats.push(`${item.stats.thumbsUpCount.toLocaleString()} Likes`)
+ if (item.stats.downloadCount) stats.push(`${formatCount(item.stats.downloadCount)} Downloads`)
+ if (item.stats.thumbsUpCount) stats.push(`${formatCount(item.stats.thumbsUpCount)} Likes`)
if (stats.length > 0) descParts.push(stats.join(' | '))
}
if (item.creator?.username) descParts.push(`by ${item.creator.username}`)
diff --git a/src/components/auth/AccountPanel.tsx b/src/components/auth/AccountPanel.tsx
index 57d2834e..62238f9b 100644
--- a/src/components/auth/AccountPanel.tsx
+++ b/src/components/auth/AccountPanel.tsx
@@ -12,6 +12,7 @@ import { loginWithProvider } from '../../api/cloud/supabase'
import { CLOUD_BASE } from '../../api/cloud/config'
import { MONOGRAM } from '../layout/brand'
import { openExternal } from '../../api/backend'
+import { formatCount } from '../../lib/formatters'
/**
* Run a sign-out and report what happened, in that order.
@@ -45,7 +46,7 @@ function Meter({ label, used, limit }: { label: string; used: number; limit: num
<div className="flex items-center justify-between text-[0.65rem]">
<span className="text-gray-600 dark:text-gray-400">{label}</span>
<span className="text-gray-500 dark:text-gray-500 tabular-nums">
- {used.toLocaleString()} / {limit.toLocaleString()}
+ {formatCount(used)} / {formatCount(limit)}
</span>
</div>
<div className="h-1 rounded-full bg-gray-200 dark:bg-white/10 overflow-hidden">
diff --git a/src/components/chat/FilePreview.tsx b/src/components/chat/FilePreview.tsx
index 41963251..7096cc03 100644
--- a/src/components/chat/FilePreview.tsx
+++ b/src/components/chat/FilePreview.tsx
@@ -32,6 +32,7 @@ import {
previewLanguageFor,
} from '../../lib/file-preview'
import { isWithinRoot, type ExplorerNode } from '../../lib/explorer-tree'
+import { formatCount } from '../../lib/formatters'
interface Props {
node: ExplorerNode
@@ -175,7 +176,7 @@ export function FilePreview({ node, root, onClose }: Props) {
{state.status === 'binary' && (
<p className="px-2 py-2 text-[0.55rem] text-gray-400 dark:text-gray-600">
- Binary file{state.bytes ? `, ${state.bytes.toLocaleString()} bytes` : ''}. Not previewed.
+ Binary file{state.bytes ? `, ${formatCount(state.bytes)} bytes` : ''}. Not previewed.
</p>
)}
diff --git a/src/components/chat/TokenCounter.tsx b/src/components/chat/TokenCounter.tsx
index 7f6c22eb..dfc6b8eb 100644
--- a/src/components/chat/TokenCounter.tsx
+++ b/src/components/chat/TokenCounter.tsx
@@ -5,6 +5,7 @@ import { useSendSizeStore } from '../../stores/sendSizeStore'
import { useSettingsStore } from '../../stores/settingsStore'
import { shouldAutoCompact, autoCompactHint } from '../../lib/compact-trigger'
import { newestCompaction, isModelVisible } from '../../lib/run-compact-command'
+import { formatCount } from '../../lib/formatters'
export function TokenCounter() {
const activeConversationId = useChatStore((s) => s.activeConversationId)
@@ -82,13 +83,13 @@ export function TokenCounter() {
: 'model context'
const capped = ctx.sendWindow > 0 && ctx.contextWindow > ctx.sendWindow
const capNote = capped
- ? `. Capped: a step sends at most ${maxTokens.toLocaleString()} of this model's ${ctx.contextWindow.toLocaleString()} tokens (Settings, send window), and tool results older than the newest step go out shortened`
+ ? `. Capped: a step sends at most ${formatCount(maxTokens)} of this model's ${formatCount(ctx.contextWindow)} tokens (Settings, send window), and tool results older than the newest step go out shortened`
: ''
const title = fill.source === 'built'
- ? `Last request: ${usedTokens.toLocaleString()} / ${maxTokens.toLocaleString()} tokens, the size of the payload actually built for the last step, tool catalog, decay and compaction included${capNote}`
+ ? `Last request: ${formatCount(usedTokens)} / ${formatCount(maxTokens)} tokens, the size of the payload actually built for the last step, tool catalog, decay and compaction included${capNote}`
: isReal
- ? `Context: ${usedTokens.toLocaleString()} / ${maxTokens.toLocaleString()} tokens (${source}), anchored on the model's last reported usage (includes system prompt + tools + RAG); reasoning tokens are not context and aren't counted${capNote}`
- : `Estimated: ${usedTokens.toLocaleString()} / ${maxTokens.toLocaleString()} tokens (${source}), estimate until the model reports real usage${capNote}`
+ ? `Context: ${formatCount(usedTokens)} / ${formatCount(maxTokens)} tokens (${source}), anchored on the model's last reported usage (includes system prompt + tools + RAG); reasoning tokens are not context and aren't counted${capNote}`
+ : `Estimated: ${formatCount(usedTokens)} / ${formatCount(maxTokens)} tokens (${source}), estimate until the model reports real usage${capNote}`
// ── Wie weit ist es noch bis zur automatischen Kompaktierung ────────────
//
diff --git a/src/components/settings/BuiltinEngineSettings.tsx b/src/components/settings/BuiltinEngineSettings.tsx
index 69c96f11..0e2900e6 100644
--- a/src/components/settings/BuiltinEngineSettings.tsx
+++ b/src/components/settings/BuiltinEngineSettings.tsx
@@ -12,6 +12,7 @@ import { bundledEngineStatus, swapBundledModel, ENGINE_PORT, type EngineStatus }
import { enginePortLine } from '../../lib/engine-port'
import { isTauri } from '../../api/backend'
import type { BuiltinEngineTuning } from '../../types/settings'
+import { formatCount } from '../../lib/formatters'
type KvType = BuiltinEngineTuning['cacheTypeK']
@@ -142,7 +143,7 @@ export function BuiltinEngineSettings() {
{running ? (
<>
Engine running{loadedModel ? <> · <span className="text-gray-300">{loadedModel}</span></> : null}
- {typeof status?.ctx === 'number' ? <> · ctx {status.ctx.toLocaleString()}</> : null}
+ {typeof status?.ctx === 'number' ? <> · ctx {formatCount(status.ctx)}</> : null}
</>
) : (
'Engine not running, settings apply automatically on the next start.'
diff --git a/src/lib/__tests__/zahlen-sprechen-englisch.test.ts b/src/lib/__tests__/zahlen-sprechen-englisch.test.ts
new file mode 100644
index 00000000..e7c268a3
--- /dev/null
+++ b/src/lib/__tests__/zahlen-sprechen-englisch.test.ts
@@ -0,0 +1,70 @@
+/**
+ * Zahlen in der Oberflaeche folgen der Sprache der Oberflaeche, nicht der des
+ * Betriebssystems.
+ *
+ * Persona P2, 04.09.2026, auf der deutschen Windows-Box: die Statuszeile der
+ * Engine lautete "Engine running · Phi-4-mini-instruct-Q4_K_M · ctx 8.192".
+ * Gemeint sind 8192 Token. In einer englischen Oberflaeche liest sich "8.192"
+ * als eine Zahl kleiner als neun, und zwei Zeilen tiefer stand dieselbe Zahl
+ * im Eingabefeld richtig als 8192. Auch die CivitAI-Treffer waren betroffen,
+ * "9.766 downloads" und "14.143 downloads".
+ *
+ * Hausregel: keine lokalisierten Systemtexte durchreichen.
+ *
+ * Run: npx vitest run src/lib/__tests__/zahlen-sprechen-englisch.test.ts
+ */
+import { describe, it, expect } from 'vitest'
+import { readdirSync, readFileSync, statSync } from 'node:fs'
+import { resolve, join } from 'node:path'
+import { formatCount } from '../formatters'
+
+describe('formatCount', () => {
+ it('trennt Tausender mit Komma, egal welche Sprache der Rechner spricht', () => {
+ expect(formatCount(8192)).toBe('8,192')
+ expect(formatCount(9766)).toBe('9,766')
+ expect(formatCount(14143)).toBe('14,143')
+ })
+
+ it('kleine Zahlen bleiben, wie sie sind', () => {
+ expect(formatCount(0)).toBe('0')
+ expect(formatCount(999)).toBe('999')
+ })
+
+ // Negativkontrolle: genau das war der Fehler. Auf einer deutschen Maschine
+ // liefert die sprachlose Fassung "8.192".
+ it('die sprachlose Fassung waere von der Maschine abhaengig', () => {
+ expect((8192).toLocaleString('de-DE')).toBe('8.192')
+ expect(formatCount(8192)).not.toBe((8192).toLocaleString('de-DE'))
+ })
+})
+
+describe('niemand ruft mehr die sprachlose Fassung', () => {
+ const wurzel = resolve(__dirname, '..', '..')
+
+ const dateien = (dir: string): string[] => {
+ const out: string[] = []
+ for (const e of readdirSync(dir)) {
+ const p = join(dir, e)
+ if (statSync(p).isDirectory()) {
+ if (e === '__tests__' || e === 'node_modules') continue
+ out.push(...dateien(p))
+ } else if (/\.tsx?$/.test(e)) out.push(p)
+ }
+ return out
+ }
+
+ it('kein toLocaleString() ohne Sprache auf einer Zahl', () => {
+ const suender: string[] = []
+ for (const f of dateien(wurzel)) {
+ const text = readFileSync(f, 'utf8')
+ for (const [i, zeile] of text.split('\n').entries()) {
+ // Datumsangaben bleiben ausgenommen: ein Datum ist keine Zahl, die
+ // sich beim Lesen um drei Zehnerpotenzen vertut.
+ if (/\.toLocaleString\(\)/.test(zeile) && !/Date\(/.test(zeile)) {
+ suender.push(`${f.slice(wurzel.length + 1)}:${i + 1}`)
+ }
+ }
+ }
+ expect(suender).toEqual([])
+ })
+})
diff --git a/src/lib/agent-tasks.ts b/src/lib/agent-tasks.ts
index 4a058d3e..829a568e 100644
--- a/src/lib/agent-tasks.ts
+++ b/src/lib/agent-tasks.ts
@@ -14,6 +14,7 @@
*/
import { truncateToolResult } from './truncate-tool-result'
+import { formatCount } from './formatters'
/**
* Wie viele Aufgaben eine Konversation behält.
@@ -184,7 +185,7 @@ export function describeTaskTokens(t: TaskTokens | undefined): string {
const kopf = t.estimated
? 'Estimated tokens for this delegation'
: 'Tokens for this delegation, as reported by the model'
- return `${kopf}: ${t.prompt.toLocaleString()} in, ${t.completion.toLocaleString()} out, summed over every step of the run`
+ return `${kopf}: ${formatCount(t.prompt)} in, ${formatCount(t.completion)} out, summed over every step of the run`
}
/** Endzustände. Nur diese dürfen aus dem Ring fallen. */
diff --git a/src/lib/formatters.ts b/src/lib/formatters.ts
index d93dae4c..f9158bea 100644
--- a/src/lib/formatters.ts
+++ b/src/lib/formatters.ts
@@ -1,3 +1,22 @@
+/**
+ * Eine Zahl mit Tausendertrennern fuer die Oberflaeche.
+ *
+ * Mit fester Sprache, nicht mit der des Betriebssystems. Persona P2 hat am
+ * 04.09.2026 auf der deutschen Windows-Box gemessen, was `toLocaleString()`
+ * ohne Sprache anrichtet: die Statuszeile der Engine lautete
+ * "Engine running · Phi-4-mini-instruct-Q4_K_M · ctx 8.192". Gemeint sind
+ * 8192 Token, in einer englischen Oberflaeche liest sich "8.192" als eine
+ * Zahl kleiner als neun. Dieselbe Zahl stand zwei Zeilen tiefer im
+ * Eingabefeld richtig als 8192. Auch "9.766 downloads" in den
+ * CivitAI-Treffern war betroffen.
+ *
+ * Die Oberflaeche dieser Anwendung ist Englisch, also sind es ihre Zahlen
+ * auch. Hausregel: keine lokalisierten Systemtexte durchreichen.
+ */
+export function formatCount(n: number): string {
+ return n.toLocaleString('en-US')
+}
+
export function formatBytes(bytes: number): string {
if (bytes === 0) return '0 B'
const k = 1024
diff --git a/src/lib/run-compact-command.ts b/src/lib/run-compact-command.ts
index 41093a09..8ef8a853 100644
--- a/src/lib/run-compact-command.ts
+++ b/src/lib/run-compact-command.ts
@@ -41,6 +41,7 @@ import { shouldAutoCompact, MIN_MESSAGES_SINCE_COMPACT } from './compact-trigger
import { effectiveSendWindow } from './send-window'
import { useSendSizeStore } from '../stores/sendSizeStore'
import type { CompactionRecord, Message } from '../types/chat'
+import { formatCount } from './formatters'
/**
* How many of the newest messages stay verbatim behind a summary.
@@ -160,7 +161,7 @@ export function compactOutcomeMessage(outcome: CompactOutcome): string {
if (outcome.ok) {
const { replaced, tokensBefore, tokensAfter } = outcome.record
const saved = Math.max(0, tokensBefore - tokensAfter)
- return `Summarised ${replaced} earlier message${replaced === 1 ? '' : 's'} — about ${saved.toLocaleString()} tokens less in every following request. The full conversation is still here; only what gets sent changed.`
+ return `Summarised ${replaced} earlier message${replaced === 1 ? '' : 's'}, about ${formatCount(saved)} tokens less in every following request. The full conversation is still here; only what gets sent changed.`
}
switch (outcome.reason) {
case 'nothing-to-compact':