1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-17 00:27:39 +00:00

English Language Updates - V3

This commit is contained in:
Josh O'Brien
2023-01-04 13:30:13 +11:00
parent ce0b3d8d10
commit b3335f6733
13 changed files with 127 additions and 127 deletions

60
cps/helper.py Executable file → Normal file
View File

@@ -94,8 +94,8 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format,
# read settings and append converter task to queue
if ereader_mail:
settings = config.get_mail_settings()
settings['subject'] = _('Send to E-Reader') # pretranslate Subject for e-mail
settings['body'] = _(u'This e-mail has been sent via Calibre-Web.')
settings['subject'] = _('Send to eReader') # pretranslate Subject for Email
settings['body'] = _(u'This Email has been sent via Calibre-Web.')
else:
settings = dict()
link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book.id), escape(book.title)) # prevent xss
@@ -111,30 +111,30 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format,
# Texts are not lazy translated as they are supposed to get send out as is
def send_test_mail(ereader_mail, user_name):
WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web test e-mail'), None, None,
config.get_mail_settings(), ereader_mail, N_(u"Test e-mail"),
_(u'This e-mail has been sent via Calibre-Web.')))
WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web Test Email'), None, None,
config.get_mail_settings(), ereader_mail, N_(u"Test Email"),
_(u'This Email has been sent via Calibre-Web.')))
return
# Send registration email or password reset email, depending on parameter resend (False means welcome email)
def send_registration_mail(e_mail, user_name, default_password, resend=False):
txt = "Hello %s!\r\n" % user_name
txt = "Hi %s!\r\n" % user_name
if not resend:
txt += "Your new account at Calibre-Web has been created. Thanks for joining us!\r\n"
txt += "Please log in to your account using the following information:\r\n"
txt += "User name: %s\r\n" % user_name
txt += "Your account at Calibre-Web has been created.\r\n"
txt += "Please log in using the following information:\r\n"
txt += "Username: %s\r\n" % user_name
txt += "Password: %s\r\n" % default_password
txt += "Don't forget to change your password after first login.\r\n"
txt += "Sincerely\r\n\r\n"
txt += "Your Calibre-Web team"
txt += "Don't forget to change your password after your first login.\r\n"
txt += "Regards,\r\n\r\n"
txt += "Calibre-Web"
WorkerThread.add(None, TaskEmail(
subject=_(u'Get Started with Calibre-Web'),
filepath=None,
attachment=None,
settings=config.get_mail_settings(),
recipient=e_mail,
task_message=N_(u"Registration e-mail for user: %(name)s", name=user_name),
task_message=N_(u"Registration Email for user: %(name)s", name=user_name),
text=txt
))
return
@@ -145,13 +145,13 @@ def check_send_to_ereader_with_converter(formats):
if 'MOBI' in formats and 'EPUB' not in formats:
book_formats.append({'format': 'Epub',
'convert': 1,
'text': _('Convert %(orig)s to %(format)s and send to E-Reader',
'text': _('Convert %(orig)s to %(format)s and send to eReader',
orig='Mobi',
format='Epub')})
if 'AZW3' in formats and 'EPUB' not in formats:
book_formats.append({'format': 'Epub',
'convert': 2,
'text': _('Convert %(orig)s to %(format)s and send to E-Reader',
'text': _('Convert %(orig)s to %(format)s and send to eReader',
orig='Azw3',
format='Epub')})
return book_formats
@@ -159,7 +159,7 @@ def check_send_to_ereader_with_converter(formats):
def check_send_to_ereader(entry):
"""
returns all available book formats for sending to E-Reader
returns all available book formats for sending to eReader
"""
formats = list()
book_formats = list()
@@ -170,19 +170,19 @@ def check_send_to_ereader(entry):
if 'EPUB' in formats:
book_formats.append({'format': 'Epub',
'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Epub')})
'text': _('Send %(format)s to eReader', format='Epub')})
if 'MOBI' in formats:
book_formats.append({'format': 'Mobi',
'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Mobi')})
'text': _('Send %(format)s to eReader', format='Mobi')})
if 'PDF' in formats:
book_formats.append({'format': 'Pdf',
'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Pdf')})
'text': _('Send %(format)s to eReader', format='Pdf')})
if 'AZW' in formats:
book_formats.append({'format': 'Azw',
'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Azw')})
'text': _('Send %(format)s to eReader', format='Azw')})
if config.config_converterpath:
book_formats.extend(check_send_to_ereader_with_converter(formats))
return book_formats
@@ -204,9 +204,9 @@ def check_read_formats(entry):
# Files are processed in the following order/priority:
# 1: If Mobi file is existing, it's directly send to E-Reader email,
# 2: If Epub file is existing, it's converted and send to E-Reader email,
# 3: If Pdf file is existing, it's directly send to E-Reader email
# 1: If Mobi file is existing, it's directly send to eReader email,
# 2: If Epub file is existing, it's converted and send to eReader email,
# 3: If Pdf file is existing, it's directly send to eReader email
def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id):
"""Send email with attachments"""
book = calibre_db.get_book(book_id)
@@ -222,10 +222,10 @@ def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id)
if entry.format.upper() == book_format.upper():
converted_file_name = entry.name + '.' + book_format.lower()
link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title))
email_text = N_(u"%(book)s send to E-Reader", book=link)
WorkerThread.add(user_id, TaskEmail(_(u"Send to E-Reader"), book.path, converted_file_name,
email_text = N_(u"%(book)s send to eReader", book=link)
WorkerThread.add(user_id, TaskEmail(_(u"Send to eReader"), book.path, converted_file_name,
config.get_mail_settings(), ereader_mail,
email_text, _(u'This e-mail has been sent via Calibre-Web.')))
email_text, _(u'This Email has been sent via Calibre-Web.')))
return
return _(u"The requested file could not be read. Maybe wrong permissions?")
@@ -640,8 +640,8 @@ def uniq(inpt):
def check_email(email):
email = valid_email(email)
if ub.session.query(ub.User).filter(func.lower(ub.User.email) == email.lower()).first():
log.error(u"Found an existing account for this e-mail address")
raise Exception(_(u"Found an existing account for this e-mail address"))
log.error(u"Found an existing account for this Email address")
raise Exception(_(u"Found an existing account for this Email address"))
return email
@@ -660,8 +660,8 @@ def valid_email(email):
# Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation
if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$",
email):
log.error(u"Invalid e-mail address format")
raise Exception(_(u"Invalid e-mail address format"))
log.error(u"Invalid Email address format")
raise Exception(_(u"Invalid Email address format"))
return email
# ################################# External interface #################################