Ajout de la traduction française à l'interface utilisateur.

- Création du fichier de traduction `fr.json` en se basant sur `en.json`.
- Mise à jour de la configuration i18n pour inclure la langue française.
- Modification du sélecteur de langue pour afficher l'option "Français" avec le drapeau correspondant.
This commit is contained in:
google-labs-jules[bot]
2025-09-25 10:26:03 +00:00
committed by comeback01
parent da88e746ef
commit bea5dcd506
6 changed files with 2192 additions and 1 deletions

1
bun_output.log Normal file
View File

@@ -0,0 +1 @@
$ vite

View File

@@ -0,0 +1,43 @@
from playwright.sync_api import sync_playwright, expect
import time
def run(playwright):
browser = playwright.chromium.launch(headless=True)
context = browser.new_context()
page = context.new_page()
# Go to the page and wait for it to be ready
page.goto("http://localhost:5173", wait_until="networkidle")
print("Page loaded")
# The aria-label is in Chinese in the source, so we use that.
language_button = page.get_by_role("button", name="切换语言")
# Wait for the button to be visible
expect(language_button).to_be_visible()
print("Language button found")
language_button.click()
print("Language button clicked")
# Click the "Français" option
french_option = page.get_by_role("menuitem", name="Français")
expect(french_option).to_be_visible()
print("French option found")
french_option.click()
print("French option clicked")
# Wait for the language switch to apply
time.sleep(2) # Wait for 2 seconds
# Now the aria-label should be in French
expect(page.get_by_role("button", name="Changer de langue")).to_be_visible(timeout=10000)
print("Language changed to French")
# Take a screenshot to see the page state
page.screenshot(path="jules-scratch/verification/verification.png")
print("Screenshot taken")
browser.close()
with sync_playwright() as playwright:
run(playwright)

6
package-lock.json generated Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "app",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

View File

@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react';
import { Button, Dropdown } from '@douyinfe/semi-ui';
import { Languages } from 'lucide-react';
import { CN, GB } from 'country-flag-icons/react/3x2';
import { CN, GB, FR } from 'country-flag-icons/react/3x2';
const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
return (
@@ -42,6 +42,13 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
<GB title='English' className='!w-5 !h-auto' />
<span>English</span>
</Dropdown.Item>
<Dropdown.Item
onClick={() => onLanguageChange('fr')}
className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'fr' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
>
<FR title='Français' className='!w-5 !h-auto' />
<span>Français</span>
</Dropdown.Item>
</Dropdown.Menu>
}
>

View File

@@ -22,6 +22,7 @@ import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import enTranslation from './locales/en.json';
import frTranslation from './locales/fr.json';
import zhTranslation from './locales/zh.json';
i18n
@@ -36,6 +37,9 @@ i18n
zh: {
translation: zhTranslation,
},
fr: {
translation: frTranslation,
},
},
fallbackLng: 'zh',
interpolation: {

2130
web/src/i18n/locales/fr.json Normal file

File diff suppressed because it is too large Load Diff