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
Description
Description
Comment Actions
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)
Comment Actions
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