janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.01k stars 1.28k forks source link

feat: add handling for regional locales #3022

Closed daniel-edwards-iress closed 3 weeks ago

daniel-edwards-iress commented 3 months ago

Issue

The default is to use American-style date formats in calibre-web. I live in Australia which uses a different date format. I have added a custom translation to my local install but this causes a crash if selected when viewing books as the code attempts to locate the "en_AU" translations of the Calibre language names.

The fix

In this code change, we look for the string representation of the locale i.e. en_AU, pt_BR. If no names are returned we look at just the language portion i.e. en_AU -> en, pt_BR -> pt.