Improvements:
-
Error subtitles are now provider-agnostic: All user-facing translation error subtitles now dynamically display the actual provider name (Gemini, DeepL, Google Translate, OpenAI, etc.) instead of hardcoded "Gemini" references. A
displayProviderhelper formats provider names for user display (e.g.,deepl→DeepL,googletranslate→Google Translate). TheproviderNameparameter is passed through the error cache and read back when serving cached errors. -
Error subtitles consolidated to single 0→4h entry: All translation error subtitles now use a single SRT entry spanning
00:00:00,000 → 04:00:00,000instead of the previous 3-entry format. This ensures the error message is visible regardless of where the user seeks in the video timeline. -
MODEL_NOT_FOUNDerror type for 404 errors: Added a dedicatedMODEL_NOT_FOUNDerror classification for HTTP 404 errors from translation APIs. When a configured AI model is renamed or deprecated, users now see "Translation Failed: Model Not Found (404)" with actionable guidance to check the model setting, instead of a generic "Resource not found" message. -
SAFETYandPROHIBITED_CONTENTerror handling consolidated: Both error types now produce the same user-facing "Content Filtered" subtitle. Previously they had separate branches with identical output. -
Translation History cards now show rich diagnostics: History cards now display up to 16 new diagnostic fields organized into visually distinct tiers:
- Tier 1 (Critical): ⚠ orange "Secondary: {name}" chip when fallback provider was used, red "429 × N" chip for rate-limit errors, 🔑 blue key rotation tag, red-bordered error type pills (429, MAX_TOKENS, PROHIBITED_CONTENT).
- Tier 2 (Quality/performance): ⚠ orange mismatch chip with missing/recovered counts, "{N} entries" tag, ⏱ duration tag (computed from createdAt → completedAt), 📥 subtitle source tag (SubDL, SubSource, OpenSubtitles V3, Community Subtitles, Wyzie Subs, Subs.ro, Embedded, OpenSubtitles).
- Tier 3 (Config context): Workflow tag (XML/JSON/AI), JSON→XML fallback warning chip, batch count, key rotation mode, Context/Single-batch/Parallel/Streaming tags. Rendered in a dedicated subdued row (smaller font, 70% opacity) to reduce visual clutter.
- All fields are backward-compatible — older history entries without these fields display normally.
-
Translation diagnostics collected on the engine:
TranslationEnginenow initializes atranslationStatsobject in the constructor and accumulates data at all key instrumentation points:translateBatch()(secondary provider fallback, 429/503 retries, key rotation, error type classification, mismatch detection with two-pass and full-batch recovery tracking, JSON→XML fallback),translateSubtitle()(entry count, batch count, parallel batches flag), andtranslateSubtitleSingleBatch()(actual chunk count after auto-splitting). -
Diagnostics bridged from engine to history:
performTranslation()insubtitles.jscapturestranslationEngine.translationStatsafter translation completes and returns it. The.then()handler spreads all stats intoupdateHistory('completed', { ...stats }). On failure, the catch block attaches stats to the error object viaerror.translationStats, and the.catch()handler extracts and saves them — ensuring failed translations retain diagnostic data (e.g., "429 × 5" shows why it failed). -
Subtitle source derived from sourceFileId: History entries now record which subtitle provider was used based on the
sourceFileIdprefix mapping:subdl_→ SubDL,subsource_→ SubSource,v3_→ OpenSubtitles V3,scs_→ Community Subtitles,wyzie_→ Wyzie Subs,subsro_→ Subs.ro,xembed_→ Embedded, default → OpenSubtitles. -
Parallel batch count tracked:
parallelTranslation.jsnow writesengine.translationStats.batchCountafter computing batches, so parallel translation history cards show the correct batch count instead of 0. -
History card UI responsive for mobile: Added
align-items: centerto.history-detailsflex container. At ≤920px, chip/tag font sizes reduce to 0.78rem and gap tightens to 0.35rem. Tier 3 config row uses compact 0.75rem tags.
Bug Fixes:
-
Fixed critical variable shadowing bug causing all standard batched translations to return empty subtitles (introduced in v1.4.60): The v1.4.60 refactor that added Parallel Batches wrapped the standard batched path in an
elseblock and accidentally re-declaredtranslatedEntrieswithconstinside that block, shadowing the outerlet translatedEntries = []. The 454-entry translation loop accumulated results into the inner block-scoped constant — which went out of scope at the closing brace — while the outer variable remained permanently empty.toSRT(translatedEntries)at the end oftranslateSubtitle()always received an empty array, producing a 1-character empty SRT that was cached and served to Stremio, causing "failed to load external subtitles." Streaming partial saves during translation worked correctly (they used the inner variable), so progress was visible in the UI but the final assembled result was always broken. Single-batch mode and parallel batches mode were unaffected (different code paths). Fixed by removing the innerconstdeclaration so the batch loop writes into the outerletas originally intended. -
Fixed
serviceNamelost duringTranslationEngineerror wrapping: WhentranslationEngine.jswrapped batch errors, it copiedtranslationErrorType,statusCode,type,isRetryable, andoriginalErrorfrom the original error but notserviceName. This causederrorProviderto always benullin the error cache, so error subtitles fell back to the generic "API" label instead of showing the actual provider name (e.g., "Gemini", "DeepL"). -
Fixed full-batch mismatch retry not tracking recovered entries: When the full-batch retry path (>30% missing entries) successfully recovered all entries,
translationStats.recoveredEntrieswas not incremented. Only the targeted two-pass recovery path tracked recoveries. Now both paths correctly report recovery counts. -
Fixed
rateLimitErrorscounter only counting first 429/503 detection: TherateLimitErrorsstat was incremented once when a 429/503 was first detected, but not on each subsequent failed retry within the key-rotation loop. The history card's "429 × N" chip now accurately reflects total rate-limit failures including retries. -
Fixed unclassified error types missing from history pills: Error types like
MODEL_NOT_FOUND(404),403, and503were classified byapiErrorHandler.jsbut never pushed totranslationStats.errorTypesbecausetranslateBatch()only tracked429,MAX_TOKENS, andPROHIBITED_CONTENT. Added a catch-all in the final error handler that records anytranslationErrorTypeto the stats array. -
Fixed
displayProviderincorrect capitalization for multi-word providers: The generic first-letter-only capitalizer producedOpenai,Deepseek,Openrouter,Xaiinstead ofOpenAI,DeepSeek,OpenRouter,xAI. Replaced with an explicit lookup table covering all known providers, with the generic capitalizer as fallback for unknown ones. -
Fixed parallel worker engines sharing
translationStatsby reference: Parallel batch workers created viaObject.assign()shared the original engine'stranslationStatsobject reference. Concurrent batches mutating shared counters (e.g.,rateLimitErrors++) was a race condition. Workers now get fresh zeroed stats objects and merge results back to the parent engine's stats after each batch completes. The merge usestry/finallyso diagnostics from failed batches (rate limits, error types) are always preserved — critical since the most useful diagnostics come from batches that fail.
Cleanup:
- Removed ~50 lines of redundant error classification in
performTranslation: The catch block previously had 4 layers of error type detection: (1)translationErrorType, (2)statusCodechecks, (3)error.response.statuschecks, (4) message-string fallbacks. All layers produced identical results sincehandleTranslationError()inapiErrorHandler.jsalready setstranslationErrorTypebefore errors reachperformTranslation. Replaced with a single line:const errorType = error.translationErrorType || 'other'.