Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Support Brazilian Portuguese

Manav Rathi1436dafbf29a
diff --git a/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx b/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx
index 15ba2fa9ce..e8f8bf6c28 100644
--- a/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx
+++ b/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx
@@ -25,6 +25,8 @@ export const localeName = (locale: SupportedLocale) => {
return 'Nederlands';
case 'es-ES':
return 'Español';
+ case 'pt-BR':
+ return 'Brazilian Portuguese';
}
};
diff --git a/packages/ui/i18n.ts b/packages/ui/i18n.ts
index 82530c9535..29906fdda6 100644
--- a/packages/ui/i18n.ts
+++ b/packages/ui/i18n.ts
@@ -5,7 +5,6 @@ import { isDevBuild } from "@/utils/env";
import { getUserLocales } from "get-user-locale";
import { includes } from "@/utils/type-guards";
import {
- type LSKey,
getLSString,
setLSString,
removeLSString,
@@ -31,6 +30,7 @@ export const supportedLocales = [
"zh-CN" /* Simplified Chinese */,
"nl-NL" /* Dutch */,
"es-ES" /* Spanish */,
+ "pt-BR" /* Portuguese, Brazilian */,
] as const;
/** The type of {@link supportedLocales}. */
@@ -193,21 +193,25 @@ const closestSupportedLocale = (
const ss = savedLocaleString;
if (ss && includes(supportedLocales, ss)) return ss;
- for (const us of getUserLocales()) {
+ for (const ls of getUserLocales()) {
// Exact match
- if (us && includes(supportedLocales, us)) return us;
+ if (ls && includes(supportedLocales, ls)) return ls;
// Language match
- if (us.startsWith("en")) {
+ if (ls.startsWith("en")) {
return "en-US";
- } else if (us.startsWith("fr")) {
+ } else if (ls.startsWith("fr")) {
return "fr-FR";
- } else if (us.startsWith("zh")) {
+ } else if (ls.startsWith("zh")) {
return "zh-CN";
- } else if (us.startsWith("nl")) {
+ } else if (ls.startsWith("nl")) {
return "nl-NL";
- } else if (us.startsWith("es")) {
+ } else if (ls.startsWith("es")) {
return "es-ES";
+ } else if (ls.startsWith("pt-BR")) {
+ // We'll never get here (it'd already be an exact match), just kept
+ // to keep this list consistent.
+ return "pt-BR";
}
}