Fix screenshot manuals generation in website
Closed, ResolvedPublic

Description

Lots of manual are empty in: https://gcompris.net/screenshots-fr.html
This is due to the fact that we are retrieving the strings directly from the Activity.qml file (https://invent.kde.org/education/gcompris/-/blob/master/src/activities/colors/ActivityInfo.qml for example) with a simple regexp (https://invent.kde.org/websites/gcompris-net/-/blob/master/gcompris.py#L199) and we handle neither multiples lines nor splitted translation

jjazeix created this task.Jan 11 2021, 2:33 PM

Hi,
If you replace the Manuel part of gcompris.py with this code:

m = re.match('.*manual:.*\"(.*)\"', line)
              if m:
                  manual = m.group(1)
                  readManualLinesFlag = True
              elif readManualLinesFlag == True:
                  lineStripped = line.strip()
                  lineStrings = re.findall('"([^"]*)"', lineStripped, re.DOTALL)
                  if lineStrings:
                      for lineString in lineStrings:
                          manual += lineString
                  print("lineStripped" + lineStripped) 
                  
                  if lineStripped:
                      if lineStripped[-1] != "+":
                          readManualLinesFlag = False

This concatenate all the strings from Manual up to the last line having no + into the manual string.
This extracts the concatenated part of a single string such as
'manual: qsTr("Listen to the color and click on the matching duck.") + ("<br><br>") +'
using the regular expression line:
lineStrings = re.findall('"([^"]*)"', lineStripped, re.DOTALL)

jjazeix assigned this task to echarruau.Jan 24 2021, 5:59 PM

As discussed, this code misses some use cases and does not handle correctly the translation.

A refactoring of the part reading the file + the part handling the translation is needed

jjazeix moved this task from Backlog to WIP on the GCompris: Bugs board.Mar 14 2021, 10:49 AM
jjazeix moved this task from WIP to Done on the GCompris: Bugs board.Mar 14 2021, 6:37 PM
jjazeix closed this task as Resolved.