fix(i18n): use streamChars i18n key for streaming progress counter

Replaces hardcoded '${count} chars' in renderStreamingPreview with
plugin.t('streamChars', {count}) supporting both languages.

https://claude.ai/code/session_012cK5rUGQvqkuxUZ59x7dLn
This commit is contained in:
Claude 2026-04-29 08:17:15 +00:00
parent 18e156a9af
commit 06a416569a
No known key found for this signature in database
2 changed files with 7 additions and 2 deletions

View file

@ -27,6 +27,7 @@ export const STRINGS: Record<string, Record<string, string>> = {
staleBanner: '源笔记或生成配置已修改,当前是旧缓存。',
loadingDefault: '正在生成对照笔记...',
loadingGenerating: '对照阅读:让 LLM 读全文并自适应切段...',
streamChars: '{count} 字',
loadingSubtitle: '可以继续阅读原文,生成完成后会自动刷新右侧卡片。',
errorTitle: '生成失败',
actionCopyError: '复制错误信息',
@ -189,6 +190,7 @@ export const STRINGS: Record<string, Record<string, string>> = {
staleBanner: 'The source note or generation settings changed. This is stale cache.',
loadingDefault: 'Generating parallel notes...',
loadingGenerating: 'Parallel Reader: asking the LLM to read and segment the full note...',
streamChars: '{count} chars',
loadingSubtitle: 'You can keep reading. Cards will refresh when generation finishes.',
errorTitle: 'Generation failed',
actionCopyError: 'Copy error',

View file

@ -104,7 +104,7 @@ export class ParallelReaderView extends ItemView {
const pre = existing.querySelector('pre');
if (pre) pre.textContent = text.slice(-2000);
const counter = existing.querySelector('.parallel-reader-stream-counter');
if (counter) counter.textContent = `${text.length} chars`;
if (counter) counter.textContent = this.plugin.t('streamChars', { count: text.length });
return;
}
container.empty();
@ -122,7 +122,10 @@ export class ParallelReaderView extends ItemView {
state.createDiv({ cls: 'parallel-reader-spinner' });
const titleEl = state.createEl('div', { cls: 'parallel-reader-state-title' });
titleEl.createSpan({ text: this.plugin.t('loadingGenerating') + ' ' });
titleEl.createSpan({ cls: 'parallel-reader-stream-counter', text: `${text.length} chars` });
titleEl.createSpan({
cls: 'parallel-reader-stream-counter',
text: this.plugin.t('streamChars', { count: text.length }),
});
const pre = state.createEl('pre', { cls: 'parallel-reader-stream-text' });
pre.textContent = text.slice(-2000);
}