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 module ExtensionWizard #7698

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

MohamedAllali
Copy link
Contributor

@lassoan can you please look at this.

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.

Thanks, this is quite good, there are just a couple of things to change and test - see details in the inline comments.

@@ -12,7 +12,7 @@
See the License for the specific language governing permissions and
limitations under the License.

This file was originally developed by Adam Rankin, PerkLab, Queen's University
This file was originally developed by Adam Rankin, PerkLab, Queen's University
Copy link
Contributor

Choose a reason for hiding this comment

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

remove extra space

@@ -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.

Suggested change
qt.qWarning(_("failed to add built-in template {path} %r") % builtinPath)
qt.qWarning(_("failed to add built-in template {path}").format(path=builtinPath))

@@ -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.

fix the same way as the previous one

@@ -206,13 +209,13 @@ def setupTemplates(self):
self.templateManager.addCategoryPath(c, path)
except:
mp = (c, path)
qt.qWarning("failed to add template path %r for category %r" % mp)
qt.qWarning(_("failed to add template path %r for category %r") % mp)
Copy link
Contributor

Choose a reason for hiding this comment

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

fix the same way as the previous one

dlg = CreateComponentDialog("extension", self.parent.window())
dlg.setTemplates(self.templateManager.templates("extensions"))
dlg = CreateComponentDialog(_("extension"), self.parent.window())
dlg.setTemplates(self.templateManager.templates(_("extensions")))
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think is is allowed to be translated. Please test.

Suggested change
dlg.setTemplates(self.templateManager.templates(_("extensions")))
dlg.setTemplates(self.templateManager.templates("extensions"))

dlg.setTemplates(self.templateManager.templates("modules"),
default="scripted")
dlg = CreateComponentDialog(_("module"), self.parent.window())
dlg.setTemplates(self.templateManager.templates(_("modules")),
Copy link
Contributor

Choose a reason for hiding this comment

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

probably must not be translated, please test

default="scripted")
dlg = CreateComponentDialog(_("module"), self.parent.window())
dlg.setTemplates(self.templateManager.templates(_("modules")),
default=_("scripted"))
Copy link
Contributor

Choose a reason for hiding this comment

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

probably must not be translated

dlg.showDestination = False

while dlg.exec_() == qt.QDialog.Accepted:
name = dlg.componentName

try:
self.templateManager.copyTemplate(self.extensionLocation, "modules",
self.templateManager.copyTemplate(self.extensionLocation, _("modules"),
Copy link
Contributor

Choose a reason for hiding this comment

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

probably must not be translated

project = _map_property(lambda self: self.ui.nameEdit, "text")
category = _map_property(lambda self: self.ui.categoryEdit, "text")
description = _map_property(lambda self: self.ui.descriptionEdit, "plainText")
project = _map_property(lambda self: self.ui.nameEdit, _("text"))
Copy link
Contributor

Choose a reason for hiding this comment

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

"text" must not be translated in these lines (this is a Qt object property name)

@@ -113,7 +114,7 @@ def contributors(self, value):
item.setText(1, c[n + 1 : -1].strip())

except ValueError:
qt.qWarning("%r: badly formatted contributor" % c)
qt.qWarning(_("%r: badly formatted contributor") % c)
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 placeholder {}

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.

I've implemented fixes for all my review comments. It should be good to go now.

@lassoan lassoan enabled auto-merge (rebase) June 1, 2024 13:26
@lassoan lassoan merged commit eceb683 into Slicer:main Jun 1, 2024
5 checks passed
@MohamedAllali
Copy link
Contributor Author

Ok, done. thank you Mr. @lassoan .

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