Skip to content

Adds Cantonese Chinese (zh-hk) locale #478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
2 changes: 2 additions & 0 deletions backend/app/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ enum Locale: string
case PT = 'pt';
case PT_BR = 'pt-br';
case ZH_CN = 'zh-cn';

case ZH_HK = 'zh-hk';
case VI = 'vi';

public static function getSupportedLocales(): array
Expand Down
423 changes: 423 additions & 0 deletions backend/lang/zh-hk.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/lingui.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config: LinguiConfig = {
// "ja", // Japanese
// "ko", // Korean
// "id", // Indonesian
// "zh-hk", // Cantonese Chinese (Hong Kong)
"zh-hk", // Cantonese Chinese (Hong Kong)
// "cs", // Czech
// "ga", // Irish
],
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 @@ -24,6 +24,8 @@ export const LanguageSwitcher = () => {
return t`Brazilian Portuguese`;
case "zh-cn":
return t`Chinese (Simplified)`;
case "zh-hk":
return t`Chinese (Traditional)`;
case "vi":
return t`Vietnamese`;
}
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import {messages as es} from "./locales/es.po";
// @ts-ignore
import {messages as zhCn} from "./locales/zh-cn.po";
// @ts-ignore
import {messages as zhHk} from "./locales/zh-hk.po";
// @ts-ignore
import {messages as ptBr} from "./locales/pt-br.po";
// @ts-ignore
import {messages as vi} from "./locales/vi.po";
import {i18n} from "@lingui/core";
import {t} from "@lingui/macro";

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

export const localeMessages: Record<string, any> = {
en: en,
Expand All @@ -26,6 +28,7 @@ export const localeMessages: Record<string, any> = {
pt: pt,
es: es,
"zh-cn": zhCn,
"zh-hk": zhHk,
"pt-br": ptBr,
vi: vi,
};
Expand All @@ -37,6 +40,7 @@ export const localeToFlagEmojiMap: Record<SupportedLocales, string> = {
pt: '🇵🇹',
es: '🇪🇸',
"zh-cn": '🇨🇳',
"zh-hk": '🇭🇰',
"pt-br": '🇧🇷',
vi: '🇻🇳',
};
Expand All @@ -48,6 +52,7 @@ export const localeToNameMap: Record<SupportedLocales, string> = {
pt: `Portuguese`,
es: `Spanish`,
"zh-cn": `Chinese`,
"zh-hk": `Cantonese`,
"pt-br": `Portuguese (Brazil)`,
vi: `Vietnamese`,
};
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locales/zh-hk.js

Large diffs are not rendered by default.

Loading