Skip to content

Commit

Permalink
Fix translations
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxhw committed Dec 1, 2021
1 parent 4d93968 commit da480e9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
13 changes: 12 additions & 1 deletion Resources/askpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@


from PyQt5 import QtWidgets
import tstranslator

tstr = None
def tr(input):
global tstr
try:
if not tstr:
tstr = tstranslator.TsTranslator(os.path.dirname(__file__) + "/i18n", "")
return tstr.tr(input)
except:
return input

app = QtWidgets.QApplication([])
password, ok = QtWidgets.QInputDialog.getText(None, "sudo", "Password", QtWidgets.QLineEdit.Password)
password, ok = QtWidgets.QInputDialog.getText(None, "sudo", tr("Password"), QtWidgets.QLineEdit.Password)
if ok:
print(password)
app.exit(0)
6 changes: 3 additions & 3 deletions Resources/hardware-probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import tempfile
import shutil

from PyQt5 import QtWidgets, QtGui, QtCore # pkg install py37-qt5-widgets
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtWidgets import QTreeView, QFileSystemModel, QVBoxLayout, QPlainTextEdit, QMainWindow

# Plenty of TODOs and FIXMEs are sprinkled across this code.
Expand All @@ -47,7 +47,7 @@

# Translate this application using Qt .ts files without the need for compilation
import tstranslator
# FIXME: Do not import translations from outside of the appliction bundle
# FIXME: Do not import translations from outside of the application bundle
# which currently is difficult because we have all translations for all applications
# in the whole repository in the same .ts files
tstr = None
Expand Down Expand Up @@ -283,7 +283,7 @@ def initializePage(self):
def run_probe_locally(self):
proc = QtCore.QProcess()

if os.environ.get('HW_PROBE_FLATPAK') or os.environ.get('HW_PROBE_SNAP'):
if os.environ.get('HW_PROBE_FLATPAK') or os.environ.get('HW_PROBE_SNAP') or os.environ.get('NO_SUDO'):
command = self.wizard().hw_probe_tool
args = ["-all", "-output", self.wizard().hw_probe_output]
else:
Expand Down
22 changes: 21 additions & 1 deletion Resources/i18n/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</message>
<message>
<source>This will upload the anonymized hardware probe to the Linux hardware database. The probe will be published publicly under a permanent URL to view the probe.</source>
<translation>Переход далее загрузит анонимную пробу оборудования в базу данных оборудования Linux. Проба будет опубликована и доступна по постояноой ссылке для ее просмотра.</translation>
<translation>Переход далее загрузит анонимную пробу оборудования в базу данных оборудования Linux. Проба будет опубликована и доступна по постоянной ссылке для ее просмотра.</translation>
</message>
<message>
<source>Private information (including the username, hostname, IP addresses, MAC addresses, UUIDs and serial numbers) is not uploaded to the database.</source>
Expand Down Expand Up @@ -119,6 +119,26 @@
<source>Open file</source>
<translation>Открыть файл</translation>
</message>
<message>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<source>Back</source>
<translation>Назад</translation>
</message>
<message>
<source>Go Back</source>
<translation>Назад</translation>
</message>
<message>
<source>Next</source>
<translation>Продолжить</translation>
</message>
<message>
<source>Cancel</source>
<translation>Отмена</translation>
</message>
</context>
<context>
<name>tstr</name>
Expand Down

0 comments on commit da480e9

Please sign in to comment.