Website: Add polish translation, improve locale detection#774
Website: Add polish translation, improve locale detection#774Caldis merged 2 commits intoCaldis:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds Polish translation support to the website and improves the browser locale detection system by replacing a simple prefix check with a more comprehensive language mapping approach.
- Add complete Polish translations for all website strings
- Replace basic browser language detection with a configurable mapping system
- Update language selector to include Polish option
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| website/app/i18n/pl.ts | Adds complete Polish translation strings for the website |
| website/app/i18n/context.tsx | Improves locale detection logic and integrates Polish translations |
| website/app/components/LanguageSelector/LanguageSelector.tsx | Adds Polish language option to the selector |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const browserLang = navigator.language.toLowerCase(); | ||
| setLanguage(browserLang.startsWith("zh") ? "zh" : "en"); | ||
| const languageMap: Record<string, Language | ((lang: string) => Language)> = { | ||
| zh: (lang) => lang.includes("hant") ? "zh-Hant" : "zh", |
There was a problem hiding this comment.
The Chinese variant detection logic is fragile. Using lang.includes("hant") will incorrectly match locales like 'zh-Hans-CN' (Simplified Chinese) as Traditional Chinese because 'Hans' contains 'hant'. Use a more precise check like lang.includes('zh-hant') or lang.includes('hk') || lang.includes('tw') for Traditional Chinese detection.
| zh: (lang) => lang.includes("hant") ? "zh-Hant" : "zh", | |
| zh: (lang) => | |
| lang.includes("zh-hant") || | |
| lang.includes("zh-hk") || | |
| lang.includes("zh-tw") || | |
| lang.endsWith("-hant") || | |
| lang.endsWith("-hk") || | |
| lang.endsWith("-tw") | |
| ? "zh-Hant" | |
| : "zh", |
This pull request improves the browser locale detection and adds Polish translations.