fix: localize auto-compact threshold settings

This commit is contained in:
Xiaohan-Tian
2026-06-03 17:38:34 -07:00
parent 42fdcebd42
commit 5c6e1d69c5
6 changed files with 34 additions and 6 deletions
@@ -178,7 +178,7 @@ describe('GeneralSettings', () => {
it('renders and persists the auto-compact threshold', async () => {
renderSettings();
const select = await screen.findByLabelText('Auto-Compact Threshold');
const select = await screen.findByLabelText(translate('settings.general.autoCompactThreshold.label', undefined, 'en_us'));
expect((select as HTMLSelectElement).value).toBe('90');
fireEvent.change(select, { target: { value: '80' } });
@@ -188,6 +188,14 @@ describe('GeneralSettings', () => {
});
});
it('renders the auto-compact threshold label from the zh_cn catalog', async () => {
renderSettings('zh_cn');
expect(
await screen.findByLabelText(translate('settings.general.autoCompactThreshold.label', undefined, 'zh_cn')),
).toBeTruthy();
});
it('renders and persists local runtime download URLs', async () => {
renderSettings();
@@ -426,7 +426,7 @@ const GeneralSettings: React.FC = () => {
<div className="settings-item">
<label className="settings-label" htmlFor="general-auto-compact-threshold">
Auto-Compact Threshold
{t('settings.general.autoCompactThreshold.label')}
</label>
<select
id="general-auto-compact-threshold"
@@ -434,12 +434,12 @@ const GeneralSettings: React.FC = () => {
value={autoCompactThresholdPercent}
onChange={(e) => void handleAutoCompactThresholdChange(e.target.value)}
>
<option value="95">Conservative (95%)</option>
<option value="90">Standard (90%)</option>
<option value="80">Early (80%)</option>
<option value="95">{t('settings.general.autoCompactThreshold.conservative')}</option>
<option value="90">{t('settings.general.autoCompactThreshold.standard')}</option>
<option value="80">{t('settings.general.autoCompactThreshold.early')}</option>
</select>
<div className="settings-help" style={{ fontSize: '12px', color: '#888', marginTop: '4px' }}>
Compact the conversation before the next request when estimated context usage reaches this level.
{t('settings.general.autoCompactThreshold.help')}
</div>
</div>
</div>