-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark all user-visible strings as translatable in C++ #12
Comments
Qt seems to recommend two approaches for making
Probably option A is more clear and consistent - we can use |
Qt lupdate tool throws `Cannot invoke tr() like this` warnings when translation function is called using `q->tr(...)`. The problem is that lupdate cannot determine the class name `tr()` is called on and therefore it does not know the translation context. The solution is to spell out the class name in the call, for example `qSlicerScalarVolumeDisplayWidget::tr(...)`. More details are described here: https://github.com/Slicer/SlicerLanguagePacks/blob/main/DevelopersManual.md see Slicer/SlicerLanguagePacks#12
Qt lupdate tool throws `Cannot invoke tr() like this` warnings when translation function is called using `q->tr(...)`. The problem is that lupdate cannot determine the class name `tr()` is called on and therefore it does not know the translation context. The solution is to spell out the class name in the call, for example `qSlicerScalarVolumeDisplayWidget::tr(...)`. More details are described here: https://github.com/Slicer/SlicerLanguagePacks/blob/main/DevelopersManual.md see Slicer/SlicerLanguagePacks#12
I was wondering which approach we should use when it's about dealing with numbered arguments present on translatable strings. For example, when we have the following string : QString("An update is available. Installed: %1. Available : %2.")
.arg(installedVersion)
.arg(onServerVersion); Which translation approach should we consider ? Option A tr("An update is available. Installed: %1. Available: %2.")
.arg(installedVersion)
.arg(onServerVersion); Option B tr("%1 %2 %3. %4 %5.")
.arg(tr("An update is available."))
.arg(tr("Installed:"))
.arg(installedVersion)
.arg(tr("Available:"))
.arg(onServerVersion); Option C tr("%1 %2. %3 %4.")
.arg(tr("An update is available. Installed:"))
.arg(installedVersion)
.arg(tr("Available:"))
.arg(onServerVersion); The first option may be simpler and may offer more flexibility at translation time. It also offers a better context to the translation since the whole sentence is visible. However, the presence of arguments in translatable strings may not be understood by "non-tech" translators and may be mishandled. For this, I think that, as with the Here is another example of such strings where the text in the HTML code has numbered arguments and needs to be translated. |
Separation of SliceOrientationMarkerTypeComboBox item text and data so that to ease translations See Slicer/SlicerLanguagePacks#12
Separation of SliceOrientationMarkerTypeComboBox item text and data so that to ease translations See Slicer/SlicerLanguagePacks#12
…Core Updates on Slicer@6e940aa after PR comments See also Slicer/SlicerLanguagePacks#12
Some user-visible strings were not marked as translatable. see Slicer/SlicerLanguagePacks#12
Some user-visible strings were not marked as translatable. see Slicer/SlicerLanguagePacks#12
Qt lupdate tool throws `Cannot invoke tr() like this` warnings when translation function is called using `q->tr(...)`. The problem is that lupdate cannot determine the class name `tr()` is called on and therefore it does not know the translation context. The solution is to spell out the class name in the call, for example `qSlicerScalarVolumeDisplayWidget::tr(...)`. More details are described here: https://github.com/Slicer/SlicerLanguagePacks/blob/main/DevelopersManual.md see Slicer/SlicerLanguagePacks#17 see Slicer/SlicerLanguagePacks#12
vtkMRMLI18N singleton class is responsible for internationalization related features in MRML. It currently only stores a language translator. A translator that uses Qt for translation is specified in qSlicerCoreApplication. Enables fixing of these issues: Slicer/SlicerLanguagePacks#12 Slicer#6647 Slicer#6177 Co-authored-by: Mouhamed DIOP <[email protected]>
vtkMRMLI18N singleton class is responsible for internationalization related features in MRML. It currently only stores a language translator. A translator that uses Qt for translation is specified in qSlicerCoreApplication. Enables fixing of these issues: Slicer/SlicerLanguagePacks#12 #6647 #6177 Co-authored-by: Mouhamed DIOP <[email protected]>
Enables fixing of these issues: Slicer/SlicerLanguagePacks#12 Slicer#6177
Enables fixing of these Slicer/SlicerLanguagePacks#12 Slicer#6177
Enables fixing of these Slicer/SlicerLanguagePacks#12 Slicer#6177
Enables fixing of these Slicer/SlicerLanguagePacks#12 Slicer#6177
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - Slicer#6177 - Slicer/SlicerLanguagePacks#12
Segment Editor effects have now separate "name" (for modules to refer to the effect) and "title" (displayed on the GUI). This partially fixes these issues: - #6177 - Slicer/SlicerLanguagePacks#12
All problems are fixed or tracked in specific issues. |
Summary
Many strings that are specified in C++ source files have not been marked as translatable (e.g., by using the
QObject::tr
method). Slicer core, CTK library, and Slicer extensions source code needs to be improved so that all translatable strings are marked as such.Evolution of modules marking tasks
The text was updated successfully, but these errors were encountered: