mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-19 20:53:35 +02:00
Removed gettext related functions
This commit is contained in:
@@ -32,7 +32,7 @@ class EXTHHeader(object): # {{{
|
||||
self.length, self.num_items = struct.unpack('>LL', raw[4:12])
|
||||
raw = raw[12:]
|
||||
pos = 0
|
||||
self.mi = MetaInformation(_('Unknown'), [_('Unknown')])
|
||||
self.mi = MetaInformation('Unknown', ['Unknown'])
|
||||
self.has_fake_cover = True
|
||||
self.start_offset = None
|
||||
left = self.num_items
|
||||
@@ -67,7 +67,7 @@ class EXTHHeader(object): # {{{
|
||||
if content == b'EBSP':
|
||||
if not self.mi.tags:
|
||||
self.mi.tags = []
|
||||
self.mi.tags.append(_('Sample Book'))
|
||||
self.mi.tags.append('Sample Book')
|
||||
elif idx == 502:
|
||||
# last update time
|
||||
pass
|
||||
@@ -127,7 +127,7 @@ class EXTHHeader(object): # {{{
|
||||
self.mi.authors.append(au)
|
||||
elif idx == 101:
|
||||
self.mi.publisher = clean_xml_chars(self.decode(content).strip())
|
||||
if self.mi.publisher in {'Unknown', _('Unknown')}:
|
||||
if self.mi.publisher in {'Unknown', 'Unknown'}:
|
||||
self.mi.publisher = None
|
||||
elif idx == 103:
|
||||
self.mi.comments = clean_xml_chars(self.decode(content).strip())
|
||||
@@ -194,7 +194,7 @@ class BookHeader(object):
|
||||
if len(raw) <= 16:
|
||||
self.codec = 'cp1252'
|
||||
self.extra_flags = 0
|
||||
self.title = _('Unknown')
|
||||
self.title = 'Unknown'
|
||||
self.language = 'ENGLISH'
|
||||
self.sublanguage = 'NEUTRAL'
|
||||
self.exth_flag, self.exth = 0, None
|
||||
@@ -233,7 +233,7 @@ class BookHeader(object):
|
||||
|
||||
toff, tlen = struct.unpack('>II', raw[0x54:0x5c])
|
||||
tend = toff + tlen
|
||||
self.title = raw[toff:tend] if tend < len(raw) else _('Unknown')
|
||||
self.title = raw[toff:tend] if tend < len(raw) else 'Unknown'
|
||||
langcode = struct.unpack('!L', raw[0x5C:0x60])[0]
|
||||
langid = langcode & 0xFF
|
||||
sublangid = (langcode >> 10) & 0xFF
|
||||
|
||||
@@ -30,10 +30,10 @@ class TopazError(ValueError):
|
||||
class KFXError(ValueError):
|
||||
|
||||
def __init__(self):
|
||||
ValueError.__init__(self, _(
|
||||
'This is an Amazon KFX book. It cannot be processed.'
|
||||
' See {} for information on how to handle KFX books.'
|
||||
).format('https://www.mobileread.com/forums/showthread.php?t=283371'))
|
||||
ValueError.__init__(self, 'This is an Amazon KFX book. It cannot be '
|
||||
'processed. See https://www.mobileread.com/forums/'
|
||||
'showthread.php?t=283371 for information on how '
|
||||
'to handle KFX books.')
|
||||
|
||||
|
||||
class MobiReader(object):
|
||||
@@ -77,7 +77,8 @@ class MobiReader(object):
|
||||
|
||||
raw = stream.read()
|
||||
if raw.startswith(b'TPZ'):
|
||||
raise TopazError(_('This is an Amazon Topaz book. It cannot be processed.'))
|
||||
raise TopazError('This is an Amazon Topaz book. It cannot be '
|
||||
'processed.')
|
||||
if raw.startswith(b'\xeaDRMION\xee'):
|
||||
raise KFXError()
|
||||
|
||||
@@ -642,7 +643,7 @@ class MobiReader(object):
|
||||
def create_opf(self, htmlfile, guide=None, root=None):
|
||||
mi = getattr(self.book_header.exth, 'mi', self.embedded_mi)
|
||||
if mi is None:
|
||||
mi = MetaInformation(self.book_header.title, [_('Unknown')])
|
||||
mi = MetaInformation(self.book_header.title, ['Unknown'])
|
||||
opf = OPFCreator(os.path.dirname(htmlfile), mi)
|
||||
if hasattr(self.book_header.exth, 'cover_offset'):
|
||||
opf.cover = 'images/%05d.jpg' % (self.book_header.exth.cover_offset + 1)
|
||||
|
||||
Reference in New Issue
Block a user