05-03-2021, 02:57 AM | #1 |
Zealot
Posts: 120
Karma: 87007
Join Date: Apr 2021
Device: Lux 5, Libra 2, PRS-T2N
|
Missing author substitution ('Unknown') handling in other languages
Hi, when a file (epub, etc) misses an author field, Calibre substitutes the missing value with "Unknown".
This value is stored as such in the database. 1) How is this database entry handled for non-english languages? For, say, German locale, is the database value also stored as "Unknown" and afterwards translated using gettext for the GUI? Or is it stored as "Unbekannt" and never translated? The context is dealing with an external device DB, where authors can be NULL. |
05-03-2021, 03:58 AM | #2 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The calibre database is normalised. So author values are not stored directly on book records, instead there is a separate authors table and a link table to join it with the books table. Unknown authors are never stored in the authors table as far as I remember.
|
Advert | |
|
05-03-2021, 04:46 AM | #3 | |
null operator (he/him)
Posts: 20,583
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
And the books_author_table associates books with the "Unknown" author It's also in the author_sort column of the books table In case I'd done something strange with my Test library, I also checked my Books library - it's the same. Moderator Notice @wold - Moved out of Development. See the sticky at top of that sub-forum. BR Last edited by BetterRed; 05-03-2021 at 05:00 AM. |
|
05-03-2021, 04:58 AM | #4 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Ah well then I am misremembering.
|
05-03-2021, 01:56 PM | #5 |
Zealot
Posts: 120
Karma: 87007
Join Date: Apr 2021
Device: Lux 5, Libra 2, PRS-T2N
|
Thanks. Confirmed this in part (sorry): other locales do store their own translation.
What mattered in that case is the follow-up question: 2) to retrieve the "Unknown" equivalent for other locales, could one use gettext substitution, like below? Code:
authorname = _("Unknown") |
Advert | |
|
05-03-2021, 02:13 PM | #6 |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I switched my language to French then added a new empty book. I was offered the author name "Inconnu(e)". After adding the book that author appeared in the authors table. I draw from this test that there is no constant name for an unknown author. It depends on calibre's language when the name was used, for example when adding books.
I could add a template function that returns the value of an (English) string in the current language locale, but I am not yet convinced that it would be useful. |
05-03-2021, 10:39 PM | #7 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes _('Unknown') will give you the value of an unknown author in the current interface language.
|
05-03-2021, 11:22 PM | #8 |
Custom User Title
Posts: 8,644
Karma: 61234567
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
@chaley - just curious, did Authors: Inconnu(e) appear in the Book Details? In English, that line will disappear.
Last edited by ownedbycats; 05-03-2021 at 11:33 PM. |
05-04-2021, 02:59 AM | #9 | |
Zealot
Posts: 120
Karma: 87007
Join Date: Apr 2021
Device: Lux 5, Libra 2, PRS-T2N
|
Quote:
To clarify, this involved matching 'exotic formats' on the device with calibre. The device uses the filename as title. However, given calibre appends the author to the filename, it can't be easily matched back to calibre's title. Regex substitution works, but I forgot about localization of 'Unknown'. For now the part is removed, as it's not vital. This also concerns possible future utils. Not wanting to get stuck at 99%. |
|
05-04-2021, 03:42 AM | #10 |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Author Unknown | Solo1959 | Calibre | 5 | 12-11-2020 06:49 PM |
Bug: Automater substitution of "and" with "&" in author field | mikebw | Library Management | 2 | 04-15-2019 03:39 AM |
Default handling of two part last names in author sort? | karyan | Library Management | 1 | 03-19-2016 05:19 PM |
unknown author on device | Atatash | Library Management | 0 | 06-23-2013 08:15 AM |
Author Unknown | ejandem | Barnes & Noble NOOK | 6 | 11-13-2011 01:56 PM |