From 0c1f459d4e4b92f3d0458e6bd89f6a82d2d70b46 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sun, 18 Oct 2026 01:09:31 +0900 Subject: [PATCH] #428 --- frontend/src/lib/help.ts | 12 ++- frontend/src/lib/prefetchers.ts | 4 + frontend/src/locales/ain-Kana/common.json | 2 +- frontend/src/locales/ain-Kana/errors.json | 25 ++++-- frontend/src/locales/ain-Kana/help.json | 13 ++-- frontend/src/locales/ain-Kana/imports.json | 14 ++-- frontend/src/locales/ain-Kana/shared.json | 86 ++++++++++++++------- frontend/src/locales/ain-Kana/tags.json | 22 +++--- frontend/src/locales/ain-Kana/wiki.json | 17 ++-- frontend/src/pages/help/HelpChangesPage.tsx | 1 + frontend/src/pages/help/HelpDetailPage.tsx | 11 +-- frontend/src/pages/help/HelpDiffPage.tsx | 14 ++-- frontend/src/pages/help/HelpListPage.tsx | 1 + 13 files changed, 133 insertions(+), 89 deletions(-) diff --git a/frontend/src/lib/help.ts b/frontend/src/lib/help.ts index affd2b2..65b0c3a 100644 --- a/frontend/src/lib/help.ts +++ b/frontend/src/lib/help.ts @@ -87,10 +87,10 @@ export const getHelpArticle = async (identifier: string): Promise +): string | null => article?.languages[requestedLanguage] != null ? requestedLanguage - : article?.canonicalLanguage ?? 'ja' + : null export const getHelpEditions = async ( @@ -155,8 +155,7 @@ export const getHelpSearchEntries = async ( language: string, ): Promise => { const { default: search } = await import ('virtual:help/search') - const contentLanguage = search[language] != null ? language : 'ja' - return (search[contentLanguage] ?? []).map (entry => ({ ...entry, language: contentLanguage })) + return (search[language] ?? []).map (entry => ({ ...entry, language })) } @@ -175,14 +174,13 @@ export const getHelpEditionContent = async ( export const getHelpChanges = async (language: string): Promise => { const { default: changes } = await import ('virtual:help/changes') - const contentLanguage = changes[language] != null ? language : 'ja' - return (changes[contentLanguage] ?? []).map (entry => ({ ...entry, language: contentLanguage })) + return (changes[language] ?? []).map (entry => ({ ...entry, language })) } export const getHelpTitleIndex = async (language: string): Promise => { const { default: titles } = await import ('virtual:help/titles') - return titles[language] ?? titles.ja ?? { } + return titles[language] ?? { } } diff --git a/frontend/src/lib/prefetchers.ts b/frontend/src/lib/prefetchers.ts index fabb319..64827ce 100644 --- a/frontend/src/lib/prefetchers.ts +++ b/frontend/src/lib/prefetchers.ts @@ -50,6 +50,8 @@ const prefetchHelpShow: Prefetcher = async (qc, url, locale) => { queryFn: () => getHelpArticle (identifier), staleTime: Infinity }) const language = resolveHelpLanguage (article, localeLanguage (locale)) + if (language == null) + return const edition = url.searchParams.get ('edition') ?? article?.languages[language]?.currentEdition if (edition == null) return @@ -84,6 +86,8 @@ const prefetchHelpDiff: Prefetcher = async (qc, url, locale) => { queryFn: () => getHelpArticle (identifier), staleTime: Infinity }) const language = resolveHelpLanguage (article, localeLanguage (locale)) + if (language == null) + return await qc.prefetchQuery ({ queryKey: helpKeys.diff (identifier, language, from, to), queryFn: () => getHelpDiff (identifier, language, from, to), diff --git a/frontend/src/locales/ain-Kana/common.json b/frontend/src/locales/ain-Kana/common.json index a8a508b..8fdb166 100644 --- a/frontend/src/locales/ain-Kana/common.json +++ b/frontend/src/locales/ain-Kana/common.json @@ -10,7 +10,7 @@ "meme": "MEME", "character": "イノカ", "general": "ウサ オルㇱペ", - "material": "チカㇻペ", + "material": "アカㇻペ", "meta": "タㇰ オルㇱペ タㇰ", "nico": "ニコニコ タㇰ" }, "pagination": { "label": "ソㇱ", diff --git a/frontend/src/locales/ain-Kana/errors.json b/frontend/src/locales/ain-Kana/errors.json index db3c030..6c27cac 100644 --- a/frontend/src/locales/ain-Kana/errors.json +++ b/frontend/src/locales/ain-Kana/errors.json @@ -1,8 +1,17 @@ -{ - "_untranslated": ["*"], - "403": { "message": "権限ないよ(笑)", "right": "帰れ!", "left": "帰れ!" }, - "404": { "message": "ページないよ(笑)", "right": "帰れ!", "left": "帰れ!" }, - "500": { "message": "鯖でエラー出たって(嘲笑)", "right": "管理人に", "left": "聯絡を!" }, - "503": { "message": "鯖死んでるよ(泣)", "right": "管理人に", "left": "聯絡を!" }, - "imageAlt": "逃げたギター" -} +{ "403": { + "message": "エエイワンケ エアイカㇷ゚", + "right": "ホㇱピ ヤン!", + "left": "ホㇱピ ヤン!" }, + "404": { + "message": "タン ソㇱ イサㇺ", + "right": "ホㇱピ ヤン!", + "left": "ホㇱピ ヤン!" }, + "500": { + "message": "サーバー オㇿ ハイタ アン", + "right": "カンリニン ウン", + "left": "エイェ ヤン!" }, + "503": { + "message": "サーバー アㇱカイ ソモ キ", + "right": "カンリニン ウン", + "left": "エイェ ヤン!" }, + "imageAlt": "キタ イクヨ" } diff --git a/frontend/src/locales/ain-Kana/help.json b/frontend/src/locales/ain-Kana/help.json index 7499260..27aebee 100644 --- a/frontend/src/locales/ain-Kana/help.json +++ b/frontend/src/locales/ain-Kana/help.json @@ -1,6 +1,7 @@ -{ - "_untranslated": ["*"], - "title": "ヘルプ", "search": "ヘルプ検索", "history": "ヘルプ改定履歴", - "effectiveSince": "有効開始年月日", "empty": "該当する記事がありません.", - "diffTitle": "ヘルプ 差分: {{title}}", "articleTitle": "{{title}} ヘルプ" -} +{ "title": "ヤイカオパㇱ", + "search": "ヤイカオパㇱ イフナラ", + "history": "ヤイカオパㇱ アシㇼ カㇻ フㇱコアンペ", + "effectiveSince": "アㇱカイ ヘㇻパ ト", + "empty": "イフナラ ワ ネ ペ イサㇺ。", + "diffTitle": "ヤイカオパㇱ ウシンナイペ:{{title}}", + "articleTitle": "{{title}} ヤイカオパㇱ" } diff --git a/frontend/src/locales/ain-Kana/imports.json b/frontend/src/locales/ain-Kana/imports.json index 9b0cc54..3156ef9 100644 --- a/frontend/src/locales/ain-Kana/imports.json +++ b/frontend/src/locales/ain-Kana/imports.json @@ -1,7 +1,7 @@ -{ - "_untranslated": ["*"], - "status": { - "ready": "登録可能", "error": "登録不可", "warning": "警告", - "skipped": "スキップ", "created": "登録済み", "failed": "登録失敗" - } -} +{ "status": { + "ready": "アオ エアㇱカイ", + "error": "アオ エアイカㇷ゚", + "warning": "イパㇰカㇱヌ", + "skipped": "スキップ", + "created": "アオ オケレ", + "failed": "アオ カ エアイカㇷ゚" } } diff --git a/frontend/src/locales/ain-Kana/shared.json b/frontend/src/locales/ain-Kana/shared.json index ea952fc..1528b9a 100644 --- a/frontend/src/locales/ain-Kana/shared.json +++ b/frontend/src/locales/ain-Kana/shared.json @@ -1,30 +1,60 @@ -{ - "_untranslated": ["*"], - "labels": { - "title": "タイトル", "content": "内容", "body": "本文", - "lastUpdated": "最終更新", "thumbnail": "サムネール", - "noThumbnail": "サムネイルなし", "thumbnailMissing": "サムネールなし", - "parentPosts": "親投稿", "duration": "動画時間", "platform": "プラットフォーム", - "code": "コード", "information": "情報", "relations": "関聯", - "uploadedBy": "耕作者: ", "uploadedAt": "耕作日時: ", "link": "リンク: ", - "originalPostedAt": "オリジナルの投稿日時: ", "originalCreatedAt": "オリジナルの作成日時", - "brand": "ぼざクリ タグ広場", "since": "以降", "before": "より前", - "tagSearch": "タグ検索...", "hideTags": "▲▲▲ タグ一覧を閉じる ▲▲▲", - "showTags": "▼▼▼ タグ一覧を表示 ▼▼▼", - "resultsCount": "{{count}} 件", "menu": "メニュー", "anonymous": "名もなきニジラー", - "bot": "bot操作", "deprecatedSuffix": "(廃止)", "development": "開発モード" - }, +{ "labels": { + "title": "レ", + "content": "オルㇱペ", + "body": "ヌイェㇷ゚", + "lastUpdated": "イヨッタ アシㇼ アカㇻ ト", + "thumbnail": "ポン ノカ", + "noThumbnail": "ポン ノカ イサㇺ", + "thumbnailMissing": "ポン ノカ イサㇺ", + "parentPosts": "オナ アオ ペ", + "duration": "チモイェノカ トキ", + "platform": "プラットフォーム", + "code": "コード", + "information": "アスㇽソㇱ", + "relations": "ウコテㇷ゚", + "uploadedBy": "カㇻ クㇽ:", + "uploadedAt": "アカㇻ ト:", + "link": "ウコテㇷ゚:", + "originalPostedAt": "ホㇱキ アオ ト:", + "originalCreatedAt": "ホㇱキ アカㇻ ト:", + "brand": "ポチ チャ ロㇰ シクヌㇷ゚ イキㇼ チセ", + "since": "オㇿ ワノ", + "before": "エトコ ウン", + "tagSearch": "タㇰ イフナラ…", + "hideTags": "▲▲▲ タㇰ ソモ ヌカㇻ ▲▲▲", + "showTags": "▼▼▼ タㇰ ヌカㇻ ▼▼▼", + "resultsCount": "{{count}} ペ", + "menu": "メニュー", + "anonymous": "レサㇰ ユㇰ ニチカ ウタㇻ", + "bot": "bot カㇻ", + "deprecatedSuffix": "(エイワンケ ソモ エアㇱカイ)", + "development": "カㇻ コㇿ アン シㇼキ" }, "actions": { - "update": "更新", "edit": "編輯", "add": "追加", "reset": "リセット", - "cancel": "取消", "retry": "再試行", "skip": "スキップ", "random": "ランダム", - "old": "< 古", "new": "新 >", "oldest": "(最古)", "latest": "(最新)", - "diff": "差分", "restore": "復元", "show": "表示" - }, + "update": "アシㇼ カㇻ", + "edit": "イヌイェㇷ゚", + "add": "アオ", + "reset": "ホㇱキ シㇼ ウン ホㇱピ", + "cancel": "ソモ キ", + "retry": "スイ キ", + "skip": "スキップ", + "random": "ランダム", + "old": "< フㇱコ", + "new": "アシㇼ >", + "oldest": "(イヨッタ フㇱコ)", + "latest": "(イヨッタ アシㇼ)", + "diff": "ウシンナイペ", + "restore": "ホㇱピ", + "show": "ヌカㇻ" }, "messages": { - "loading": "読み込み中...", "loadingEllipsis": "読込中……", - "updated": "更新しました.", "updateFailed": "更新失敗", "failed": "失敗……", - "checkInput": "入力を確認してください.", "checkInputModern": "入力を確認してください。", - "checkInputContent": "入力内容を確認してください.", "reviewInput": "入力を見直してください.", - "postSuccess": "投稿成功!", "postFailed": "投稿失敗", "resetChanges": "変更をリセットしますか?" - } -} + "loading": "アウㇰ コㇿ アン…", + "loadingEllipsis": "アウㇰ コㇿ アン……", + "updated": "アシㇼ アカㇻ!", + "updateFailed": "アシㇼ カㇻ カ エアイカㇷ゚", + "failed": "エアイカㇷ゚……", + "checkInput": "エヌイェㇷ゚ エヌカㇻ ヤン!", + "checkInputModern": "エヌイェㇷ゚ エヌカㇻ ヤン。", + "checkInputContent": "エヌイェ オルㇱペ エヌカㇻ ヤン!", + "reviewInput": "エヌイェㇷ゚ スイ エヌカㇻ ヤン!", + "postSuccess": "アオ オケレ!", + "postFailed": "アオ カ エアイカㇷ゚", + "resetChanges": "エヌイェㇷ゚ ホㇱキ シㇼ ウン ホㇱピ ヤ?" } } diff --git a/frontend/src/locales/ain-Kana/tags.json b/frontend/src/locales/ain-Kana/tags.json index 057f788..5d9b774 100644 --- a/frontend/src/locales/ain-Kana/tags.json +++ b/frontend/src/locales/ain-Kana/tags.json @@ -1,13 +1,11 @@ -{ "_untranslated": ["name", "postCount", "firstRecordedAt", "definitionUpdatedAt", "aliases", - "parents", "firstRecordedColumn", "updatedAt", "empty"], - "title": "タㇰ", - "name": "名前", - "postCount": "広場の投稿数", - "firstRecordedAt": "はじめて記載された日時", - "definitionUpdatedAt": "定義の更新日時", - "aliases": "別名", - "parents": "上位タグ", - "firstRecordedColumn": "最初の記載日時", - "updatedAt": "更新日時", +{ "title": "タㇰ", + "name": "レ", + "postCount": "ミンタㇻ アオ ペ チピㇱキㇷ゚", + "firstRecordedAt": "ホㇱキ アヌイェ ト ヘㇺ トキ", + "definitionUpdatedAt": "イタㇰ アシㇼ アカㇻ ト ヘㇺ トキ", + "aliases": "モㇱマ レ", + "parents": "サパ タㇰ", + "firstRecordedColumn": "ホㇱキ アヌイェ ト", + "updatedAt": "アシㇼ アカㇻ ト", "history": "フㇱコアンペ", - "empty": "結果ないよ(笑)" } + "empty": "イフナラ ワ ネ ペ イサㇺ" } diff --git a/frontend/src/locales/ain-Kana/wiki.json b/frontend/src/locales/ain-Kana/wiki.json index 1a3798c..7dc86ab 100644 --- a/frontend/src/locales/ain-Kana/wiki.json +++ b/frontend/src/locales/ain-Kana/wiki.json @@ -1,9 +1,8 @@ -{ - "_untranslated": ["*"], - "newPage": "新規 Wiki ページ", - "editPage": "Wiki ページを編輯", - "history": "Wiki 変更履歴", - "historyHeading": "Wiki 履歴", "change": "変更", "dateTime": "日時", - "diffTitle": "Wiki 差分: {{title}}", - "missingPage": "このページは存在しません。[新規作成してください]({{url}})。" -} +{ "newPage": "アシㇼ ウィキ ソㇱ", + "editPage": "ウィキ ソㇱ イヌイェㇷ゚", + "history": "ウィキ アシㇼ カㇻ フㇱコアンペ", + "historyHeading": "ウィキ フㇱコアンペ", + "change": "アシㇼ カㇻ", + "dateTime": "ト ヘㇺ トキ", + "diffTitle": "ウィキ ウシンナイペ:{{title}}", + "missingPage": "タン ソㇱ イサㇺ。[アシㇼ カㇻ ヤン]({{url}})。" } diff --git a/frontend/src/pages/help/HelpChangesPage.tsx b/frontend/src/pages/help/HelpChangesPage.tsx index c06748f..df6092c 100644 --- a/frontend/src/pages/help/HelpChangesPage.tsx +++ b/frontend/src/pages/help/HelpChangesPage.tsx @@ -34,6 +34,7 @@ const HelpChangesPage: FC = () => { const { data: changes = [], isLoading, error } = useQuery ({ queryKey: helpKeys.changes (language), queryFn: () => getHelpChanges (language), + select: entries => entries.filter (entry => entry.language === language), staleTime: Infinity }) const results = useMemo (() => identifier diff --git a/frontend/src/pages/help/HelpDetailPage.tsx b/frontend/src/pages/help/HelpDetailPage.tsx index 256c1e9..038ae44 100644 --- a/frontend/src/pages/help/HelpDetailPage.tsx +++ b/frontend/src/pages/help/HelpDetailPage.tsx @@ -31,12 +31,13 @@ const HelpDetailPage: FC = () => { queryFn: () => getHelpArticle (identifier), staleTime: Infinity }) - const language = resolveHelpLanguage (article, localeLanguage (locale)) + const requestedLanguage = localeLanguage (locale) + const language = resolveHelpLanguage (article, requestedLanguage) const query = new URLSearchParams (location.search) const requestedEdition = query.get ('edition') - const languageMeta = article?.languages[language] + const languageMeta = language == null ? null : article?.languages[language] const edition = requestedEdition ?? languageMeta?.currentEdition const editionInfo = parseHelpEdition (edition ?? '') @@ -53,8 +54,8 @@ const HelpDetailPage: FC = () => { const { data: current, isSuccess, isError } = useQuery ({ enabled: edition != null && editionInfo != null && editions.includes (edition), - queryKey: helpKeys.edition (identifier, language, edition ?? ''), - queryFn: () => getHelpEditionContent (identifier, language, edition ?? ''), + queryKey: helpKeys.edition (identifier, requestedLanguage, edition ?? ''), + queryFn: () => getHelpEditionContent (identifier, requestedLanguage, edition ?? ''), staleTime: Infinity }) if (!articleLoading @@ -103,7 +104,7 @@ const HelpDetailPage: FC = () => { : label ('shared:actions.latest')} )} -
+
{Content ? :
{label ('common:loading')}
}
) diff --git a/frontend/src/pages/help/HelpDiffPage.tsx b/frontend/src/pages/help/HelpDiffPage.tsx index 09ca2b5..d41f2fe 100644 --- a/frontend/src/pages/help/HelpDiffPage.tsx +++ b/frontend/src/pages/help/HelpDiffPage.tsx @@ -30,17 +30,19 @@ const HelpDiffPage: FC = () => { queryKey: helpKeys.article (identifier), queryFn: () => getHelpArticle (identifier), staleTime: Infinity }) - const language = resolveHelpLanguage (article, localeLanguage (locale)) + const requestedLanguage = localeLanguage (locale) + const language = resolveHelpLanguage (article, requestedLanguage) const validParams = Boolean (identifier && from && to) && searchParams.getAll ('from').length === 1 && searchParams.getAll ('to').length === 1 const { data: diff, isLoading, isError } = useQuery ({ - enabled: validParams && article != null, - queryKey: helpKeys.diff (identifier, language, from, to), - queryFn: () => getHelpDiff (identifier, language, from, to), + enabled: validParams && language != null, + queryKey: helpKeys.diff (identifier, requestedLanguage, from, to), + queryFn: () => getHelpDiff (identifier, requestedLanguage, from, to), staleTime: Infinity }) - if (!(validParams) || isError || (!(isLoading) && diff == null)) + if (!(validParams) || (article != null && language == null) + || isError || (!(isLoading) && diff == null)) return const title = `${ diff?.to.title ?? identifier } (${ from } → ${ to })` @@ -65,7 +67,7 @@ const HelpDiffPage: FC = () => { {diff.to.title} ({to}) -
+	      
 		
 		  {diff.lines.map ((line, index) => {
 		    const colour = cn (
diff --git a/frontend/src/pages/help/HelpListPage.tsx b/frontend/src/pages/help/HelpListPage.tsx
index 48a5a1c..52360e4 100644
--- a/frontend/src/pages/help/HelpListPage.tsx
+++ b/frontend/src/pages/help/HelpListPage.tsx
@@ -56,6 +56,7 @@ const HelpSearchPage: FC = () => {
   const { data: entries = [], isLoading: loading, error } = useQuery ({
       queryKey: helpKeys.index (language),
       queryFn: () => getHelpSearchEntries (language),
+      select: entries => entries.filter (entry => entry.language === language),
       staleTime: Infinity })
 
   useEffect (() => {