Skip to content
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

BUG: Mark translatable strings in Extension wizard #7626

Closed
wants to merge 9 commits into from

Conversation

MohamedAllali
Copy link

@lassoan
I'm not sure if the lines 361, 374 and 378 should be marked

Copy link
Contributor

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you it looks good I just added a few trivial comments.

@@ -355,7 +358,7 @@ def loadModules(path=None, depth=1, modules=None, parent=None):
# Add module(s) to permanent search paths, if requested
if dlg.addToSearchPaths:
settings = slicer.app.revisionUserSettings()
rawSearchPaths = list(_settingsList(settings, "Modules/AdditionalPaths", convertToAbsolutePaths=True))
rawSearchPaths = list(_settingsList(settings, _("Modules/AdditionalPaths"), convertToAbsolutePaths=True))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be translated

@@ -368,11 +371,11 @@ def loadModules(path=None, depth=1, modules=None, parent=None):
modified = True

if modified:
settings.setValue("Modules/AdditionalPaths", slicer.app.toSlicerHomeRelativePaths(rawSearchPaths))
settings.setValue(_("Modules/AdditionalPaths"), slicer.app.toSlicerHomeRelativePaths(rawSearchPaths))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be translated


# Enable developer mode (shows Reload&Test section, etc.), if requested
if dlg.enableDeveloperMode:
qt.QSettings().setValue("Developer/DeveloperMode", "true")
qt.QSettings().setValue(_("Developer/DeveloperMode"), _("true"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be translated

@@ -186,7 +189,7 @@ def setupTemplates(self):
try:
self.templateManager.addPath(builtinPath)
except:
qt.qWarning("failed to add built-in template path %r" % builtinPath)
qt.qWarning(_("failed to add built-in template path %r") % builtinPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use named placeholders; e.g. {path}

@@ -195,7 +198,7 @@ def setupTemplates(self):
try:
self.templateManager.addPath(path)
except:
qt.qWarning("failed to add template path %r" % path)
qt.qWarning(_("failed to add template path %r") % path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named placeholder should be used

@@ -240,12 +243,12 @@ def createExtension(self):
" directory containing CMakeLists.txt file at '%s'" % dlg.destination)

path = self.templateManager.copyTemplate(
destination, "extensions",
destination, _("extensions"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't translate

@@ -336,7 +339,7 @@ def loadModules(path=None, depth=1, modules=None, parent=None):
# Get list of modules in specified path
modules = ModuleInfo.findModules(path, depth)
elif modules is None:
raise RuntimeError("loadModules require 'path' or 'modules' input")
raise RuntimeError("loadModules require 'path' or _('modules') input")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't translate

else:
text = "The '%s' module could not be registered:" % failed[0].key
text = _("The '%s' module could not be registered:") % failed[0].key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use named placeholders

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain more this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use placeholders everywhere where we need to insert some value into the string. For example, the code here should look something like this:

text = _("The {moduleName} module could not be registered").format(moduleName=failed[0].key)

@MohamedAllali
Copy link
Author

Thank you for your comment, I will correct what you pointed out.

@lassoan
Copy link
Contributor

lassoan commented Mar 23, 2024

Have you closed this intentionally?

@lassoan lassoan reopened this Mar 23, 2024
@MohamedAllali
Copy link
Author

MohamedAllali commented Mar 23, 2024 via email

@lassoan
Copy link
Contributor

lassoan commented Mar 23, 2024

It seems that it is due to that you used the same branch in several pull requests. One branch can only store one set of changes, so you must use different git branch for each pull request.

@lassoan
Copy link
Contributor

lassoan commented Apr 16, 2024

We already have a pull request for the Extensions Wizard translation - #7698. Is this pull request still relevant?

@MohamedAllali
Copy link
Author

MohamedAllali commented Apr 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants