From a80a7fea5e26fd0dcaabd38c574caf0290c16a14 Mon Sep 17 00:00:00 2001 From: Eva Date: Thu, 27 Apr 2023 16:13:17 +0200 Subject: [PATCH] fix: translate default chapter titles --- scripts/uosc_shared/lib/utils.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/uosc_shared/lib/utils.lua b/scripts/uosc_shared/lib/utils.lua index f225701b..aaa3d8a5 100644 --- a/scripts/uosc_shared/lib/utils.lua +++ b/scripts/uosc_shared/lib/utils.lua @@ -539,6 +539,10 @@ function normalize_chapters(chapters) table.sort(chapters, function(a, b) return a.time < b.time end) -- Ensure titles for index, chapter in ipairs(chapters) do + local chapter_number = chapter.title and string.match(chapter.title, '^Chapter (%d+)$') + if chapter_number then + chapter.title = t('Chapter %s', tonumber(chapter_number)) + end chapter.title = chapter.title ~= '(unnamed)' and chapter.title ~= '' and chapter.title or t('Chapter %s', index) chapter.lowercase_title = chapter.title:lower() end