![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 137
Karma: 87012
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. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,343
Karma: 27182818
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 | |
|
![]() |
#3 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,718
Karma: 29711016
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. |
|
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,343
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Ah well then I am misremembering.
|
![]() |
![]() |
![]() |
#5 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 137
Karma: 87012
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 | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,443
Karma: 8012886
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. |
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,343
Karma: 27182818
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.
|
![]() |
![]() |
![]() |
#8 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,969
Karma: 75337983
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. |
![]() |
![]() |
![]() |
#9 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 137
Karma: 87012
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%. |
|
![]() |
![]() |
![]() |
#10 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,443
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |