Add translations and transliteration support to lyrics - #152
Draft
adaliea wants to merge 2 commits into
Draft
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
composer | cd571e9 | Commit Preview URL | Jul 20 2026, 07:11 AM |
adaliea
force-pushed
the
07-19-add_translations_and_transliteration_support_to_lyrics
branch
from
July 20, 2026 06:53
923ed30 to
3b7bad4
Compare
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Adds a new Languages tab that lets users generate, edit, and import translations and transliterations for lyric lines, with full round-trip support through TTML export/import.
Transliterations show up in the timeline & synced tab (optional!)
What changed?
src/views/languages.tsx) is introduced as a first-class tab between Edit and Sync. On entry it automatically calls the Google Translate API to generate transliterations and English translations for all lyric lines. Results are editable per-line and marked as stale when the source text changes.LanguageProviderabstraction (src/services/language-provider.ts) and agoogleLanguageProviderimplementation (src/services/google-language-provider.ts) handle translation and transliteration requests with concurrency limiting, response caching, and non-Latin script detection/fallback.TransliterationTrack,TranslationTrack,TranslationTracks) are added to the lyric line model.translationsandtransliterationfields are propagated through group templates, instance expansion, and the timeline fill/copy operations.src/views/languages/paste-import-modal.tsx) handles multi-line clipboard pastes into any language field, with automatic blank-line alignment strategies ("preserve", "compact", "manual") and per-line editable mapping before committing.alignTransliterationToWords(src/domain/language/align.ts), which maps dash-separated syllables to split timing slots and space-separated words to canonical source-word boundaries.transliterationfield, a secondary character picker is shown for the romanized text, and both sets of split points are applied together viasplitWordIntoSyllables.L) that switches all displayed word labels to their aligned transliteration equivalents without altering timing data. The toggle state lives inuseTimelineStore.src/utils/ttml.ts) now emitsitunes:keyattributes on<p>elements and writes an<iTunesMetadata>block containing<translations>and<transliterations>sidecars. Timed transliteration words are emitted as individual<span>elements with proportional timing; untimed syllables use single spaces and word boundaries use double spaces.src/utils/lyrics-parsers/ttml-alternates.ts) parses the<iTunesMetadata>block and populatestranslationsandtransliterationon the corresponding lyric lines, including background text variants.global.goToLanguagesis added as Mod+3, and the existing Sync/Timeline/Preview/Export shortcuts shift up by one.languageSourceFingerprintutility produces a stable hash of a line's text and background text, used to detect when generated language content has gone stale.src/domain/language/script-detection.ts) identify non-Latin scripts by Unicode property and map them to BCP 47 language codes for use as transliteration source hints.How to test?
L) and verify that word labels switch to romanized text while timing is unaffected.transliterationfields on the resulting words.translationsandtransliterationfields round-trip correctly, including background text.Why make this change?
Lyric files distributed through platforms like Apple Music carry translations and transliterations alongside the timed text. This feature closes that gap by giving authors a dedicated workflow to generate, review, and manually correct alternate-language content, and by ensuring that content survives the full edit → sync → export → import round-trip in the TTML format.