Skip to content

Commit

Permalink
Unified translation strings for package managers
Browse files Browse the repository at this point in the history
  • Loading branch information
panther7 committed Jan 22, 2023
1 parent fd1b3db commit 805a8ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions wingetui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ def checkForRunningInstances(self):

def detectWinget(self):
try:
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating Winget...")))
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating {pm}...").format(pm = "Winget")))
o = subprocess.run(f"{wingetHelpers.winget} -v", shell=True, stdout=subprocess.PIPE)
print(o.stdout)
print(o.stderr)
globals.componentStatus["wingetFound"] = o.returncode == 0
globals.componentStatus["wingetVersion"] = o.stdout.decode('utf-8').replace("\n", "")
self.callInMain.emit(lambda: self.loadingText.setText(_("Winget found: {0}").format(globals.componentStatus['wingetFound'])))
self.callInMain.emit(lambda: self.loadingText.setText(_("{pm} found: {state}").format(pm = "Winget", state = globals.componentStatus['wingetFound'])))
except Exception as e:
print(e)
self.loadStatus += 1
Expand All @@ -200,26 +200,26 @@ def detectWinget(self):

def detectChocolatey(self):
try:
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating Chocolatey...")))
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating {pm}...").format(pm = "Chocolatey")))
o = subprocess.run(f"{chocoHelpers.choco} -v", shell=True, stdout=subprocess.PIPE)
print(o.stdout)
print(o.stderr)
globals.componentStatus["chocoFound"] = o.returncode == 0
globals.componentStatus["chocoVersion"] = o.stdout.decode('utf-8').replace("\n", "")
self.callInMain.emit(lambda: self.loadingText.setText(_("Chocolatey found: {0}").format(globals.componentStatus['chocoFound'])))
self.callInMain.emit(lambda: self.loadingText.setText(_("{pm} found: {state}").format(pm = "Chocolatey", state = globals.componentStatus['chocoFound'])))
except Exception as e:
print(e)
self.loadStatus += 1

def detectScoop(self):
try:
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating Scoop...")))
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating {pm}...").format(pm = "Scoop")))
o = subprocess.run(f"{scoopHelpers.scoop} -v", shell=True, stdout=subprocess.PIPE)
print(o.stdout)
print(o.stderr)
globals.componentStatus["scoopFound"] = o.returncode == 0
globals.componentStatus["scoopVersion"] = o.stdout.decode('utf-8').split("\n")[1]
self.callInMain.emit(lambda: self.loadingText.setText(_("Scoop found: {0}").format(globals.componentStatus['scoopFound'])))
self.callInMain.emit(lambda: self.loadingText.setText(_("{pm} found: {state}").format(pm = "Scoop", state = globals.componentStatus['scoopFound'])))
except Exception as e:
print(e)
self.loadStatus += 1
Expand Down Expand Up @@ -249,11 +249,11 @@ def detectScoop(self):
def detectSudo(self):
global sudoLocation
try:
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating sudo...")))
self.callInMain.emit(lambda: self.loadingText.setText(_("Locating {0}...").format("sudo")))
o = subprocess.run(f"{sudoPath} -v", shell=True, stdout=subprocess.PIPE)
globals.componentStatus["sudoFound"] = o.returncode == 0
globals.componentStatus["sudoVersion"] = o.stdout.decode('utf-8').split("\n")[0]
self.callInMain.emit(lambda: self.loadingText.setText(_("Sudo found: {0}").format(globals.componentStatus['sudoFound'])))
self.callInMain.emit(lambda: self.loadingText.setText(_("{0} found: {1}").format("Sudo", globals.componentStatus['sudoFound'])))
except Exception as e:
print(e)
self.loadStatus += 1
Expand Down
12 changes: 6 additions & 6 deletions wingetui/uiSections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2492,9 +2492,9 @@ def resetWingetUIStore():
self.layout.addWidget(title)
self.layout.addSpacing(20)

self.wingetPreferences = QSettingsTitle(_("Winget preferences"), getMedia("winget"), _("Winget package manager specific preferences"))
self.wingetPreferences = QSettingsTitle(_("{pm} preferences").format(pm = "Winget"), getMedia("winget"), _("{0} package manager specific preferences").format("Winget"))
self.layout.addWidget(self.wingetPreferences)
disableWinget = QSettingsCheckBox(_("Enable Winget"))
disableWinget = QSettingsCheckBox(_("Enable {pm}").format(pm = "Winget"))
disableWinget.setChecked(not getSettings("DisableWinget"))
disableWinget.stateChanged.connect(lambda v: (setSettings("DisableWinget", not bool(v)), parallelInstalls.setEnabled(v), button.setEnabled(v), enableSystemWinget.setEnabled(v)))
self.wingetPreferences.addWidget(disableWinget)
Expand All @@ -2513,10 +2513,10 @@ def resetWingetUIStore():
enableSystemWinget.setEnabled(disableWinget.isChecked())


self.scoopPreferences = QSettingsTitle(_("Scoop preferences"), getMedia("scoop"), _("Scoop package manager specific preferences"))
self.scoopPreferences = QSettingsTitle(_("{pm} preferences").format(pm = "Scoop"), getMedia("scoop"), _("{0} package manager specific preferences").format("Scoop"))
self.layout.addWidget(self.scoopPreferences)

disableScoop = QSettingsCheckBox(_("Enable Scoop"))
disableScoop = QSettingsCheckBox(_("Enable {pm}").format(pm = "Scoop"))
disableScoop.setChecked(not getSettings("DisableScoop"))
disableScoop.stateChanged.connect(lambda v: (setSettings("DisableScoop", not bool(v)), scoopPreventCaps.setEnabled(v), bucketManager.setEnabled(v), uninstallScoop.setEnabled(v), enableScoopCleanup.setEnabled(v)))
self.scoopPreferences.addWidget(disableScoop)
Expand All @@ -2540,9 +2540,9 @@ def resetWingetUIStore():
uninstallScoop.setEnabled(disableScoop.isChecked())
enableScoopCleanup.setEnabled(disableScoop.isChecked())

self.chocoPreferences = QSettingsTitle(_("Chocolatey preferences"), getMedia("choco"), _("Chocolatey package manager specific preferences"))
self.chocoPreferences = QSettingsTitle(_("{pm} preferences").format(pm = "Chocolatey"), getMedia("choco"), _("{0} package manager specific preferences").format("Chocolatey"))
self.layout.addWidget(self.chocoPreferences)
disableChocolatey = QSettingsCheckBox(_("Enable Choclatey"))
disableChocolatey = QSettingsCheckBox(_("Enable {pm}").format(pm = "Chocolatey"))
disableChocolatey.setChecked(not getSettings("DisableChocolatey"))
disableChocolatey.stateChanged.connect(lambda v: (setSettings("DisableChocolatey", not bool(v))))
self.chocoPreferences.addWidget(disableChocolatey)
Expand Down

0 comments on commit 805a8ff

Please sign in to comment.