Fix xgettext barfing on non-ascii in text

This commit is contained in:
Kovid Goyal 2023-11-13 08:11:45 +05:30
parent 88f630cc54
commit 3badcba7b1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -493,45 +493,45 @@ the color of the blinking cursor.</p>
<p>As you make changes to your theme on the left, the changes will be reflected live in this panel.</p> <p>As you make changes to your theme on the left, the changes will be reflected live in this panel.</p>
<p xml:lang="und"> <p xml:lang="und">
{} {Normal}
The most important rule. Sets the foreground and background colors for the \ The most important rule. Sets the foreground and background colors for the \
editor as well as the style of "normal" text, that is, text that does not match any special syntax. editor as well as the style of "normal" text, that is, text that does not match any special syntax.
{} {Visual}
Defines the colors for text selected by the mouse. Defines the colors for text selected by the mouse.
{} {CursorLine}
Defines the color for the line containing the cursor. Defines the color for the line containing the cursor.
{} {LineNr}
Defines the colors for the line numbers on the left. Defines the colors for the line numbers on the left.
{} {MatchParen}
Defines the colors for matching tags in HTML and matching Defines the colors for matching tags in HTML and matching
braces in CSS. braces in CSS.
{} {Function}
Used for highlighting tags in HTML Used for highlighting tags in HTML
{} {Type}
Used for highlighting attributes in HTML Used for highlighting attributes in HTML
{} {Statement}
Tag names in HTML Tag names in HTML
{} {Constant}
Namespace prefixes in XML and constants in CSS Namespace prefixes in XML and constants in CSS
{} {SpecialCharacter}
Nonbreaking\xa0spaces/hyphens in HTML Non{endash}breaking{nbsp}spaces/hyphens in HTML
{} {Error}
Syntax errors such as <this <> Syntax errors such as <this <>
{} {SpellError}
Misspelled words such as <span lang="en">thisword</span> Misspelled words such as <span lang="en">thisword</span>
{} {Comment}
Comments like <!-- this one --> Comments like <!-- this one -->
</p> </p>
@ -588,13 +588,14 @@ class ThemeEditor(Dialog):
from calibre.gui2.tweak_book.editor.text import TextEdit from calibre.gui2.tweak_book.editor.text import TextEdit
self.preview = p = TextEdit(self, expected_geometry=(73, 50)) self.preview = p = TextEdit(self, expected_geometry=(73, 50))
p.load_text(HELP_TEXT.format( t = {x: f'<b>{x}</b>' for x in (
*('<b>%s</b>' % x for x in ( 'Normal', 'Visual', 'CursorLine', 'LineNr', 'MatchParen',
'Normal', 'Visual', 'CursorLine', 'LineNr', 'MatchParen', 'Function', 'Type', 'Statement', 'Constant', 'SpecialCharacter',
'Function', 'Type', 'Statement', 'Constant', 'SpecialCharacter', 'Error', 'SpellError', 'Comment')
'Error', 'SpellError', 'Comment' }
)) t['nbsp'] = '\xa0'
)) t['endash'] = ''
p.load_text(HELP_TEXT.format(**t))
p.setMaximumWidth(p.size_hint.width() + 5) p.setMaximumWidth(p.size_hint.width() + 5)
s.setMinimumWidth(600) s.setMinimumWidth(600)
self.splitter = sp = QSplitter(self) self.splitter = sp = QSplitter(self)