feat: added French support
This commit is contained in:
@@ -111,6 +111,17 @@ describe('processUserMessage slash commands', () => {
|
||||
expect(result.pseudoAssistantResponse).toContain('welcome_local_llm-zh_cn.md');
|
||||
});
|
||||
|
||||
it('uses the localized welcome asset when fr-FR is selected', async () => {
|
||||
configState.set('general.language', 'fr_fr');
|
||||
configState.set('general.llm_provider', 'local_browser');
|
||||
|
||||
const result = await processUserMessage('/welcome');
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(expect.stringContaining('chat/welcome_local_llm-fr_fr.md'));
|
||||
expect(result.metadata).toMatchObject({ command: 'welcome', variant: 'local' });
|
||||
expect(result.pseudoAssistantResponse).toContain('welcome_local_llm-fr_fr.md');
|
||||
});
|
||||
|
||||
it('falls back to a localized welcome string when welcome markdown fetch fails', async () => {
|
||||
configState.set('general.language', 'zh_cn');
|
||||
configState.set('general.llm_provider', 'local_browser');
|
||||
@@ -170,6 +181,19 @@ describe('processUserMessage slash commands', () => {
|
||||
expect(message?.content).toContain('welcome_local_llm-zh_cn.md');
|
||||
});
|
||||
|
||||
it('uses localized welcome assets for addWelcomeMessage under auto + French locale', async () => {
|
||||
configState.set('general.language', 'auto');
|
||||
vi.stubGlobal('navigator', {
|
||||
languages: ['fr-FR', 'en-US'],
|
||||
language: 'fr-FR',
|
||||
});
|
||||
|
||||
const message = await addWelcomeMessage();
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(expect.stringContaining('chat/welcome_local_llm-fr_fr.md'));
|
||||
expect(message?.content).toContain('welcome_local_llm-fr_fr.md');
|
||||
});
|
||||
|
||||
it('fetches the localized help guide for /help under zh-CN', async () => {
|
||||
configState.set('general.language', 'zh_cn');
|
||||
|
||||
@@ -185,6 +209,15 @@ describe('processUserMessage slash commands', () => {
|
||||
expect(result.pseudoAssistantResponse).toContain('chat/help-zh_cn.md');
|
||||
});
|
||||
|
||||
it('fetches the localized help guide for /help under fr-FR', async () => {
|
||||
configState.set('general.language', 'fr_fr');
|
||||
|
||||
const result = await processUserMessage('/help');
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(expect.stringContaining('chat/help-fr_fr.md'));
|
||||
expect(result.pseudoAssistantResponse).toContain('chat/help-fr_fr.md');
|
||||
});
|
||||
|
||||
it('falls back to the English help guide when the localized file is missing', async () => {
|
||||
configState.set('general.language', 'zh_cn');
|
||||
vi.stubGlobal('fetch', vi.fn(async (input: string | URL | Request) => {
|
||||
@@ -223,6 +256,15 @@ describe('processUserMessage slash commands', () => {
|
||||
expect(result.pseudoAssistantResponse).toContain('chat/hotkeys.md');
|
||||
});
|
||||
|
||||
it('fetches the localized hotkeys guide for /hotkeys under fr-FR', async () => {
|
||||
configState.set('general.language', 'fr_fr');
|
||||
|
||||
const result = await processUserMessage('/hotkeys');
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(expect.stringContaining('chat/hotkeys-fr_fr.md'));
|
||||
expect(result.pseudoAssistantResponse).toContain('chat/hotkeys-fr_fr.md');
|
||||
});
|
||||
|
||||
it('fetches the localized hotkeys guide for /hotkeys under zh-CN', async () => {
|
||||
configState.set('general.language', 'zh_cn');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user