Skip to content

Commit 5a767da

Browse files
committed
feat(i18n): add support for Brazilian Portuguese
1 parent 9f93d30 commit 5a767da

File tree

3 files changed

+18
-52
lines changed

3 files changed

+18
-52
lines changed

apps/client/src/widgets/view_widgets/calendar_view.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ export async function getFullCalendarLocale(locale: string) {
676676
return (await import("@fullcalendar/core/locales/ru")).default;
677677
case "ja":
678678
return (await import("@fullcalendar/core/locales/ja")).default;
679+
case "pt_BR":
680+
return (await import("@fullcalendar/core/locales/pt-br")).default;
679681
case "uk":
680682
return (await import("@fullcalendar/core/locales/uk")).default;
681683
case "en":

apps/server/src/services/i18n.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const DAYJS_LOADER: Record<LOCALE_IDS, () => Promise<typeof import("dayjs/locale
1818
"he": () => import("dayjs/locale/he.js"),
1919
"ja": () => import("dayjs/locale/ja.js"),
2020
"ku": () => import("dayjs/locale/ku.js"),
21+
"pt_BR": () => import("dayjs/locale/pt_BR.js"),
2122
"ro": () => import("dayjs/locale/ro.js"),
2223
"ru": () => import("dayjs/locale/ru.js"),
2324
"tw": () => import("dayjs/locale/zh-tw.js"),
@@ -40,8 +41,10 @@ export async function initializeTranslations() {
4041
});
4142

4243
// Initialize dayjs locale.
43-
const dayjsLocale = await DAYJS_LOADER[locale]();
44-
dayjs.locale(dayjsLocale);
44+
const dayjsLocale = DAYJS_LOADER[locale];
45+
if (dayjsLocale) {
46+
dayjs.locale(await dayjsLocale());
47+
}
4548
}
4649

4750
export function ordinal(date: Dayjs) {

packages/commons/src/lib/i18n.ts

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,17 @@ export interface Locale {
1010
}
1111

1212
const UNSORTED_LOCALES: Locale[] = [
13-
{
14-
id: "en",
15-
name: "English",
16-
electronLocale: "en"
17-
},
18-
{
19-
id: "de",
20-
name: "Deutsch",
21-
electronLocale: "de"
22-
},
23-
{
24-
id: "es",
25-
name: "Español",
26-
electronLocale: "es"
27-
},
28-
{
29-
id: "fr",
30-
name: "Français",
31-
electronLocale: "fr"
32-
},
33-
{
34-
id: "cn",
35-
name: "简体中文",
36-
electronLocale: "zh_CN"
37-
},
38-
{
39-
id: "tw",
40-
name: "繁體中文",
41-
electronLocale: "zh_TW"
42-
},
43-
{
44-
id: "ro",
45-
name: "Română",
46-
electronLocale: "ro"
47-
},
48-
{
49-
id: "ru",
50-
name: "Русский",
51-
electronLocale: "ru"
52-
},
53-
{
54-
id: "uk",
55-
name: "Українська",
56-
electronLocale: "uk"
57-
},
58-
{
59-
id: "ja",
60-
name: "日本語",
61-
electronLocale: "ja"
62-
},
13+
{ id: "cn", name: "简体中文", electronLocale: "zh_CN" },
14+
{ id: "de", name: "Deutsch", electronLocale: "de" },
15+
{ id: "en", name: "English", electronLocale: "en" },
16+
{ id: "es", name: "Español", electronLocale: "es" },
17+
{ id: "fr", name: "Français", electronLocale: "fr" },
18+
{ id: "ja", name: "日本語", electronLocale: "ja" },
19+
{ id: "pt_BR", name: "Português (Brasil)", electronLocale: "pt-BR" },
20+
{ id: "ro", name: "Română", electronLocale: "ro" },
21+
{ id: "ru", name: "Русский", electronLocale: "ru" },
22+
{ id: "tw", name: "繁體中文", electronLocale: "zh_TW" },
23+
{ id: "uk", name: "Українська", electronLocale: "uk" },
6324

6425
/*
6526
* Right to left languages

0 commit comments

Comments
 (0)