Conversation
|
@jcfr Is this relevant. It has been outstanding for more than 1 year. |
|
Yes, let's keep it open. |
|
Can it be merged? |
286e5e4 to
3e1ea33
Compare
|
@carlos-luque I re-based the topic we worked on during one of the project week. Is it something you could test ? |
This commit adds CMake function "SlicerFunctionAddPythonScriptTrFilesTargets" used to ensure input expected by lupdate/lrelease translation tools are generated. The CMake function associates custom commands with each python scripts and also adds a convenience target called "Add<TargetName>PythonScriptTrFiles" to explicitly regenerate the .py.tr files. The custom commands generate the .py.tr files by invoking a python cli (CMake/Rewrite.py) replacing calls to "slicer.util.tr" with "QT_TRANSLATE_NOOP". The python cli "CMake/Rewrite.py" internally uses the astor python package. Updates SlicerConfig to set Slicer_BUILD_I18N_SUPPORT, Slicer_UPDATE_TRANSLATION and Slicer_LANGUAGES. Co-authored-by: Carlos Luque <carlos.luque@ulpgc.es>
Removes the dependency of library to *.qm files and instead add the target GenerateSlicerTranslationQMFiles allowing to explicitly re-generate the '*.qm" files..
This commit adds GenerateSlicerTranslationTemplates target allowing to generate "<BaseName>_untranslated.ts" files. To facilitate their distribution, the files are generated in the directory "<CMAKE_BINARY_DIR>/TranslationTemplates".
After talking with "Carlos Luque <carlos.luque@ulpgc.es>", we decided to keep the file simpler. This could be revisited later. Co-authored-by: Carlos Luque <carlos.luque@ulpgc.es>
3e1ea33 to
71e06d4
Compare
lassoan
left a comment
There was a problem hiding this comment.
Looks very nice. Do we have a solution for translation of scripteddesigner modules (that generate module widget from a .ui file)?
| import astor | ||
|
|
||
|
|
||
| class RewriteTr(ast.NodeTransformer): |
There was a problem hiding this comment.
What does this function (and the whole file) do?
| inputFiducialsNodeSelector.removeEnabled = False | ||
| inputFiducialsNodeSelector.connect('currentNodeChanged(bool)', self.enableOrDisableCreateButton) | ||
| pathFormLayout.addRow("Input Fiducials:", inputFiducialsNodeSelector) | ||
| pathFormLayout.addRow(tr("EndoscopyWidget", "Input Fiducials:"), inputFiducialsNodeSelector) |
There was a problem hiding this comment.
tr() arguments are in not in this order (see https://doc.qt.io/qt-5/qobject.html#tr).
It should be tr("Input Fiducials:", "EndoscopyWidget").
|
|
||
| # CreatePath button | ||
| createPathButton = qt.QPushButton("Create path") | ||
| createPathButton = qt.QPushButton(tr("EndoscopyWidget", "Create path")) |
There was a problem hiding this comment.
Instead of hardcoding "EndoscopyWidget" everywhere, could we add a mixin to the class, which would add the class name automatically? It would simplify the syntax to tr("Create path").
slicer.i18n.tr())<ModuleName>_untranslated.tsfilesGenerateSlicerTranslationTemplatesandGenerateSlicerTranslationQMFilesSee https://github.com/NA-MIC/ProjectWeek/blob/master/PW31_2019_Boston/Projects/Globalization3DSlicer_OHIF/README.md#progress-and-next-steps