refactor: unify i18n function calls and simplify scripts
- Replace dynamic t(lang.labelKey) with static t(lang.label) using helper functions - Add getLanguageLabel/getLangLabel/getLocaleLabel helper functions for switch-based label lookup - Simplify translation check scripts to only detect literal string calls - Fix namespace lookup for dotted namespaces like 'memorize.review'
This commit is contained in:
@@ -13,11 +13,18 @@ import { actionCreateCard } from "@/modules/card/card-action";
|
||||
import type { CardType, CardMeaning } from "@/modules/card/card-action-dto";
|
||||
import { toast } from "sonner";
|
||||
|
||||
const QUERY_LANGUAGE_LABELS = {
|
||||
english: "english",
|
||||
chinese: "chinese",
|
||||
japanese: "japanese",
|
||||
korean: "korean",
|
||||
} as const;
|
||||
|
||||
const QUERY_LANGUAGES = [
|
||||
{ value: "en", labelKey: "english" },
|
||||
{ value: "zh", labelKey: "chinese" },
|
||||
{ value: "ja", labelKey: "japanese" },
|
||||
{ value: "ko", labelKey: "korean" },
|
||||
{ value: "en", label: "english" as const },
|
||||
{ value: "zh", label: "chinese" as const },
|
||||
{ value: "ja", label: "japanese" as const },
|
||||
{ value: "ko", label: "korean" as const },
|
||||
] as const;
|
||||
|
||||
interface AddCardModalProps {
|
||||
@@ -169,7 +176,7 @@ export function AddCardModal({
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
{t(lang.labelKey)}
|
||||
{t(lang.label)}
|
||||
</LightButton>
|
||||
))}
|
||||
<Input
|
||||
|
||||
Reference in New Issue
Block a user