Skip to content

Commit

Permalink
fix: translate default chapter titles
Browse files Browse the repository at this point in the history
  • Loading branch information
po5 committed Apr 27, 2023
1 parent 9ac5335 commit a80a7fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/uosc_shared/lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a80a7fe

Please sign in to comment.