From 32f72f49a830dfadc32955ffe4bdd7fdf1659fbf Mon Sep 17 00:00:00 2001 From: Ygor Simões Date: Thu, 22 Jan 2026 15:36:33 -0300 Subject: feat(i18n): add br locale support (#10086) --- packages/app/src/context/language.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'packages/app/src/context') diff --git a/packages/app/src/context/language.tsx b/packages/app/src/context/language.tsx index b5830122f..da10e4773 100644 --- a/packages/app/src/context/language.tsx +++ b/packages/app/src/context/language.tsx @@ -16,6 +16,7 @@ import { dict as pl } from "@/i18n/pl" import { dict as ru } from "@/i18n/ru" import { dict as ar } from "@/i18n/ar" import { dict as no } from "@/i18n/no" +import { dict as br } from "@/i18n/br" import { dict as uiEn } from "@opencode-ai/ui/i18n/en" import { dict as uiZh } from "@opencode-ai/ui/i18n/zh" import { dict as uiZht } from "@opencode-ai/ui/i18n/zht" @@ -29,13 +30,14 @@ import { dict as uiPl } from "@opencode-ai/ui/i18n/pl" import { dict as uiRu } from "@opencode-ai/ui/i18n/ru" import { dict as uiAr } from "@opencode-ai/ui/i18n/ar" import { dict as uiNo } from "@opencode-ai/ui/i18n/no" +import { dict as uiBr } from "@opencode-ai/ui/i18n/br" -export type Locale = "en" | "zh" | "zht" | "ko" | "de" | "es" | "fr" | "da" | "ja" | "pl" | "ru" | "ar" | "no" +export type Locale = "en" | "zh" | "zht" | "ko" | "de" | "es" | "fr" | "da" | "ja" | "pl" | "ru" | "ar" | "no" | "br" type RawDictionary = typeof en & typeof uiEn type Dictionary = i18n.Flatten -const LOCALES: readonly Locale[] = ["en", "zh", "zht", "ko", "de", "es", "fr", "da", "ja", "pl", "ru", "ar", "no"] +const LOCALES: readonly Locale[] = ["en", "zh", "zht", "ko", "de", "es", "fr", "da", "ja", "pl", "ru", "ar", "no", "br"] function detectLocale(): Locale { if (typeof navigator !== "object") return "en" @@ -62,6 +64,7 @@ function detectLocale(): Locale { language.toLowerCase().startsWith("nn") ) return "no" + if (language.toLowerCase().startsWith("pt")) return "br" } return "en" @@ -90,6 +93,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont if (store.locale === "ru") return "ru" if (store.locale === "ar") return "ar" if (store.locale === "no") return "no" + if (store.locale === "br") return "br" return "en" }) @@ -113,6 +117,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont if (locale() === "ru") return { ...base, ...i18n.flatten({ ...ru, ...uiRu }) } if (locale() === "ar") return { ...base, ...i18n.flatten({ ...ar, ...uiAr }) } if (locale() === "no") return { ...base, ...i18n.flatten({ ...no, ...uiNo }) } + if (locale() === "br") return { ...base, ...i18n.flatten({ ...br, ...uiBr }) } return { ...base, ...i18n.flatten({ ...ko, ...uiKo }) } }) @@ -132,6 +137,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont ru: "language.ru", ar: "language.ar", no: "language.no", + br: "language.br", } const label = (value: Locale) => t(labelKey[value]) -- cgit v1.2.3