From 3579459f5375ea91f4466048be86767eb4bac2cd Mon Sep 17 00:00:00 2001 From: meetqy Date: Sun, 31 Mar 2024 13:26:36 +0800 Subject: [PATCH 1/4] english --- src/app/[lang]/components/menu/content.tsx | 3 +- src/dictionaries/en.json | 76 ++++++++++++++++++++++ src/dictionaries/index.ts | 12 +++- src/server/api/utils.tsx | 2 +- 4 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 src/dictionaries/en.json diff --git a/src/app/[lang]/components/menu/content.tsx b/src/app/[lang]/components/menu/content.tsx index 2b05cc51..e7350c25 100644 --- a/src/app/[lang]/components/menu/content.tsx +++ b/src/app/[lang]/components/menu/content.tsx @@ -37,7 +37,7 @@ export function Content({ dict: Dictionary; lang: Locale; }) { - const pathname = usePathname().replace(/(zh-Hans|zh-Hant)\/?/, ""); + const pathname = usePathname().replace(/(zh-Hans|zh-Hant|en)\/?/, ""); const { data: poemCount } = api.poem.count.useQuery(); const { data: authorCount } = api.author.count.useQuery(); @@ -152,6 +152,7 @@ export function Content({ 中文简体 中文繁体 + English diff --git a/src/dictionaries/en.json b/src/dictionaries/en.json new file mode 100644 index 00000000..21f29e9d --- /dev/null +++ b/src/dictionaries/en.json @@ -0,0 +1,76 @@ +{ + "title": "Learn Poems Website", + "description": "aspoem.com is a modern poetry learning website that offers a comprehensive site search feature, allowing you to quickly search for regulated verse, quatrains, and works by various poets. We have also optimized the display of pinyin annotations, annotations, and vernacular Chinese, making poetry easier to read. Additionally, we provide a poetry printing tool to assist you in better studying ancient poetry. Come and experience the charm of our website!", + "point_keywords": [ + "poetry learning", + "learning ancient poetry", + "Three Hundred Tang Poems", + "Three Hundred Song Lyrics", + "Complete Works of Li Bai", + "Complete Works of Du Fu" + ], + "keywords": [ + "poetry learning", + "learning ancient poetry", + "Three Hundred Tang Poems", + "Three Hundred Song Lyrics", + "Complete Works of Li Bai", + "Complete Works of Du Fu", + "ancient poetry", + "poetry", + "poet statistics", + "poetry search", + "poetry pinyin", + "poetry annotations", + "poetry translation", + "pinyin" + ], + "menu": { + "poem": "Poems", + "auhtor": "Poets", + "ci_pai_ming": "Ci Pai Ming", + "tag": "Tags", + "contact": "Contact", + "theme": "Theme", + "language": "Language", + "feedback": "Feedback", + "print": "Print" + }, + "home": { + "poem": "Recommended", + "all_poems": "All Poems" + }, + "poem": { + "title": "Poems", + "pinyin": "Pinyin", + "pinyin_show": "Show Pinyin", + "pinyin_hide": "Hide Pinyin", + "translation": "Translation", + "tools": "Tools", + "more": "More Explore", + "comment": "Speak freely", + "comment_desc1": "Different ages, growth environments, and experiences will have different views.", + "comment_desc2": "Therefore, there is no standard answer, just like it yourself! Welcome to leave your thoughts!👏🏻👏🏻👏🏻", + "report_error": "Report Error", + "report_error_desc": "If you find an error, you can also leave a message below to correct it!" + }, + "poem_list": { + "title": "Poem List", + "empty": "No related poems found", + "tab_new": "Newest" + }, + "author": { + "title": "Poets" + }, + "author_detail": { + "title": "Poets" + }, + "search": { + "placeholder": "Search for poems, poets, etc.", + "empty": "No search results found" + }, + "pagination": { + "prev": "Previous", + "next": "Next" + } +} diff --git a/src/dictionaries/index.ts b/src/dictionaries/index.ts index 1530bc51..6b0a62b7 100644 --- a/src/dictionaries/index.ts +++ b/src/dictionaries/index.ts @@ -1,18 +1,25 @@ import "server-only"; -export const locales = ["zh-Hans", "zh-Hant"] as const; +export const locales = ["zh-Hans", "zh-Hant", "en"] as const; export const defaultLocale = "zh-Hans"; const dictionaries = { "zh-Hant": () => import("./zh-Hant.json").then((module) => module.default), "zh-Hans": () => import("./zh-Hans.json").then((module) => module.default), + en: () => import("./en.json").then((module) => module.default), }; export type Locale = keyof typeof dictionaries; export const getDictionary = async (locale: Locale = "zh-Hans") => { - return dictionaries[locale](); + const zhHans = await dictionaries["zh-Hans"](); + const result = await dictionaries[locale](); + + return { + ...zhHans, + ...result, + }; }; export type Dictionary = Awaited>; @@ -27,6 +34,7 @@ export const getMetaDataAlternates = (suffix: string, lang: Locale) => { languages: { "zh-Hans": `/zh-Hans${suffix}`, "zh-Hant": `/zh-Hant${suffix}`, + en: `/en${suffix}`, }, canonical: `/${lang}${suffix}`, }; diff --git a/src/server/api/utils.tsx b/src/server/api/utils.tsx index 6883d9c0..6c2882d7 100644 --- a/src/server/api/utils.tsx +++ b/src/server/api/utils.tsx @@ -2,7 +2,7 @@ import { type Tag, type Poem } from "@prisma/client"; import { mapKeys, pick } from "lodash-es"; import { z } from "zod"; -export const LangZod = z.enum(["zh-Hans", "zh-Hant"]).default("zh-Hans"); +export const LangZod = z.enum(["zh-Hans", "zh-Hant", "en"]).default("zh-Hans"); function transform>( res: T, From f439b9e082044a7ac92e13a9fded57d69c8796ce Mon Sep 17 00:00:00 2001 From: meetqy Date: Sun, 31 Mar 2024 14:01:04 +0800 Subject: [PATCH 2/4] english --- src/app/[lang]/components/menu/content.tsx | 2 +- src/app/[lang]/feedback/page.tsx | 12 ++----- src/app/[lang]/layout.tsx | 2 +- .../poem/[id]/components/twikoo/index.tsx | 6 +++- src/{dictionaries => components}/language.tsx | 0 src/dictionaries/en.json | 3 +- src/dictionaries/index.ts | 31 ++++++++++--------- src/dictionaries/zh-Hans.json | 1 + src/dictionaries/zh-Hant.json | 1 + src/middleware.ts | 1 - 10 files changed, 29 insertions(+), 30 deletions(-) rename src/{dictionaries => components}/language.tsx (100%) diff --git a/src/app/[lang]/components/menu/content.tsx b/src/app/[lang]/components/menu/content.tsx index e7350c25..84c5fa8e 100644 --- a/src/app/[lang]/components/menu/content.tsx +++ b/src/app/[lang]/components/menu/content.tsx @@ -37,7 +37,7 @@ export function Content({ dict: Dictionary; lang: Locale; }) { - const pathname = usePathname().replace(/(zh-Hans|zh-Hant|en)\/?/, ""); + const pathname = usePathname().replace(lang, ""); const { data: poemCount } = api.poem.count.useQuery(); const { data: authorCount } = api.author.count.useQuery(); diff --git a/src/app/[lang]/feedback/page.tsx b/src/app/[lang]/feedback/page.tsx index c117d1c5..c1ecc269 100644 --- a/src/app/[lang]/feedback/page.tsx +++ b/src/app/[lang]/feedback/page.tsx @@ -1,5 +1,5 @@ import { HeaderMain } from "~/components/ui/header"; -import { getDictionary, getLangText, type Locale } from "~/dictionaries"; +import { getDictionary, type Locale } from "~/dictionaries"; import Twikoo from "../poem/[id]/components/twikoo"; export default async function FeedbackPage({ @@ -22,15 +22,7 @@ export default async function FeedbackPage({

{dict.menu.feedback}

- {getLangText( - { - "zh-Hans": - "可以在此处查看网站的更新日志、未来规划,以及对新增功能的讨论。同时,也可以在此留下您的建议和意见。", - "zh-Hant": - "可以在此處查看網站的更新日誌、未來規劃,以及對新增功能的討論。同時,也可以在此留下您的建議和意見。", - }, - params.lang, - )} + {dict.feedback_desc}

diff --git a/src/app/[lang]/layout.tsx b/src/app/[lang]/layout.tsx index 62f1d4ea..d670c442 100644 --- a/src/app/[lang]/layout.tsx +++ b/src/app/[lang]/layout.tsx @@ -9,7 +9,7 @@ import { } from "~/dictionaries"; import { type Metadata } from "next/types"; import { MyHost } from "~/utils"; -import { Language } from "~/dictionaries/language"; +import { Language } from "~/components/language"; const Search = dynamic(() => import("./components/search"), { ssr: false }); const ModeToggle = dynamic(() => import("~/components/mode-toggle"), { diff --git a/src/app/[lang]/poem/[id]/components/twikoo/index.tsx b/src/app/[lang]/poem/[id]/components/twikoo/index.tsx index 9e91ef3b..bfd16b16 100644 --- a/src/app/[lang]/poem/[id]/components/twikoo/index.tsx +++ b/src/app/[lang]/poem/[id]/components/twikoo/index.tsx @@ -18,11 +18,15 @@ export default function Twikoo({ lang }: { lang: Locale }) { const loadSecondScript = () => { // 执行 twikoo.init() 函数 const initScript = document.createElement("script"); + let _lang: string = lang; + lang === "zh-Hans" && (_lang = "zh-cn"); + lang === "zh-Hant" && (_lang = "zh-tw"); + initScript.innerHTML = ` twikoo.init({ envId: "https://twikoo.aspoem.com/.netlify/functions/twikoo", el: '#twikoo-comment', - lang: "${lang === "zh-Hans" ? "zh-cn" : "zh-tw"}", + lang: "${_lang}", path: "${pathname}", }); `; diff --git a/src/dictionaries/language.tsx b/src/components/language.tsx similarity index 100% rename from src/dictionaries/language.tsx rename to src/components/language.tsx diff --git a/src/dictionaries/en.json b/src/dictionaries/en.json index 21f29e9d..6d2e243f 100644 --- a/src/dictionaries/en.json +++ b/src/dictionaries/en.json @@ -36,6 +36,7 @@ "feedback": "Feedback", "print": "Print" }, + "feedback_desc": "You can check the website's update log, future plans, and discussions on new features here. At the same time, you can also leave your suggestions and opinions here.", "home": { "poem": "Recommended", "all_poems": "All Poems" @@ -48,7 +49,7 @@ "translation": "Translation", "tools": "Tools", "more": "More Explore", - "comment": "Speak freely", + "comment": "Comment", "comment_desc1": "Different ages, growth environments, and experiences will have different views.", "comment_desc2": "Therefore, there is no standard answer, just like it yourself! Welcome to leave your thoughts!👏🏻👏🏻👏🏻", "report_error": "Report Error", diff --git a/src/dictionaries/index.ts b/src/dictionaries/index.ts index 6b0a62b7..aaca9a3e 100644 --- a/src/dictionaries/index.ts +++ b/src/dictionaries/index.ts @@ -1,16 +1,28 @@ import "server-only"; -export const locales = ["zh-Hans", "zh-Hant", "en"] as const; - export const defaultLocale = "zh-Hans"; - +export const locales = ["zh-Hans", "zh-Hant", "en"] as const; const dictionaries = { "zh-Hant": () => import("./zh-Hant.json").then((module) => module.default), "zh-Hans": () => import("./zh-Hans.json").then((module) => module.default), en: () => import("./en.json").then((module) => module.default), }; -export type Locale = keyof typeof dictionaries; +export type Locale = (typeof locales)[number]; + +/** + * 生成多语言 meta hreflang 标签 + */ +export const getMetaDataAlternates = (suffix: string, lang: Locale) => { + return { + languages: { + "zh-Hans": `/zh-Hans${suffix}`, + "zh-Hant": `/zh-Hant${suffix}`, + en: `/en${suffix}`, + }, + canonical: `/${lang}${suffix}`, + }; +}; export const getDictionary = async (locale: Locale = "zh-Hans") => { const zhHans = await dictionaries["zh-Hans"](); @@ -28,14 +40,3 @@ export const getLangText = (obj: { [key in Locale]: string }, lang: Locale) => obj[lang]; export const getLangUrl = (url: string, lang: Locale) => `/${lang}${url}`; - -export const getMetaDataAlternates = (suffix: string, lang: Locale) => { - return { - languages: { - "zh-Hans": `/zh-Hans${suffix}`, - "zh-Hant": `/zh-Hant${suffix}`, - en: `/en${suffix}`, - }, - canonical: `/${lang}${suffix}`, - }; -}; diff --git a/src/dictionaries/zh-Hans.json b/src/dictionaries/zh-Hans.json index dfa449c1..e6ec76a1 100644 --- a/src/dictionaries/zh-Hans.json +++ b/src/dictionaries/zh-Hans.json @@ -36,6 +36,7 @@ "feedback": "留言", "print": "打印" }, + "feedback_desc": "可以在此处查看网站的更新日志、未来规划,以及对新增功能的讨论。同时,也可以在此留下您的建议和意见。", "home": { "poem": "推荐", "all_poems": "全部诗词" diff --git a/src/dictionaries/zh-Hant.json b/src/dictionaries/zh-Hant.json index b3c97015..da222dda 100644 --- a/src/dictionaries/zh-Hant.json +++ b/src/dictionaries/zh-Hant.json @@ -36,6 +36,7 @@ "feedback": "留言", "print": "打印" }, + "feedback_desc": "可以在此處查看網站的更新日誌、未來規劃,以及對新增功能的討論。同時,也可以在此留下您的建議和意見。", "home": { "poem": "推薦", "all_poems": "全部詩詞" diff --git a/src/middleware.ts b/src/middleware.ts index c69fef71..54b5794d 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -30,7 +30,6 @@ export function middleware(request: NextRequest) { export const config = { matcher: [ "/author/:paht*", - "/cipaiming/:paht*", "/ci-pai-ming/:paht*", "/feedback/:paht*", "/list/:paht*", From ff851ef6726181b69d95bacc6cd8c4558f874472 Mon Sep 17 00:00:00 2001 From: meetqy Date: Sun, 31 Mar 2024 14:04:27 +0800 Subject: [PATCH 3/4] english --- src/app/[lang]/components/menu/content.tsx | 2 +- src/app/[lang]/poem/[id]/components/twikoo/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/[lang]/components/menu/content.tsx b/src/app/[lang]/components/menu/content.tsx index 84c5fa8e..fabc1a25 100644 --- a/src/app/[lang]/components/menu/content.tsx +++ b/src/app/[lang]/components/menu/content.tsx @@ -37,7 +37,7 @@ export function Content({ dict: Dictionary; lang: Locale; }) { - const pathname = usePathname().replace(lang, ""); + const pathname = usePathname().replace(`/${lang}`, ""); const { data: poemCount } = api.poem.count.useQuery(); const { data: authorCount } = api.author.count.useQuery(); diff --git a/src/app/[lang]/poem/[id]/components/twikoo/index.tsx b/src/app/[lang]/poem/[id]/components/twikoo/index.tsx index bfd16b16..4f8a52dc 100644 --- a/src/app/[lang]/poem/[id]/components/twikoo/index.tsx +++ b/src/app/[lang]/poem/[id]/components/twikoo/index.tsx @@ -6,7 +6,7 @@ import { usePathname } from "next/navigation"; import { type Locale } from "~/dictionaries"; export default function Twikoo({ lang }: { lang: Locale }) { - const pathname = usePathname().replace(/(zh-Hans|zh-Hant)\/?/, ""); + const pathname = usePathname().replace(`/${lang}`, ""); useEffect(() => { // 通过 CDN 引入 twikoo js 文件 From 8247fc2e033ecef0328a1935e1d31e5c32f2a28b Mon Sep 17 00:00:00 2001 From: meetqy Date: Sun, 31 Mar 2024 14:34:16 +0800 Subject: [PATCH 4/4] i18n --- src/app/[lang]/components/menu/content.tsx | 13 ++-- src/components/ui/select.tsx | 2 +- src/dictionaries/en.json | 2 +- src/dictionaries/index.ts | 16 +++-- src/dictionaries/ja.json | 78 ++++++++++++++++++++++ src/dictionaries/ko.json | 78 ++++++++++++++++++++++ src/dictionaries/zh-Hans.json | 2 +- src/dictionaries/zh-Hant.json | 2 +- src/server/api/routers/poem.ts | 2 - src/server/api/utils.tsx | 3 +- 10 files changed, 176 insertions(+), 22 deletions(-) create mode 100644 src/dictionaries/ja.json create mode 100644 src/dictionaries/ko.json diff --git a/src/app/[lang]/components/menu/content.tsx b/src/app/[lang]/components/menu/content.tsx index fabc1a25..21019e72 100644 --- a/src/app/[lang]/components/menu/content.tsx +++ b/src/app/[lang]/components/menu/content.tsx @@ -73,7 +73,7 @@ export function Content({ href: `/${lang}`, }, { - title: dict.menu.auhtor, + title: dict.menu.author, label: {authorCount}, icon: UserRound, variant: /^(\/author)/.test(pathname) ? "default" : "ghost", @@ -93,13 +93,6 @@ export function Content({ variant: /^(\/tag)/.test(pathname) ? "default" : "ghost", href: `/${lang}/tag`, }, - // { - // title: dict.menu.print, - // icon: Printer, - // label: , - // variant: /^(\/print)/.test(pathname) ? "default" : "ghost", - // href: `/tools/print`, - // }, ]} /> @@ -138,7 +131,7 @@ export function Content({

{dict.menu.language}

-
+
diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index 3654faf0..e2323de1 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -118,7 +118,7 @@ const SelectItem = React.forwardRef< import("./zh-Hant.json").then((module) => module.default), "zh-Hans": () => import("./zh-Hans.json").then((module) => module.default), en: () => import("./en.json").then((module) => module.default), + ja: () => import("./ja.json").then((module) => module.default), + ko: () => import("./ko.json").then((module) => module.default), }; export type Locale = (typeof locales)[number]; @@ -14,12 +16,14 @@ export type Locale = (typeof locales)[number]; * 生成多语言 meta hreflang 标签 */ export const getMetaDataAlternates = (suffix: string, lang: Locale) => { + const languages: Record = {}; + + for (const locale of locales) { + languages[locale] = `/${locale}${suffix}`; + } + return { - languages: { - "zh-Hans": `/zh-Hans${suffix}`, - "zh-Hant": `/zh-Hant${suffix}`, - en: `/en${suffix}`, - }, + languages, canonical: `/${lang}${suffix}`, }; }; diff --git a/src/dictionaries/ja.json b/src/dictionaries/ja.json new file mode 100644 index 00000000..ca84fcf7 --- /dev/null +++ b/src/dictionaries/ja.json @@ -0,0 +1,78 @@ +{ + "title": "近代詩学習ウェブサイト", + "description": "aspoem.comは、近代詩学習のためのモダンなウェブサイトであり、サイト全体の検索機能を提供しています。この機能を利用することで、律詩や絶句、詩人たちの作品をより迅速に検索することができます。また、私たちは拼音の表示方法、注釈や白話文の展示方法などを最適化し、詩をより読みやすくしています。さらに、古代詩学の学習をサポートする詩学印刷ツールも提供しています。ぜひ、私たちのウェブサイトの魅力を体験してください!", + "point_keywords": [ + "詩学習", + "古詩学習", + "唐詩300首", + "宋詞300首", + "李白詩集", + "杜甫詩集" + ], + "keywords": [ + "詩学習", + "古詩学習", + "唐詩300首", + "宋詞300首", + "李白詩集", + "杜甫詩集", + "古詩", + "詩", + "詩人統計", + "詩検索", + "詩の拼音", + "詩の注釈", + "詩の翻訳", + "ピンイン" + ], + "menu": { + "poem": "詩", + "author": "詩人", + "ci_pai_ming": "詞牌名", + "tag": "タグ", + "contact": "連絡先", + "theme": "テーマ", + "language": "言語", + "feedback": "フィードバック", + "print": "印刷" + }, + "feedback_desc": "ここでは、ウェブサイトの更新履歴や将来の計画、新機能に関するディスカッションを確認することができます。また、提案や意見を残すこともできます。", + "home": { + "poem": "おすすめ", + "all_poems": "すべての詩" + }, + "poem": { + "title": "詩", + "pinyin": "拼音", + "pinyin_show": "拼音を表示", + "pinyin_hide": "拼音を非表示", + "translation": "翻訳", + "tools": "ツール", + "more": "さらに探索", + "comment": "コメント", + "comment_desc1": "異なる年齢、成長環境、経験には、異なる視点があります。", + "comment_desc2": "従って、標準答えは存在せず、自分が好きなものを選ぶだけでいいです!ぜひ、思いを残してください!👏🏻👏🏻👏🏻", + "report_error": "エラー報告", + "report_error_desc": "もし間違いを見つけた場合は、下にコメントして指摘してください!" + }, + "poem_list": { + "title": "詩のリスト", + "empty": "関連する詩が見つかりませんでした", + "tab_new": "最新", + "tab_improve": "改善待ち" + }, + "author": { + "title": "詩人" + }, + "author_detail": { + "title": "詩人詳細" + }, + "search": { + "placeholder": "詩人、詩、名言を検索", + "empty": "関連する詩が見つかりませんでした" + }, + "pagination": { + "prev": "前へ", + "next": "次へ" + } +} diff --git a/src/dictionaries/ko.json b/src/dictionaries/ko.json new file mode 100644 index 00000000..ea89a74c --- /dev/null +++ b/src/dictionaries/ko.json @@ -0,0 +1,78 @@ +{ + "title": "현대시 학습 웹사이트", + "description": "aspoem.com은 현대화된 시 학습 웹사이트로, 전체 사이트 검색 기능을 제공합니다. 리듀시, 절, 그리고 다양한 시인들의 작품을 더 빠르게 검색할 수 있도록 편리한 전체 사이트 검색 기능을 제공합니다. 또한 우리는 발음 표기, 주석, 평문 등의 표시 방식을 최적화하여 시를 더욱 쉽게 읽을 수 있도록 했습니다. 게다가 고대 시를 공부하기 위한 시인프린터 도구도 제공합니다. 지금 저희 웹사이트의 매력을 경험해보세요!", + "point_keywords": [ + "시 학습", + "고대 시 학습", + "당시 삼백곡", + "송시 삼백곡", + "이백 시 전집", + "두풀 시 전집" + ], + "keywords": [ + "시 학습", + "고대 시 학습", + "당시 삼백곡", + "송시 삼백곡", + "이백 시 전집", + "두풀 시 전집", + "고대 시", + "시", + "시인 통계", + "시 검색", + "시 발음", + "시 주석", + "시 번역", + "pinyin" + ], + "menu": { + "poem": "시", + "author": "시인", + "ci_pai_ming": "사파명", + "tag": "태그", + "contact": "연락처", + "theme": "주제", + "language": "언어", + "feedback": "의견", + "print": "인쇄" + }, + "feedback_desc": "이곳에서 웹사이트의 업데이트 로그, 미래 계획 및 새로운 기능에 대한 토론을 확인할 수 있습니다. 동시에 여러분의 제안과 의견을 남길 수도 있습니다.", + "home": { + "poem": "추천", + "all_poems": "전체 시" + }, + "poem": { + "title": "시", + "pinyin": "발음", + "pinyin_show": "발음 표시", + "pinyin_hide": "발음 숨기기", + "translation": "번역", + "tools": "도구", + "more": "더 많은 탐색", + "comment": "자유롭게 의견을 표현하세요", + "comment_desc1": "다른 나이, 성장 환경, 경험에 따라 다른 시각이 있을 것입니다.", + "comment_desc2": "따라서 표준 답변은 없습니다. 자신이 좋아하는 대로 하세요! 여러분의 생각을 남겨주세요!👏🏻👏🏻👏🏻", + "report_error": "오류 신고", + "report_error_desc": "오류를 발견하신 경우 아래에 의견을 남겨주시면 감사하겠습니다!" + }, + "poem_list": { + "title": "시 목록", + "empty": "관련 시를 찾을 수 없습니다", + "tab_new": "최신", + "tab_improve": "보완 필요" + }, + "author": { + "title": "시인" + }, + "author_detail": { + "title": "시인" + }, + "search": { + "placeholder": "시인, 시, 명구 검색", + "empty": "관련 시를 찾을 수 없습니다" + }, + "pagination": { + "prev": "이전", + "next": "다음" + } +} diff --git a/src/dictionaries/zh-Hans.json b/src/dictionaries/zh-Hans.json index e6ec76a1..1eb823b0 100644 --- a/src/dictionaries/zh-Hans.json +++ b/src/dictionaries/zh-Hans.json @@ -27,7 +27,7 @@ ], "menu": { "poem": "诗词", - "auhtor": "诗人", + "author": "诗人", "ci_pai_ming": "词牌名", "tag": "标签", "contact": "联系方式", diff --git a/src/dictionaries/zh-Hant.json b/src/dictionaries/zh-Hant.json index da222dda..b1887144 100644 --- a/src/dictionaries/zh-Hant.json +++ b/src/dictionaries/zh-Hant.json @@ -27,7 +27,7 @@ ], "menu": { "poem": "詩詞", - "auhtor": "詩人", + "author": "詩人", "ci_pai_ming": "詞牌名", "tag": "標籤", "contact": "聯繫方式", diff --git a/src/server/api/routers/poem.ts b/src/server/api/routers/poem.ts index 3831b032..727a985d 100644 --- a/src/server/api/routers/poem.ts +++ b/src/server/api/routers/poem.ts @@ -323,8 +323,6 @@ export const poemRouter = createTRPCRouter({ } } - console.log(contentArr, connectTagId); - if (connectTagId !== -1) { void ctx.db.poem .update({ diff --git a/src/server/api/utils.tsx b/src/server/api/utils.tsx index 6c2882d7..4362a68e 100644 --- a/src/server/api/utils.tsx +++ b/src/server/api/utils.tsx @@ -1,8 +1,9 @@ import { type Tag, type Poem } from "@prisma/client"; import { mapKeys, pick } from "lodash-es"; import { z } from "zod"; +import { locales } from "~/dictionaries"; -export const LangZod = z.enum(["zh-Hans", "zh-Hant", "en"]).default("zh-Hans"); +export const LangZod = z.enum(locales).default("zh-Hans"); function transform>( res: T,