View Issue Details

IDProjectCategoryView StatusLast Update
0001857FreeCADBugpublic2018-10-01 09:37
ReporterFedirAssigned Towmayer 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionreopened 
PlatformOSUbuntuOS Version
Product Version0.14 
Target VersionFixed in Version0.18 
Summary0001857: Broken start page in Ukrainian language
Descriptionhey folks ;)

I got broken start page with Ukrainian language.
Please see the attached screenshot.

I suppose there is unexpected " in some translation string.
But I have no idea how to debug it.

I tried change there https://crowdin.com/translate/freecad/7254/en-uk#2594150 (was ") but again, no idea how to test whether I changed a right string.
Steps To Reproduceset language to ?????????? (Ukrainian)
Tags#lowhangingfruit, translation

Activities

Fedir

2014-12-15 18:24

reporter  

screen 2014-12-15 19.44.53 836x373.png (Attachment missing)

wmayer

2014-12-16 09:22

administrator   ~0005389

That's the right string.

shoogen

2014-12-16 13:10

developer   ~0005391

Last edited: 2014-12-16 15:49

View 3 revisions

IMHO we should escape double quotes

index 34b8ccb..b8385f7 100644
--- a/src/Mod/Start/StartPage/StartPage.py
+++ b/src/Mod/Start/StartPage/StartPage.py
@@ -40,4 +40,3 @@ def translate(context,text):
-        if ord(i) == 39:
-            s.write("\\'")
-        else:
-            s.write(i)
+        if   i == '\x22': s.write('"')
+        elif i == '\x27': s.write(''')
+        else: s.write(i)


wmayer

2014-12-16 14:19

administrator   ~0005393

This doesn't really work either because if the translation escapes a string then in the HTML the output won't be:
"quoted string"
but
&x22;quoted string&x22;

wmayer

2014-12-16 14:36

administrator   ~0005394

The correct quotation tag in HTML is <q> and </q>

shoogen

2014-12-16 15:52

developer   ~0005395

I just thought that i it would be a goot idea not to rely on using escaped translated strings. I realized that would mean to escape < > & as well.

Fedir

2014-12-18 13:13

reporter   ~0005406

thanks for fix,


have small question, not really related to current issue,
is there a way to test the translation without recompiling the whole app? :)
in other apps I just replace the translation file, but for FreeCad seems different :)

wmayer

2014-12-18 17:56

administrator   ~0005407

Enter this into the Python console: App.ConfigGet("UserAppData")+"translations"
which gives you the path where to also load .qm translation files.

Copy your modified translation files to the above directory and activate the language. A restart is not needed.

Note: You need a 0.15 preview version, 0.14 won't work.

wmayer

2014-12-31 15:29

administrator   ~0005474

Last edited: 2014-12-31 15:54

View 2 revisions

Replacing quotes turned out to be a very strange problem. The current solution with "\\'" works in some cases but leads to a syntax error when used to assign the text to the "show" function.

Theoretically the above solution with '&#x22;' and '&#x27;' (alternatively '&# 034;' and '&# 039;' or & quot; and & apos;) works for HTML but not in this case. The problem seems to be that the escape sequences are already interpreted before the text is assigned.

So, this means that this inside the HTML file:
onMouseover="show('My 'quoted text')"
The ' is interpreted to be ' and later the onMouseover function complains about a missing ")".

wmayer

2014-12-31 15:59

administrator   ~0005475

The solution is to add a variable in the script block, e.g.:
var text01 = "This contains quoted string"

And then you can write:
onMouseover="show(text07)"

wmayer

2016-01-12 22:27

administrator   ~0006713

Relevant links:
http://www.sitepoint.com/forums/showthread.php?200151-Pass-parameters-from-onmouseover-into-function
http://www.millin.de/downloads/3-935922-52-3/src/sonderzeichhtml.htm

wmayer

2016-01-12 22:27

administrator  

freecad-startpage.html (Attachment missing)

wmayer

2016-01-12 22:28

administrator  

freecad-startpage_save.html (Attachment missing)

Kunda1

2017-01-13 16:40

administrator   ~0007719

@wmayer is this still an issue?

wmayer

2017-01-13 18:07

administrator   ~0007723

The problem by the OP is fixed. However, the system is still a bit fragile because it depends on a syntactical correct translation and if this is not the case it will happen again. Therefore it would be good to separate the functions from the translations.

Kunda1

2017-09-26 15:19

administrator   ~0010196

@wmayer where is the relevant code for this in the source ?

Kunda1

2018-02-05 16:27

administrator   ~0010919

@yorik is this also an issue with other languages as well ?

yorik

2018-02-05 17:15

administrator   ~0010923

In any case this startpage will sooner or later be changed by something else, maybe not HTML-based if there are still problems with qt5 and webkit.

So I don't think it's worth much fixng this, specially if the original problem is solved already...

wmayer

2018-10-01 09:37

administrator   ~0011881

The way how the StartPage is built now it's not longer an issue that a broken translation breaks the functionality.

Related Changesets

FreeCAD: master 171a8cf8

2014-12-16 10:20:29

wmayer

Details Diff
+ fixes 0001857: Broken start page in Ukrainian language Affected Issues
0001857
mod - src/Mod/Start/Gui/Resources/translations/StartPage_uk.qm Diff File
mod - src/Mod/Start/Gui/Resources/translations/StartPage_uk.ts Diff File

Issue History

Date Modified Username Field Change
2014-12-15 18:24 Fedir New Issue
2014-12-15 18:24 Fedir File Added: screen 2014-12-15 19.44.53 836x373.png
2014-12-16 09:22 wmayer Note Added: 0005389
2014-12-16 09:42 wmayer Changeset attached => FreeCAD Master master 171a8cf8
2014-12-16 09:42 wmayer Assigned To => wmayer
2014-12-16 09:42 wmayer Status new => closed
2014-12-16 09:42 wmayer Resolution open => fixed
2014-12-16 13:10 shoogen Note Added: 0005391
2014-12-16 13:10 shoogen Status closed => feedback
2014-12-16 13:10 shoogen Resolution fixed => reopened
2014-12-16 13:11 shoogen Note Edited: 0005391 View Revisions
2014-12-16 14:19 wmayer Note Added: 0005393
2014-12-16 14:36 wmayer Note Added: 0005394
2014-12-16 15:49 shoogen Note Edited: 0005391 View Revisions
2014-12-16 15:52 shoogen Note Added: 0005395
2014-12-18 13:13 Fedir Note Added: 0005406
2014-12-18 13:13 Fedir Status feedback => assigned
2014-12-18 17:56 wmayer Note Added: 0005407
2014-12-31 15:29 wmayer Note Added: 0005474
2014-12-31 15:54 wmayer Note Edited: 0005474 View Revisions
2014-12-31 15:59 wmayer Note Added: 0005475
2016-01-12 22:27 wmayer Note Added: 0006713
2016-01-12 22:27 wmayer File Added: freecad-startpage.html
2016-01-12 22:28 wmayer File Added: freecad-startpage_save.html
2017-01-13 16:40 Kunda1 Note Added: 0007719
2017-01-13 18:07 wmayer Note Added: 0007723
2017-05-31 01:04 Kunda1 Tag Attached: translation
2017-05-31 01:05 Kunda1 Tag Attached: #lowhangingfruit
2017-09-26 15:19 Kunda1 Note Added: 0010196
2018-01-19 16:45 Kunda1 Target Version => 0.17
2018-01-22 21:07 wmayer Target Version 0.17 =>
2018-02-05 16:27 Kunda1 Note Added: 0010919
2018-02-05 17:15 yorik Note Added: 0010923
2018-10-01 09:37 wmayer Status assigned => closed
2018-10-01 09:37 wmayer Fixed in Version => 0.18
2018-10-01 09:37 wmayer Note Added: 0011881