View Issue Details

IDProjectCategoryView StatusLast Update
0016455ScribusTranslationpublic2021-02-04 05:29
Reporterbubu Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.5.7.svn 
Target VersionFixed in Version1.5.7.svn 
Summary0016455: Clean up HTML header code from translation segments
DescriptionAs a translator in this patch I propose to remove nasty HTML header codes from translation segments like: <html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style="font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">...

This is partial fix for 0013264:

1) Fills and Colors dialog: I tested the solution, it works well.
2) Imposition plugin: Plugin is disabled and I find that it is unbuildable. I made same correction as above, but I can't test it. Maybe it would be better to exclude the cribus/plugins/imposition/impositionbase.ui from translation, but I don't know how to do this.

In 0013264 I reported two other occurrence in Python permit dialog ("Confirm to run unsafe script") but I can't cause the dialog to appear...
TagsNo tags attached.
PatchNo

Relationships

related to 0013264 new Full HTML markup in translations strings for word wrapping (in trunk) 

Activities

bubu

2021-01-31 20:03

reporter  

0001-Clean-up-HTML-header-code-from-translation-segments.patch (8,332 bytes)
From 75371acc11abc9c3ccee0128ad048cf75a93c7b1 Mon Sep 17 00:00:00 2001
Message-Id: <75371acc11abc9c3ccee0128ad048cf75a93c7b1.1612118818.git.bubu@ujevangelizacio.hu>
From: =?UTF-8?q?Gyuris=20Gell=C3=A9rt?= <bubu@ujevangelizacio.hu>
Date: Sun, 31 Jan 2021 19:46:35 +0100
Subject: [PATCH] Clean up HTML header code from translation segments

---
 scribus/plugins/imposition/impositionbase.ui  |  5 +-
 .../plugins/imposition/impositionplugin.cpp   |  5 +-
 scribus/ui/colorsandfills.cpp                 |  1 +
 scribus/ui/colorsandfillsbase.ui              | 55 ++++++++-----------
 4 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/scribus/plugins/imposition/impositionbase.ui b/scribus/plugins/imposition/impositionbase.ui
index c1c69719d..bcb5e950f 100644
--- a/scribus/plugins/imposition/impositionbase.ui
+++ b/scribus/plugins/imposition/impositionbase.ui
@@ -322,10 +322,7 @@
                 <item>
                  <widget class="QLineEdit" name="inpPages" >
                   <property name="toolTip" >
-                   <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
-p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Separate pages with a comma, ranges with a hyphen, e.g. 1,4,9-11 to get pages 1,4,9,10,11.&lt;/p>&lt;/body>&lt;/html></string>
+                   <string>Separate pages with a comma, ranges with a hyphen, e.g. 1,4,9-11 to get pages 1,4,9,10,11.</string>
                   </property>
                  </widget>
                 </item>
diff --git a/scribus/plugins/imposition/impositionplugin.cpp b/scribus/plugins/imposition/impositionplugin.cpp
index 58857b0b1..7d76d41a0 100644
--- a/scribus/plugins/imposition/impositionplugin.cpp
+++ b/scribus/plugins/imposition/impositionplugin.cpp
@@ -29,7 +29,10 @@ ImpositionPlugin::ImpositionPlugin() : ScActionPlugin()
 	languageChange();
 }
 
-ImpositionPlugin::~ImpositionPlugin() {};
+ImpositionPlugin::~ImpositionPlugin() {
+	setupUi(this);
+	inpPages->setToolTip("<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">p, li { white-space: pre-wrap; }</style></head><body style=\"font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\"><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">" + tr("Separate pages with a comma, ranges with a hyphen, e.g. 1,4,9-11 to get pages 1,4,9,10,11.") + "</p></body></html>");
+};
 
 void ImpositionPlugin::languageChange()
 {
diff --git a/scribus/ui/colorsandfills.cpp b/scribus/ui/colorsandfills.cpp
index 0e982a666..933ee4b9b 100644
--- a/scribus/ui/colorsandfills.cpp
+++ b/scribus/ui/colorsandfills.cpp
@@ -79,6 +79,7 @@ ColorsAndFillsDialog::ColorsAndFillsDialog(QWidget* parent, QHash<QString, VGrad
 	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
 	dataTree->setContextMenuPolicy(Qt::CustomContextMenu);
 	dataTree->setIconSize(QSize(60, 48));
+	dataTree->setToolTip("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\"><html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">p, li { white-space: pre-wrap; }</style></head><body style=\"font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;\"><table border=\"0\" style=\"-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;\"><tr><td style=\"border: none;\"><p style=\"margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">" + tr( "If color management is enabled, an exclamation mark indicates that the color may be outside of the color gamut of the current printer profile selected. What this means is the color may not print exactly as indicated on screen. Spot colors are indicated by a red circle. More hints about gamut warnings are in the online help under Color Management. Registration colors will have a registration mark next to the color. Use Registration only for printers marks and crop marks." ) + "</p></td></tr></table></body></html>");
 	colorItems = new QTreeWidgetItem(dataTree);
 	colorItems->setText(0, tr("Solid Colors"));
 	gradientItems = new QTreeWidgetItem(dataTree);
diff --git a/scribus/ui/colorsandfillsbase.ui b/scribus/ui/colorsandfillsbase.ui
index db4360546..00c5d8acc 100644
--- a/scribus/ui/colorsandfillsbase.ui
+++ b/scribus/ui/colorsandfillsbase.ui
@@ -17,32 +17,25 @@
    <bool>false</bool>
   </property>
   <property name="modal">
-   <bool>true</bool>
-  </property>
-  <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
-   <property name="leftMargin">
-    <number>9</number>
-   </property>
-   <property name="topMargin">
-    <number>9</number>
-   </property>
-   <property name="rightMargin">
-    <number>9</number>
-   </property>
-   <property name="bottomMargin">
-    <number>9</number>
-   </property>
-   <item>
-    <widget class="QTreeWidget" name="dataTree">
+   <bool>true</bool>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
+   <property name="leftMargin">
+    <number>9</number>
+   </property>
+   <property name="topMargin">
+    <number>9</number>
+   </property>
+   <property name="rightMargin">
+    <number>9</number>
+   </property>
+   <property name="bottomMargin">
+    <number>9</number>
+   </property>
+   <item>
+    <widget class="QTreeWidget" name="dataTree">
      <property name="toolTip">
-      <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If color management is enabled, an exclamation mark indicates that the color may be outside of the color gamut of the current printer profile selected. What this means is the color may not print exactly as indicated on screen. Spot colors are indicated by a red circle. More hints about gamut warnings are in the online help under Color Management. Registration colors will have a registration mark next to the color. Use Registration only for printers marks and crop marks.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      <string>If color management is enabled, an exclamation mark indicates that the color may be outside of the color gamut of the current printer profile selected. What this means is the color may not print exactly as indicated on screen. Spot colors are indicated by a red circle. More hints about gamut warnings are in the online help under Color Management. Registration colors will have a registration mark next to the color. Use Registration only for printers marks and crop marks.</string>
      </property>
      <attribute name="headerVisible">
       <bool>false</bool>
@@ -125,12 +118,12 @@ p, li { white-space: pre-wrap; }
      <item>
       <widget class="QGroupBox" name="groupBox_3">
        <property name="title">
-        <string>Color Sets</string>
-       </property>
-       <layout class="QVBoxLayout" name="verticalLayout">
-        <item>
-         <widget class="QLabel" name="label">
-          <property name="text">
+        <string>Color Sets</string>
+       </property>
+       <layout class="QVBoxLayout" name="verticalLayout">
+        <item>
+         <widget class="QLabel" name="label">
+          <property name="text">
            <string>Current Color Set:</string>
           </property>
          </widget>
-- 
2.27.0

jghali

2021-02-01 00:31

administrator   ~0048794

The modification of colorsandfills.cpp looks incorrect to me: with that change the tooltip will not be translated.

bubu

2021-02-01 23:06

reporter   ~0048797

Thanks for reviewing. Please retest with attached Hungarian translation TS file. In this file the "If color management is enabled..." segment is translated also in ColorsAndFillsDialog (.cpp) scope, not only in ColorsAndFillsBase (.ui). I think the code is right and it works after running "lupdate Scribus.pro" and updating the TS files. It worked for me.

scribus.hu.zip (232,664 bytes)

bubu

2021-02-02 12:24

reporter   ~0048799

Maybe it is very amateur question: Why we need this HTML tooltip hack? Without this hack the tooltip is usable, there is no "appears on one line" problem. I am on Ubuntu 20.10, Qt 5.14.2. Can we simple remove that HTML skeleton?

tooltip.png (170,163 bytes)
tooltip.png (170,163 bytes)

jghali

2021-02-02 18:18

administrator   ~0048800

>> Maybe it is very amateur question: Why we need this HTML tooltip hack?

Well, I've asked myself same question and don't have any answer. So I am in favor of removing that HTML hack too.

jghali

2021-02-02 18:27

administrator   ~0048801

Applied your patch with the HTML hack removal. With that removal, the modifications in the cpp files were not necessary anymore.

Issue History

Date Modified Username Field Change
2021-01-31 20:03 bubu New Issue
2021-01-31 20:03 bubu File Added: 0001-Clean-up-HTML-header-code-from-translation-segments.patch
2021-02-01 00:31 jghali Note Added: 0048794
2021-02-01 23:06 bubu File Added: scribus.hu.zip
2021-02-01 23:06 bubu Note Added: 0048797
2021-02-02 12:24 bubu File Added: tooltip.png
2021-02-02 12:24 bubu Note Added: 0048799
2021-02-02 18:18 jghali Note Added: 0048800
2021-02-02 18:27 jghali Assigned To => jghali
2021-02-02 18:27 jghali Status new => resolved
2021-02-02 18:27 jghali Resolution open => fixed
2021-02-02 18:27 jghali Fixed in Version => 1.5.7.svn
2021-02-02 18:27 jghali Note Added: 0048801
2021-02-04 05:29 PeterBenedek Relationship added related to 0013264