Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 05-03-2021, 02:57 AM   #1
wold
Enthusiast
wold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbit
 
Posts: 27
Karma: 60086
Join Date: Apr 2021
Device: PB Lux 5
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.
wold is offline   Reply With Quote
Old 05-03-2021, 03:58 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 39,205
Karma: 17012288
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.
kovidgoyal is offline   Reply With Quote
Advert
Old 05-03-2021, 04:46 AM   #3
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 17,258
Karma: 19750289
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by kovidgoyal View Post
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.
@kovid - FWIW the "Unknown" author is stored in the authors table:

Click image for larger version

Name:	Authors.jpg
Views:	27
Size:	94.3 KB
ID:	186884

And the books_author_table associates books with the "Unknown" author

Click image for larger version

Name:	books-authors-link.jpg
Views:	24
Size:	61.8 KB
ID:	186887

It's also in the author_sort column of the books table
Click image for larger version

Name:	Books.jpg
Views:	25
Size:	386.1 KB
ID:	186885

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.
BetterRed is offline   Reply With Quote
Old 05-03-2021, 04:58 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 39,205
Karma: 17012288
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Ah well then I am misremembering.
kovidgoyal is offline   Reply With Quote
Old 05-03-2021, 01:56 PM   #5
wold
Enthusiast
wold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbit
 
Posts: 27
Karma: 60086
Join Date: Apr 2021
Device: PB Lux 5
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")
To be honest, this seems best avoided, but knowing it can be done, etc.
wold is offline   Reply With Quote
Advert
Old 05-03-2021, 02:13 PM   #6
chaley
Grumpy old git
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
chaley's Avatar
 
Posts: 9,833
Karma: 3190480
Join Date: Jan 2010
Location: UK
Device: Reader
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.
chaley is offline   Reply With Quote
Old 05-03-2021, 10:39 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 39,205
Karma: 17012288
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.
kovidgoyal is offline   Reply With Quote
Old 05-03-2021, 11:22 PM   #8
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 2,628
Karma: 11430576
Join Date: Oct 2018
Device: Kobo Aura HD
@chaley - just curious, did Authors: Inconnu(e) appear in the Book Details? In English, that line will disappear.
Attached Thumbnails
Click image for larger version

Name:	2021-05-04 00_31_33-Window.png
Views:	25
Size:	55.4 KB
ID:	186911  

Last edited by ownedbycats; 05-03-2021 at 11:33 PM.
ownedbycats is offline   Reply With Quote
Old 05-04-2021, 02:59 AM   #9
wold
Enthusiast
wold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbitwold with a running start, can leap into geosynchronous orbit
 
Posts: 27
Karma: 60086
Join Date: Apr 2021
Device: PB Lux 5
Quote:
Originally Posted by Chaley
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.
Thanks, but no need for it yet. I'll also explore the mentioned gettext route.

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%.
wold is offline   Reply With Quote
Old 05-04-2021, 03:42 AM   #10
chaley
Grumpy old git
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
chaley's Avatar
 
Posts: 9,833
Karma: 3190480
Join Date: Jan 2010
Location: UK
Device: Reader
Quote:
Originally Posted by ownedbycats View Post
@chaley - just curious, did Authors: Inconnu(e) appear in the Book Details? In English, that line will disappear.
When the language is French, "Inconnu(e)" doesn't appear but "Unknown" does. The opposite happens when the language is English.
chaley is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 07:07 PM.


MobileRead.com is a privately owned, operated and funded community.