From beddcdb297757464d8c3f3e24a879eaa34124356 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 11 Jul 2026 01:24:23 +0200 Subject: [PATCH] Improve manga type detection internationalization --- src/features/manga/Manga.constants.ts | 59 ++++++++++++++++++-- src/i18n/locales/en.po | 34 +++++++++-- tools/scripts/manga/generateMangaTypeTags.ts | 12 ++-- 3 files changed, 89 insertions(+), 16 deletions(-) diff --git a/src/features/manga/Manga.constants.ts b/src/features/manga/Manga.constants.ts index f10794f0..653a6130 100644 --- a/src/features/manga/Manga.constants.ts +++ b/src/features/manga/Manga.constants.ts @@ -161,11 +161,60 @@ export const SOURCES_BY_MANGA_TYPE: Record = { // @ts-ignore - see comment // oxlint-disable-next-line no-unused-vars const MANGA_TAG_DESCRIPTORS_BY_MANGA_TYPE: Record = { - [MangaType.MANGA]: [msg`Manga`], - [MangaType.COMIC]: [msg`Comic`], - [MangaType.WEBTOON]: [msg`Webtoon`, msg`Long strip`], - [MangaType.MANHWA]: [msg`Manhwa`, msg`Long strip`], - [MangaType.MANHUA]: [msg`Manhua`, msg`Long strip`], + [MangaType.MANGA]: [ + msg({ + id: 'entry-type-detection-manga', + message: 'Manga', + comment: + 'Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)")', + }), + ], + [MangaType.COMIC]: [ + msg({ + id: 'entry-type-detection-comic', + message: 'Comic', + comment: + 'Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)")', + }), + ], + [MangaType.WEBTOON]: [ + msg({ + id: 'entry-type-detection-webtoon', + message: 'Webtoon', + comment: + 'Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)")', + }), + msg({ + id: 'entry-type-detection-long-strip', + message: 'Long strip', + comment: + 'Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)")', + }), + ], + [MangaType.MANHWA]: [ + msg({ + id: 'entry-type-detection-manhwa', + message: 'Manhwa', + comment: + 'Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)")', + }), + msg({ + id: 'entry-type-detection-long-strip', + message: 'Long strip', + }), + ], + [MangaType.MANHUA]: [ + msg({ + id: 'entry-type-detection-manhua', + message: 'Manhua', + comment: + 'Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)")', + }), + msg({ + id: 'entry-type-detection-long-strip', + message: 'Long strip', + }), + ], }; /** diff --git a/src/i18n/locales/en.po b/src/i18n/locales/en.po index 6917624b..bcb3e82c 100644 --- a/src/i18n/locales/en.po +++ b/src/i18n/locales/en.po @@ -915,8 +915,10 @@ msgstr "Color filter blend mode" msgid "Comfortable grid" msgstr "Comfortable grid" +#. Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)") +#. js-lingui-explicit-id #: src/features/manga/Manga.constants.ts -msgid "Comic" +msgid "entry-type-detection-comic" msgstr "Comic" #: src/base/components/GridLayouts.tsx @@ -2344,8 +2346,10 @@ msgstr "Logged in" msgid "Logging in to {trackerName}…" msgstr "Logging in to {trackerName}…" +#. Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)") +#. js-lingui-explicit-id #: src/features/manga/Manga.constants.ts -msgid "Long strip" +msgid "entry-type-detection-long-strip" msgstr "Long strip" #: src/features/device/screens/DeviceSetting.tsx @@ -2358,13 +2362,18 @@ msgstr "" "UI specific settings that are stored on the server are per device.\n" "This makes it possible to have e.g. different settings on a desktop and a smartphone" -#: src/features/manga/Manga.constants.ts #: src/features/manga/screens/Manga.tsx #: src/features/reader/settings/behaviour/components/ReaderSettingExitMode.tsx #: src/features/tracker/Tracker.constants.ts msgid "Manga" msgstr "Manga" +#. Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)") +#. js-lingui-explicit-id +#: src/features/manga/Manga.constants.ts +msgid "entry-type-detection-manga" +msgstr "Manga" + #: src/features/settings/screens/Appearance.tsx msgid "Manga item width" msgstr "Manga item width" @@ -2373,16 +2382,26 @@ msgstr "Manga item width" msgid "Manga thumbnail as background" msgstr "Manga thumbnail as background" -#: src/features/manga/Manga.constants.ts #: src/features/tracker/Tracker.constants.ts msgid "Manhua" msgstr "Manhua" +#. Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)") +#. js-lingui-explicit-id #: src/features/manga/Manga.constants.ts +msgid "entry-type-detection-manhua" +msgstr "Manhua" + #: src/features/tracker/Tracker.constants.ts msgid "Manhwa" msgstr "Manhwa" +#. Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)") +#. js-lingui-explicit-id +#: src/features/manga/Manga.constants.ts +msgid "entry-type-detection-manhwa" +msgstr "Manhwa" + #: src/features/migration/MigrationManager.ts msgid "Manual migration search for \"{title}\"" msgstr "Manual migration search for \"{title}\"" @@ -4096,11 +4115,16 @@ msgstr "Warning" msgid "Weblate" msgstr "Weblate" -#: src/features/manga/Manga.constants.ts #: src/features/reader/settings/ReaderSettings.constants.tsx msgid "Webtoon" msgstr "Webtoon" +#. Used to detect the type of an entry by using it to check if the genre/tags of an entry includes this string. This is NOT shown to any user. Do NOT include any unnecessary text or characters, this will break the type detection (e.g. "MangaInMyLanguage (Manga)") +#. js-lingui-explicit-id +#: src/features/manga/Manga.constants.ts +msgid "entry-type-detection-webtoon" +msgstr "Webtoon" + #: src/features/settings/screens/About.tsx #: src/features/settings/screens/Settings.tsx #: src/features/settings/screens/WebUISettings.tsx diff --git a/tools/scripts/manga/generateMangaTypeTags.ts b/tools/scripts/manga/generateMangaTypeTags.ts index 83c58ff6..197413cd 100644 --- a/tools/scripts/manga/generateMangaTypeTags.ts +++ b/tools/scripts/manga/generateMangaTypeTags.ts @@ -15,11 +15,11 @@ const outputFilePath = path.join(import.meta.dirname, `../../../${OUTPUT_FILE_PA const localesDirPath = path.join(import.meta.dirname, '../../../src/i18n/locales'); const MANGA_TYPE_TO_MSG_IDS = { - MANGA: ['Manga'], - COMIC: ['Comic'], - WEBTOON: ['Webtoon', 'Long strip'], - MANHWA: ['Manhwa', 'Long strip'], - MANHUA: ['Manhua', 'Long strip'], + MANGA: ['entry-type-detection-manga', 'Manga'], + COMIC: ['entry-type-detection-comic', 'Comic'], + WEBTOON: ['entry-type-detection-webtoon', 'entry-type-detection-long-strip', 'Webtoon', 'Long strip'], + MANHWA: ['entry-type-detection-manhwa', 'entry-type-detection-long-strip', 'Manhwa', 'Long strip'], + MANHUA: ['entry-type-detection-manhua', 'entry-type-detection-long-strip', 'Manhua', 'Long strip'], } as const satisfies Record; type MangaTypeMsgId = (typeof MANGA_TYPE_TO_MSG_IDS)[keyof typeof MANGA_TYPE_TO_MSG_IDS][number]; @@ -64,7 +64,7 @@ const allTranslationsByMsgId = poFiles const translationsByMangaType = Object.fromEntries( Object.entries(MANGA_TYPE_TO_MSG_IDS).map(([mangaType, msgIds]) => [ mangaType, - [...new Set([...msgIds, ...msgIds.flatMap((msgId) => [...(allTranslationsByMsgId.get(msgId) ?? [])])])], + [...new Set([...msgIds.flatMap((msgId) => [...(allTranslationsByMsgId.get(msgId) ?? [])])])], ]), );