Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
import { describe, expect, it } from 'vitest';
import { resolvePreferredSystemLocale, resolveSystemLocale } from '../locale';
describe('desktop locale resolution', () => {
it('routes simplified and traditional Chinese tags separately', () => {
for (const tag of ['zh', 'zh-CN', 'zh-Hans', 'zh-Hans-HK', 'zh-SG']) {
expect(resolveSystemLocale(tag), tag).toBe('zh-CN');
}
for (const tag of ['zh-Hant', 'zh-TW', 'zh-HK', 'zh-MO', 'zh-Hant-CN', 'ZH_HANT_TW']) {
expect(resolveSystemLocale(tag), tag).toBe('zh-TW');
}
});
it('uses the first supported locale in the OS preference list', () => {
expect(resolvePreferredSystemLocale(['fr-FR', 'zh-Hant-TW', 'en-US'])).toBe('zh-TW');
expect(resolvePreferredSystemLocale(['fr-FR', 'ja-JP'])).toBe('ja');
expect(resolvePreferredSystemLocale(['fr-FR'])).toBe('en');
});
});