Skip to content

Conversation

@MaciejkaG
Copy link

This pull request improves the browser locale detection and adds Polish translations.

Copilot AI review requested due to automatic review settings September 3, 2025 20:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant