From 49294f2b366260379911a2f6a7314cd59b9ee3a4 Mon Sep 17 00:00:00 2001 From: Hocky Yudhiono Date: Fri, 23 Aug 2024 14:11:06 +0800 Subject: [PATCH 1/3] Use auto force english when filename has .en. --- renderer/components/Subtitle/DataStructures.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renderer/components/Subtitle/DataStructures.ts b/renderer/components/Subtitle/DataStructures.ts index a6e8878..055023b 100644 --- a/renderer/components/Subtitle/DataStructures.ts +++ b/renderer/components/Subtitle/DataStructures.ts @@ -159,6 +159,7 @@ export class SubtitleContainer { static async create(filename: string, lang: string, isSimplified: boolean) { if (filename === '') return + const isForcedEnglish = filename.includes('.en.'); const subtitleContainer = new SubtitleContainer(); subtitleContainer.path = filename; @@ -172,7 +173,8 @@ export class SubtitleContainer { entries = parsedSubtitle.content.entries; } - this.createFromArrayEntries(subtitleContainer, entries, lang, isSimplified); + this.createFromArrayEntries(subtitleContainer, entries, + isForcedEnglish ? lang : videoConstants.englishLang, isSimplified); return subtitleContainer; } catch (error) { console.error('Error parsing subtitle:', error); From 43169a52b89d336260e23098d74ec5daab139810 Mon Sep 17 00:00:00 2001 From: Hocky Yudhiono Date: Fri, 23 Aug 2024 14:16:19 +0800 Subject: [PATCH 2/3] Use auto force english when filename has .en. --- renderer/components/Subtitle/DataStructures.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/renderer/components/Subtitle/DataStructures.ts b/renderer/components/Subtitle/DataStructures.ts index 055023b..ed36044 100644 --- a/renderer/components/Subtitle/DataStructures.ts +++ b/renderer/components/Subtitle/DataStructures.ts @@ -174,8 +174,7 @@ export class SubtitleContainer { } this.createFromArrayEntries(subtitleContainer, entries, - isForcedEnglish ? lang : videoConstants.englishLang, isSimplified); - return subtitleContainer; + isForcedEnglish ? videoConstants.englishLang : lang); } catch (error) { console.error('Error parsing subtitle:', error); return null; From 75b65729fbdae5e5e5d9c02a709e2339c12abbc1 Mon Sep 17 00:00:00 2001 From: Hocky Yudhiono Date: Fri, 23 Aug 2024 14:17:13 +0800 Subject: [PATCH 3/3] Use auto force english when filename has .en. --- renderer/components/Subtitle/DataStructures.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/renderer/components/Subtitle/DataStructures.ts b/renderer/components/Subtitle/DataStructures.ts index ed36044..e4e2f0e 100644 --- a/renderer/components/Subtitle/DataStructures.ts +++ b/renderer/components/Subtitle/DataStructures.ts @@ -174,7 +174,8 @@ export class SubtitleContainer { } this.createFromArrayEntries(subtitleContainer, entries, - isForcedEnglish ? videoConstants.englishLang : lang); + isForcedEnglish ? videoConstants.englishLang : lang, isSimplified); + return subtitleContainer; } catch (error) { console.error('Error parsing subtitle:', error); return null;