Add: server localization for chapter lookup

This commit is contained in:
Nicholas Wallace 2025-04-19 23:25:17 -07:00
parent 7e69713683
commit 79fe064c4a
3 changed files with 5 additions and 3 deletions

View File

@ -565,7 +565,7 @@ export default {
this.findingChapters = false this.findingChapters = false
if (data.error) { if (data.error) {
this.asinError = data.error this.asinError = this.$getString(data.stringKey)
} else { } else {
console.log('Chapter data', data) console.log('Chapter data', data)
this.chapterData = data this.chapterData = data

View File

@ -724,6 +724,7 @@
"MessageChapterErrorStartGteDuration": "Invalid start time must be less than audiobook duration", "MessageChapterErrorStartGteDuration": "Invalid start time must be less than audiobook duration",
"MessageChapterErrorStartLtPrev": "Invalid start time must be greater than or equal to previous chapter start time", "MessageChapterErrorStartLtPrev": "Invalid start time must be greater than or equal to previous chapter start time",
"MessageChapterStartIsAfter": "Chapter start is after the end of your audiobook", "MessageChapterStartIsAfter": "Chapter start is after the end of your audiobook",
"MessageChaptersNotFound": "Chapters not found",
"MessageCheckingCron": "Checking cron...", "MessageCheckingCron": "Checking cron...",
"MessageConfirmCloseFeed": "Are you sure you want to close this feed?", "MessageConfirmCloseFeed": "Are you sure you want to close this feed?",
"MessageConfirmDeleteBackup": "Are you sure you want to delete backup for {0}?", "MessageConfirmDeleteBackup": "Are you sure you want to delete backup for {0}?",
@ -780,6 +781,7 @@
"MessageForceReScanDescription": "will scan all files again like a fresh scan. Audio file ID3 tags, OPF files, and text files will be scanned as new.", "MessageForceReScanDescription": "will scan all files again like a fresh scan. Audio file ID3 tags, OPF files, and text files will be scanned as new.",
"MessageImportantNotice": "Important Notice!", "MessageImportantNotice": "Important Notice!",
"MessageInsertChapterBelow": "Insert chapter below", "MessageInsertChapterBelow": "Insert chapter below",
"MessageInvalidAsin": "Invalid ASIN",
"MessageItemsSelected": "{0} items selected", "MessageItemsSelected": "{0} items selected",
"MessageItemsUpdated": "{0} items updated", "MessageItemsUpdated": "{0} items updated",
"MessageJoinUsOn": "Join us on", "MessageJoinUsOn": "Join us on",

View File

@ -108,12 +108,12 @@ class SearchController {
async findChapters(req, res) { async findChapters(req, res) {
const asin = req.query.asin const asin = req.query.asin
if (!isValidASIN(asin.toUpperCase())) { if (!isValidASIN(asin.toUpperCase())) {
return res.json({ error: 'Invalid ASIN' }) return res.json({ error: 'Invalid ASIN', stringKey: 'MessageInvalidAsin' })
} }
const region = (req.query.region || 'us').toLowerCase() const region = (req.query.region || 'us').toLowerCase()
const chapterData = await BookFinder.findChapters(asin, region) const chapterData = await BookFinder.findChapters(asin, region)
if (!chapterData) { if (!chapterData) {
return res.json({ error: 'Chapters not found' }) return res.json({ error: 'Chapters not found', stringKey: 'MessageChaptersNotFound' })
} }
res.json(chapterData) res.json(chapterData)
} }