Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/app/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum Locale: string
case FR = 'fr';
case IT = 'it';
case NL = 'nl';
case HU = 'hu';
case ES = 'es';
case PT = 'pt';
case PT_BR = 'pt-br';
Expand Down
423 changes: 423 additions & 0 deletions backend/lang/hu.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/lingui.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config: LinguiConfig = {
"es", // Spanish
"fr", // French
"nl", // Dutch
"hu", // Hungarian
"pt-br", // Portuguese (Brazil)
"ru", // Russian
"de", // German
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/common/LanguageSwitcher/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const LanguageSwitcher = () => {
// Ideally these would be in the locales.ts file, but when they're there they don't translate
const getLocaleName = (locale: SupportedLocales): string => {
switch (locale) {
case "hu":
return t`Hungarian`;
case "de":
return t`German`;
case "en":
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/locales.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import {i18n} from "@lingui/core";
import {t} from "@lingui/macro";

export type SupportedLocales = "en" | "de" | "fr" | "it" | "nl" | "pt" | "es" | "zh-cn" | "pt-br" | "vi" |"zh-hk";
export type SupportedLocales = "en" | "de" | "fr" | "it" | "nl" | "hu" | "pt" | "es" | "zh-cn" | "pt-br" | "vi" |"zh-hk";

export const availableLocales = ["en", "de", "fr", "it", "nl", "pt", "es", "zh-cn", "zh-hk", "pt-br", "vi",];
export const availableLocales = ["en", "de", "fr", "it", "nl", "hu", "pt", "es", "zh-cn", "zh-hk", "pt-br", "vi",];

export const localeToFlagEmojiMap: Record<SupportedLocales, string> = {
en: '🇬🇧',
de: '🇩🇪',
fr: '🇫🇷',
it: '🇮🇹',
nl: '🇳🇱',
hu: '🇭🇺',
pt: '🇵🇹',
es: '🇪🇸',
"zh-cn": '🇨🇳',
Expand All @@ -25,6 +26,7 @@ export const localeToNameMap: Record<SupportedLocales, string> = {
fr: `French`,
it: `Italian`,
nl: `Dutch`,
hu: `Hungarian`,
pt: `Portuguese`,
es: `Spanish`,
"zh-cn": `Chinese`,
Expand Down Expand Up @@ -56,10 +58,14 @@ export const getClientLocale = () => {
};

export async function dynamicActivateLocale(locale: string) {
try {
locale = availableLocales.includes(locale) ? locale : "en";
const module = (await import(`./locales/${locale}.po`));
i18n.load(locale, module.messages);
i18n.activate(locale);
} catch (error) {
i18n.activate("en");
}
}

export const getSupportedLocale = (userLocale: string) => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locales/hu.js

Large diffs are not rendered by default.

Loading