feat(metadata): read/write book languages instead of hardcoded "en"#130
Merged
phildenhoff merged 3 commits intoJun 15, 2026
Merged
Conversation
The main window starts hidden and is revealed from the frontend once settings hydrate. show() made it visible but never activated the app, so Citadel could launch behind whatever window already had focus. Focus the window right after showing it, mirroring the settings-window pattern. Fixes CDL-16 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Book never read the languages/books_languages_link tables, BookUpdate had no language field, and OPF generation hardcoded <dc:language>en</dc:language> — multilingual libraries were silently mislabeled. - libcalibre: Language entity + queries (canonicalize ISO 639-1→639-3, set_for_book replace/clear, batched + single readers via raw SQL since there's no diesel joinable! for languages). Book.language_codes, BookUpdate.language_codes (Some=replace/empty=clear/None=untouched), BookAdd.language. - OPF emits one <dc:language> per real code (und when none). New Library::regenerate_metadata_opf rebuilds metadata.opf from DB state and runs on both add and update, so the derived OPF stays faithful for every field — not just language. - Tauri: LibraryBook.language_list, BookUpdate DTO.language_list, and ImportableBookMetadata.language now flows into to_book_add (was dropped). - UI: multi-value Languages row on Edit Book (ui TagsInput) backed by src/lib/languages.ts code↔name mapping. Fixes CDL-2 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Resolves the metadata-providers refactor that landed on main: - hardcover-import.ts/.test.ts deleted on main → dropped; the BookUpdate build moved to src/lib/metadata-import.ts (added language_list: null). - EditBook.tsx: took main's metadata-providers version, re-applied the Languages row, form value, and name↔code save mapping.
libcalibre Test Coverage ReportOverall coverage: 81.63% Coverage breakdown available in the artifacts. |
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.
What & why
Booknever read thelanguages/books_languages_linktables,BookUpdatehad no language field, and OPF generation hardcoded<dc:language>en</dc:language>— multilingual libraries were silently mislabeled, a Calibre-compatibility lie.Changes
libcalibre
entities/language.rs+queries/languages.rs:canonicalize_lang_code(ISO 639-1→Calibre 639-3,en→eng),set_for_book(replace / clear / dedupe,item_orderpreserved), batched + single readers (raw SQL — there's no dieseljoinable!forlanguages).Book.language_codes,BookUpdate.language_codes(Some=replace / empty=clear / None=untouched),BookAdd.language.<dc:language>per real code (undwhen none). NewLibrary::regenerate_metadata_opfrebuildsmetadata.opffrom DB state and runs on both add and update, so the derived OPF stays faithful for every field — not just language.Tauri + frontend
LibraryBook.language_list,BookUpdateDTOlanguage_list, andImportableBookMetadata.languagenow flows intoto_book_add(previously parsed then dropped).uiTagsInput) backed bysrc/lib/languages.tscode↔name mapping.Verification
tscclean, vitest green (incl. newlanguages.test.ts), lint/format clean.eng→English, added French, saved, reloaded → persisted; DBeng(0)+fra(1) order-preserved; OPF emitted both codes; removing a chip cleared just that link.Fixes CDL-2
🤖 Generated with Claude Code