mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix Tweaks help string not being displayed translated
This commit is contained in:
parent
d8fe18acb4
commit
f47cbd7e88
@ -77,8 +77,6 @@ class Tweak(object): # {{{
|
|||||||
translate = _
|
translate = _
|
||||||
self.name = translate(name)
|
self.name = translate(name)
|
||||||
self.doc = doc.strip()
|
self.doc = doc.strip()
|
||||||
if self.doc:
|
|
||||||
self.doc = translate(self.doc)
|
|
||||||
self.doc = ' ' + self.doc
|
self.doc = ' ' + self.doc
|
||||||
self.var_names = var_names
|
self.var_names = var_names
|
||||||
if self.var_names:
|
if self.var_names:
|
||||||
@ -197,14 +195,22 @@ class Tweaks(QAbstractListModel, AdaptSQP): # {{{
|
|||||||
|
|
||||||
def read_tweak(self, lines, pos, defaults, custom):
|
def read_tweak(self, lines, pos, defaults, custom):
|
||||||
name = lines[pos][2:].strip()
|
name = lines[pos][2:].strip()
|
||||||
doc, var_names = [], []
|
doc, stripped_doc, leading, var_names = [], [], [], []
|
||||||
while True:
|
while True:
|
||||||
pos += 1
|
pos += 1
|
||||||
line = lines[pos]
|
line = lines[pos]
|
||||||
if not line.startswith('#'):
|
if not line.startswith('#'):
|
||||||
break
|
break
|
||||||
doc.append(line[1:].rstrip())
|
line = line[1:]
|
||||||
doc = '\n'.join(doc)
|
doc.append(line.rstrip())
|
||||||
|
stripped_doc.append(line.strip())
|
||||||
|
leading.append(line[:len(line) - len(line.lstrip())])
|
||||||
|
translate = _
|
||||||
|
stripped_doc = translate('\n'.join(stripped_doc).strip())
|
||||||
|
final_doc = []
|
||||||
|
for prefix, line in zip(leading, stripped_doc.splitlines()):
|
||||||
|
final_doc.append(prefix + line)
|
||||||
|
doc = '\n'.join(final_doc)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
line = lines[pos]
|
line = lines[pos]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user