feat: traditional Chinese translations (#4705)

Co-authored-by: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com>
Co-authored-by: Dhruwang <dhruwangjariwala18@gmail.com>
This commit is contained in:
Ted
2025-02-17 17:26:05 +08:00
committed by GitHub
parent cb8497229d
commit bec138c4f0
10 changed files with 3054 additions and 11 deletions

View File

@@ -23,6 +23,10 @@
{
"language": "pt-BR",
"path": "./packages/lib/messages/pt-BR.json"
},
{
"language": "zh-Hant-TW",
"path": "./packages/lib/messages/zh-Hant-TW.json"
}
],
"forceMode": "OVERRIDE"

View File

@@ -12,15 +12,14 @@ import { Metadata, NextPage } from "next";
import { getServerSession } from "next-auth";
import Link from "next/link";
import { redirect } from "next/navigation";
import { SURVEYS_PER_PAGE, WEBAPP_URL } from "@formbricks/lib/constants";
import { DEFAULT_LOCALE, SURVEYS_PER_PAGE, WEBAPP_URL } from "@formbricks/lib/constants";
import { getEnvironment, getEnvironments } from "@formbricks/lib/environment/service";
import { getMembershipByUserIdOrganizationId } from "@formbricks/lib/membership/service";
import { getAccessFlags } from "@formbricks/lib/membership/utils";
import { getOrganizationByEnvironmentId } from "@formbricks/lib/organization/service";
import { getProjectByEnvironmentId } from "@formbricks/lib/project/service";
import { getSurveyCount } from "@formbricks/lib/survey/service";
import { getUser } from "@formbricks/lib/user/service";
import { findMatchingLocale } from "@formbricks/lib/utils/locale";
import { getUser, getUserLocale } from "@formbricks/lib/user/service";
import { TTemplateRole } from "@formbricks/types/templates";
export const metadata: Metadata = {
@@ -86,7 +85,7 @@ const SurveysPage = async ({ params: paramsProps, searchParams: searchParamsProp
const otherEnvironment = environments.find((e) => e.type !== environment.type)!;
const currentProjectChannel = project.config.channel ?? null;
const locale = await findMatchingLocale();
const locale = (await getUserLocale(session.user.id)) ?? DEFAULT_LOCALE;
const CreateSurveyButton = () => {
return (
<Button size="sm" asChild>

View File

@@ -23,7 +23,7 @@ const nextConfig = {
"app/api/packages": ["../../packages/js-core/dist/*", "../../packages/surveys/dist/*"],
},
i18n: {
locales: ["en-US", "de-DE", "fr-FR", "pt-BR"],
locales: ["en-US", "de-DE", "fr-FR", "pt-BR", "zh-Hant-TW"],
localeDetection: false,
defaultLocale: "en-US",
},

View File

@@ -4,7 +4,7 @@ import { DevTools, Tolgee } from "@tolgee/web";
const apiKey = process.env.NEXT_PUBLIC_TOLGEE_API_KEY;
const apiUrl = process.env.NEXT_PUBLIC_TOLGEE_API_URL;
export const ALL_LANGUAGES = ["en-US", "de-DE", "fr-FR", "pt-BR"];
export const ALL_LANGUAGES = ["en-US", "de-DE", "fr-FR", "pt-BR", "zh-Hant-TW"];
export const DEFAULT_LANGUAGE = "en-US";
@@ -20,6 +20,7 @@ export function TolgeeBase() {
"de-DE": () => import("@formbricks/lib/messages/de-DE.json"),
"fr-FR": () => import("@formbricks/lib/messages/fr-FR.json"),
"pt-BR": () => import("@formbricks/lib/messages/pt-BR.json"),
"zh-Hant-TW": () => import("@formbricks/lib/messages/zh-Hant-TW.json"),
},
});
}

View File

@@ -200,7 +200,7 @@ export const STRIPE_API_VERSION = "2024-06-20";
export const MAX_ATTRIBUTE_CLASSES_PER_ENVIRONMENT = 150 as const;
export const DEFAULT_LOCALE = "en-US";
export const AVAILABLE_LOCALES: TUserLocale[] = ["en-US", "de-DE", "pt-BR", "fr-FR"];
export const AVAILABLE_LOCALES: TUserLocale[] = ["en-US", "de-DE", "pt-BR", "fr-FR", "zh-Hant-TW"];
// Billing constants

File diff suppressed because it is too large Load Diff

View File

@@ -1245,7 +1245,7 @@
"edit": {
"1_choose_the_default_language_for_this_survey": "1. Wähle die Standardsprache für diese Umfrage:",
"2_activate_translation_for_specific_languages": "2. Übersetzung für bestimmte Sprachen aktivieren:",
"add": "Hinzufügen +",
"add": "+ hinzufügen",
"add_a_delay_or_auto_close_the_survey": "Füge eine Verzögerung hinzu oder schließe die Umfrage automatisch.",
"add_a_four_digit_pin": "Füge eine vierstellige PIN hinzu",
"add_a_new_question_to_your_survey": "Neue Frage hinzufügen",

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
import { formatDistance, intlFormat } from "date-fns";
import { de, enUS, fr, ptBR } from "date-fns/locale";
import { de, enUS, fr, ptBR, zhTW } from "date-fns/locale";
import { TUserLocale } from "@formbricks/types/user";
export const convertDateString = (dateString: string) => {
@@ -86,6 +86,8 @@ const getLocaleForTimeSince = (locale: TUserLocale) => {
return ptBR;
case "fr-FR":
return fr;
case "zh-Hant-TW":
return zhTW;
}
};

View File

@@ -2,7 +2,7 @@ import { z } from "zod";
const ZRole = z.enum(["project_manager", "engineer", "founder", "marketing_specialist", "other"]);
export const ZUserLocale = z.enum(["en-US", "de-DE", "pt-BR", "fr-FR"]);
export const ZUserLocale = z.enum(["en-US", "de-DE", "pt-BR", "fr-FR", "zh-Hant-TW"]);
export type TUserLocale = z.infer<typeof ZUserLocale>;
export const ZUserObjective = z.enum([