Open MikeZeDev opened 1 year ago
website: Comick,
Manga : One Piece.
Manga have no language itself
Fetching chapters bring chapters for all languages
Each chapter get a "lang" property
There are more language available for this manga than the one existing in Haruneko tags at the time of writing :)
When fetching MANGAS :
1) Manga does not have a language per se
Manga language can be inferred from website language tag, providing it is UNIQUE and not "Multilingual". Plugins should then have only one language tag : its either "one language" or "multilingual" tag. Manga constructor should be affected.
2) Manga has language info (unique language) => we just need to set the good tag. Provide a language mapping table in plugin and a fallback just in case. Maybe we need a new "Tags.Language.Unknown"?
3) Manga has more than one language (when fetching said manga). > just set the "multilingual" tag
when fetching CHAPTERS:
1) Chapter has no language defined > use parent "Manga" language. If cases has been covered mangas should always have one.
2) Chapter has one language defined > give it the good tag
3) Chapter has multiple language : > Multi-language tag. I imagine the website API would provide different pages list for different language
There are special cases where external elements (sessions tokens, cookies, account parameters) are affecting content's language.
Such plugins may have language settings (to exclude languages) , custom initialization , a way to switch between languages if possible (for requests). As for tags, website plugin should have Multilingual tag.
Its possible that website use different ID for the same manga in different language, making it two mangas. If its the contrary we should make sure manga id is unique, maybe by adding langage code.
Sheep talked about an interesting case : suppose a website add a langage for a manga (not in another manga entry).
As of now the language and translation group (if present) must be part of the title. This is by design since the title is used as folder name and should be unique for each manga/chapter.
In addition the Tags
can be used to provide such meta information for the UI (maybe for filtering)
e.g.,
const manga = new Manga(plugin, ...);
manga.Tags.push(Tags.Language.English);
manga.Tags.push(Tags.Language.French);
const chapter1 = new Chapter(manga, ...);
chapter1.Tags.push(Tags.Language.English);
const chapter2 = new Chapter(manga, ...);
chapter2.Tags.push(Tags.Language.French);
const chapter3 = new Chapter(manga, ...);
chapter3.Tags.push(...manga.Tags.filter(tag => tag.Category === R.Tags_Language));
Some of the use-cases should already be covered with this existing functionality.
Its good to add language tags to mangas but for now they are not saved, meaning its lost after program is closed.
Some random thoughts on how we could have better language support for medias.
Set a default language for a website plugin . Deduced from website unique language tag or manually?
By default children inherit the language property from their parent (no need to modify already done plugins). May add a default arguments in constructors?
What about Extractors? For now they return only ID and / or title. They should return language too. I think about making them return JSON array
{ id : 1234, title : One Piece, language : en_US }
instead of
{ 1234, "One Piece", en_US }
for clarity. This could help avoid errors because i think further. We may have to extract other things in the future and messing with values order will have disastrous effects.
This could event help in other cases : when you have to return a custom ID in copy/paste decorators, you are forced to rewrite FetchManga to match the rest of the code (think "API"). If extractor value got "id", use it instead of default (pathname or pathname+search according to arguments)
This way is more flexible as we can further expand it with stuff for animes : { audio : jp_JP, subtitles : [])
TLDR : Extractors revamping.
Now there are questions :
What to do with multilingual tag?
Language normalization : website use custom codes or values. Exactly what are we using, when , what to store,, how to we translate ? dictionary? where to put it? and many other questions
UI and settings : Having setting by default for subtitles and audio or per plugin? Dont really have ideas here, i need to think further.