2024-10-07 13:29:25 +02:00
/ *
* Copyright ( C ) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at https : //mozilla.org/MPL/2.0/.
* /
2026-03-11 00:11:29 +01:00
import type { MessageDescriptor } from '@lingui/core' ;
2026-01-10 19:45:02 +01:00
import { msg } from '@lingui/core/macro' ;
2024-10-07 13:35:07 +02:00
import { MangaStatus } from '@/lib/graphql/generated/graphql.ts' ;
2026-03-11 00:11:29 +01:00
import type { MangaAction , MangaIdInfo } from '@/features/manga/Manga.types.ts' ;
import { MangaType } from '@/features/manga/Manga.types.ts' ;
2025-06-28 02:25:49 +02:00
import {
CHAPTER_ACTION_TO_CONFIRMATION_REQUIRED ,
CHAPTER_ACTION_TO_TRANSLATION ,
2025-08-15 22:02:58 +02:00
} from '@/features/chapter/Chapter.constants.ts' ;
2026-03-11 00:11:29 +01:00
import type { GqlMetaHolder } from '@/features/metadata/Metadata.types.ts' ;
2024-12-26 02:47:37 +01:00
2025-07-01 00:37:29 +02:00
export const FALLBACK_MANGA : MangaIdInfo & GqlMetaHolder = { id : - 1 } ;
2024-12-26 02:47:37 +01:00
2026-01-27 23:19:37 +01:00
export const GLOBAL_READER_SETTINGS_MANGA : MangaIdInfo & GqlMetaHolder = { id : - 2 } ;
2024-10-07 13:35:07 +02:00
2024-10-07 13:29:25 +02:00
export const MANGA_COVER_ASPECT_RATIO = '1 / 1.5' ;
2024-10-07 13:35:07 +02:00
2026-01-10 19:45:02 +01:00
export const MANGA_STATUS_TO_TRANSLATION : Record < MangaStatus , MessageDescriptor > = {
[ MangaStatus . Cancelled ] : msg ` Cancelled ` ,
[ MangaStatus . Completed ] : msg ` Completed ` ,
[ MangaStatus . Licensed ] : msg ` Licensed ` ,
[ MangaStatus . Ongoing ] : msg ` Ongoing ` ,
[ MangaStatus . OnHiatus ] : msg ` Hiatus ` ,
[ MangaStatus . PublishingFinished ] : msg ` Publishing finished ` ,
[ MangaStatus . Unknown ] : msg ` Unknown ` ,
2024-10-07 13:35:07 +02:00
} ;
2025-06-28 02:25:49 +02:00
export const MANGA_ACTION_TO_CONFIRMATION_REQUIRED : Record <
MangaAction ,
{ always : boolean ; bulkAction : boolean ; bulkActionCountForce? : number }
> = {
. . . CHAPTER_ACTION_TO_CONFIRMATION_REQUIRED ,
remove_from_library : { always : true , bulkAction : true } ,
change_categories : { always : false , bulkAction : false } ,
migrate : { always : false , bulkAction : false } ,
track : { always : false , bulkAction : false } ,
} ;
2025-05-05 01:46:11 +02:00
export const MANGA_ACTION_TO_TRANSLATION : {
2024-10-07 13:35:07 +02:00
[ key in MangaAction ] : {
action : {
2026-01-10 19:45:02 +01:00
single : MessageDescriptor ;
selected : MessageDescriptor ;
2024-10-07 13:35:07 +02:00
} ;
2026-01-10 19:45:02 +01:00
confirmation? : MessageDescriptor ;
success : MessageDescriptor ;
error : MessageDescriptor ;
2024-10-07 13:35:07 +02:00
} ;
} = {
2025-06-28 02:25:49 +02:00
. . . CHAPTER_ACTION_TO_TRANSLATION ,
2024-10-07 13:35:07 +02:00
remove_from_library : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Remove from the library ` ,
selected : msg ` Remove selected from the library ` ,
2024-10-07 13:35:07 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to remove one entry from your library} other {You are about to remove # entries from your library}} ` ,
success : msg ` {count, plural, one {Removed manga from the library} other {Removed # manga from the library}} ` ,
error : msg ` {count, plural, one {Could not remove manga from the library} other {Could not remove manga from the library}} ` ,
2024-10-07 13:35:07 +02:00
} ,
change_categories : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Change categories ` ,
selected : msg ` Change categories of selected ` ,
2024-10-07 13:35:07 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to change the category of one entry} other {You are about to change the category of # entries}} ` ,
success : msg ` {count, plural, one {Changed categories of manga} other {Changed categories of # manga}} ` ,
error : msg ` {count, plural, one {Could not change the categories of the manga} other {Could not change the categories of the manga}} ` ,
2024-10-07 13:35:07 +02:00
} ,
migrate : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Migrate ` ,
selected : msg ` Migrate ` , // not supported
2024-10-07 13:35:07 +02:00
} ,
2026-01-10 19:45:02 +01:00
success : msg ` Successfully migrated manga ` ,
error : msg ` Could not migrate manga ` ,
2024-10-07 13:35:07 +02:00
} ,
track : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Track ` ,
selected : msg ` Track ` , // not supported
2024-10-07 13:35:07 +02:00
} ,
2026-01-10 19:45:02 +01:00
success : msg ` Tracked manga ` ,
error : msg ` Could not track manga ` ,
2024-10-07 13:35:07 +02:00
} ,
} ;
2024-12-26 17:15:50 +01:00
2025-04-18 00:07:25 +02:00
// source: https://github.com/jobobby04/TachiyomiSY/blob/e0f40fad8c25459980ead51382c238462416f8d2/app/src/main/java/exh/util/MangaType.kt#L93
// last synced: 2025-04-18 00:06
2024-12-26 17:15:50 +01:00
export const SOURCES_BY_MANGA_TYPE : Record < MangaType , string [ ] > = {
[ MangaType . MANGA ] : [ ] ,
2025-04-18 00:07:25 +02:00
[ MangaType . COMIC ] : [
'8muses' ,
'allporncomic' ,
'ciayo comics' ,
'comicextra' ,
'comicpunch' ,
'cyanide' ,
'dilbert' ,
'eggporncomics' ,
'existential comics' ,
'hiveworks comics' ,
'milftoon' ,
'myhentaicomics' ,
'myhentaigallery' ,
'gunnerkrigg' ,
'oglaf' ,
'patch friday' ,
'porncomix' ,
'questionable content' ,
'readcomiconline' ,
'read comics online' ,
'swords comic' ,
'teabeer comics' ,
'xkcd' ,
] ,
2024-12-26 17:15:50 +01:00
[ MangaType . WEBTOON ] : [ 'mangatoon' , 'manmanga' , 'toomics' , 'webcomics' , 'webtoons' , 'webtoon' ] ,
[ MangaType . MANHWA ] : [
'hiperdex' ,
'hmanhwa' ,
'instamanhwa' ,
'manhwa18' ,
'manhwa68' ,
'manhwa365' ,
'manhwahentaime' ,
'manhwamanga' ,
'manhwatop' ,
'manhwa' ,
'manytoon' ,
'manwha' ,
'readmanhwa' ,
'skymanga' ,
'toonily' ,
'webtoonxyz' ,
] ,
[ MangaType . MANHUA ] : [
'1st kiss manhua' ,
'hero manhua' ,
'manhuabox' ,
'manhuaus' ,
'manhuas' ,
'manhuas' ,
'readmanhua' ,
'wuxiaworld' ,
'manhua' ,
] ,
} ;
2026-02-21 21:22:54 +01:00
/ * *
* Lingui extraction markers — DO NOT remove .
* These ` msg ` calls ensure the strings stay in . po files for translation .
* The actual matching data is in { @link MANGA_TAGS_BY_MANGA_TYPE } below .
* /
// @ts-ignore - see comment
2026-03-10 22:28:19 +01:00
// oxlint-disable-next-line no-unused-vars
2026-02-21 21:22:54 +01:00
const MANGA_TAG_DESCRIPTORS_BY_MANGA_TYPE : Record < MangaType , MessageDescriptor [ ] > = {
2026-01-10 19:45:02 +01:00
[ 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 ` ] ,
2024-12-26 17:15:50 +01:00
} ;
2026-02-21 21:22:54 +01:00
/ * *
* All translations of manga type tags across all available locales .
* Used for matching manga genres to detect manga type regardless of source language .
*
* * * IMPORTANT : * *
*
* This is generated by the ` manga:gen-type-tags ` script
* /
export const MANGA_TAGS_BY_MANGA_TYPE : Record < MangaType , string [ ] > = {
2026-03-30 20:34:34 +00:00
[ MangaType . MANGA ] : [ 'Manga' , 'مانجا' , 'مانگا' , 'Mangá' , 'Манга' , 'மங்கா-' , 'Truyện Nhật' ] ,
2026-02-21 21:22:54 +01:00
[ MangaType . COMIC ] : [
'Comic' ,
2026-03-30 20:34:34 +00:00
'قصص مصورة' ,
2026-02-21 21:22:54 +01:00
'کمیک' ,
2026-03-09 00:44:50 +00:00
'קומיקס' ,
'Képregény' ,
2026-02-21 21:22:54 +01:00
'Komik' ,
'Fumetti' ,
'アメコミ' ,
'만화' ,
'Komiks' ,
'Quadrinhos' ,
'Комикс' ,
'காமிக்' ,
'Çizgi roman' ,
'Truyện Hoa Kỳ' ,
'美漫' ,
] ,
[ MangaType . WEBTOON ] : [
'Webtoon' ,
'Long strip' ,
2026-03-30 20:34:34 +00:00
'ويب تون (Webtoon)' ,
2026-02-21 21:22:54 +01:00
'وبتون' ,
'ウェブトゥーン' ,
'웹툰' ,
'В е б -комикс' ,
'வெப்டூன்-' ,
'Вебтун' ,
2026-03-09 00:44:50 +00:00
'Cuộn dọc' ,
2026-02-21 21:22:54 +01:00
'条漫' ,
'條漫' ,
2026-03-30 20:34:34 +00:00
'شريط طولي' ,
2026-02-21 21:22:54 +01:00
'Tira larga' ,
'نوار بلند' ,
'Bande continue' ,
'Függőleges folyamatos' ,
'Strip panjang' ,
'Striscia lunga' ,
'縦読み漫画' ,
'긴 스트립' ,
'Długi pasek' ,
'Tira longa' ,
'Длинная полоска' ,
'நீண்ட துண்டு' ,
'Uzun şerit' ,
] ,
[ MangaType . MANHWA ] : [
'Manhwa' ,
'Long strip' ,
'مانهوا' ,
'韓国マンガ' ,
'만화' ,
'Манхва' ,
'மன்அ்வா' ,
'Truyện Hàn' ,
'韩漫' ,
'韓漫' ,
2026-03-30 20:34:34 +00:00
'شريط طولي' ,
2026-02-21 21:22:54 +01:00
'Tira larga' ,
'نوار بلند' ,
'Bande continue' ,
'Függőleges folyamatos' ,
'Strip panjang' ,
'Striscia lunga' ,
2026-03-09 00:44:50 +00:00
'縦読み漫画' ,
2026-02-21 21:22:54 +01:00
'긴 스트립' ,
'Długi pasek' ,
'Tira longa' ,
'Длинная полоска' ,
'நீண்ட துண்டு' ,
'Uzun şerit' ,
'Cuộn dọc' ,
'条漫' ,
'條漫' ,
] ,
[ MangaType . MANHUA ] : [
'Manhua' ,
'Long strip' ,
'مانها' ,
'漫画' ,
'만화' ,
'Маньхуа' ,
'மன்உவா' ,
'Truyện Trung' ,
'國漫' ,
2026-03-30 20:34:34 +00:00
'شريط طولي' ,
2026-02-21 21:22:54 +01:00
'Tira larga' ,
'نوار بلند' ,
'Bande continue' ,
'Függőleges folyamatos' ,
'Strip panjang' ,
'Striscia lunga' ,
'縦読み漫画' ,
'긴 스트립' ,
'Długi pasek' ,
'Tira longa' ,
'Длинная полоска' ,
'நீண்ட துண்டு' ,
'Uzun şerit' ,
'Cuộn dọc' ,
'条漫' ,
'條漫' ,
] ,
} ;