mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-07-03 14:07:11 +02:00
fix: update locale detection to use cookie value for language setting in resume store
This commit is contained in:
@@ -115,12 +115,13 @@ export const useResumeStore = create(
|
||||
activeResume: null,
|
||||
|
||||
createResume: (templateId = null) => {
|
||||
// 判断当前语言环境
|
||||
const locale =
|
||||
typeof window !== "undefined"
|
||||
? window.navigator.language.split("-")[0]
|
||||
: "en";
|
||||
console.log("locale", locale);
|
||||
typeof document !== "undefined"
|
||||
? document.cookie
|
||||
.split("; ")
|
||||
.find((row) => row.startsWith("NEXT_LOCALE="))
|
||||
?.split("=")[1] || "zh"
|
||||
: "zh";
|
||||
|
||||
const initialResumeData =
|
||||
locale === "en" ? initialResumeStateEn : initialResumeState;
|
||||
|
||||
Reference in New Issue
Block a user