Skip to content

Commit

Permalink
Update a few translation items
Browse files Browse the repository at this point in the history
- Add Japanese as a selectable language
- Wrap a few missed strings in tr()
- Regenerate .pot files
  • Loading branch information
arsenetar committed Mar 18, 2021
1 parent e36aab1 commit fbdb333
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 49 deletions.
24 changes: 24 additions & 0 deletions locale/ui.pot
Original file line number Diff line number Diff line change
Expand Up @@ -881,3 +881,27 @@ msgid ""
"Example: if you want to filter out .PNG files from the \"My Pictures\" directory only:<br><code>.*My\\sPictures\\\\.*\\.png</code><br><br>You can test the regular expression with the \"test string\" button after pasting a fake path in the test field:<br><code>C:\\\\User\\My Pictures\\test.png</code><br><br>\n"
"Matching regular expressions will be highlighted.<br>If there is at least one highlight, the path or filename tested will be ignored during scans.<br><br>Directories and files starting with a period '.' are filtered out by default.<br><br>"
msgstr ""

#: qt\app.py:256
msgid "Results"
msgstr ""

#: qt\preferences_dialog.py:150
msgid "General Interface"
msgstr ""

#: qt\preferences_dialog.py:176
msgid "Result Table"
msgstr ""

#: qt\preferences_dialog.py:205
msgid "Details Window"
msgstr ""

#: qt\preferences_dialog.py:285
msgid "General"
msgstr ""

#: qt\preferences_dialog.py:286
msgid "Display"
msgstr ""
12 changes: 8 additions & 4 deletions qt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _setup(self):
"DirectoriesDialog", app=self
)
self.main_window.addTab(
self.directories_dialog, "Directories", switch=False
self.directories_dialog, tr("Directories"), switch=False
)
self.actionDirectoriesWindow.setEnabled(False)
else: # floating windows only
Expand Down Expand Up @@ -252,7 +252,9 @@ def showResultsWindow(self):
if self.resultWindow is not None:
if self.use_tabs:
if self.main_window.indexOfWidget(self.resultWindow) < 0:
self.main_window.addTab(self.resultWindow, "Results", switch=True)
self.main_window.addTab(
self.resultWindow, tr("Results"), switch=True
)
return
self.main_window.showTab(self.resultWindow)
else:
Expand Down Expand Up @@ -300,13 +302,15 @@ def clearPictureCacheTriggered(self):

def ignoreListTriggered(self):
if self.use_tabs:
self.showTriggeredTabbedDialog(self.ignoreListDialog, "Ignore List")
self.showTriggeredTabbedDialog(self.ignoreListDialog, tr("Ignore List"))
else: # floating windows
self.model.ignore_list_dialog.show()

def excludeListTriggered(self):
if self.use_tabs:
self.showTriggeredTabbedDialog(self.excludeListDialog, "Exclusion Filters")
self.showTriggeredTabbedDialog(
self.excludeListDialog, tr("Exclusion Filters")
)
else: # floating windows
self.model.exclude_list_dialog.show()

Expand Down
137 changes: 92 additions & 45 deletions qt/preferences_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@
"ko",
"es",
"nl",
"ja",
]


class Sections(Flag):
"""Filter blocks of preferences when reset or loaded"""

GENERAL = auto()
DISPLAY = auto()
ALL = GENERAL | DISPLAY
Expand Down Expand Up @@ -145,42 +147,53 @@ def _setupBottomPart(self):
self.widgetsVLayout.addWidget(self.customCommandEdit)

def _setupDisplayPage(self):
self.ui_groupbox = QGroupBox("&General Interface")
self.ui_groupbox = QGroupBox("&" + tr("General Interface"))
layout = QVBoxLayout()
self.languageLabel = QLabel(tr("Language:"), self)
self.languageComboBox = QComboBox(self)
for lang in self.supportedLanguages:
self.languageComboBox.addItem(get_langnames()[lang])
layout.addLayout(horizontalWrap([self.languageLabel, self.languageComboBox, None]))
self._setupAddCheckbox("tabs_default_pos",
tr("Use default position for tab bar (requires restart)"))
layout.addLayout(
horizontalWrap([self.languageLabel, self.languageComboBox, None])
)
self._setupAddCheckbox(
"tabs_default_pos",
tr("Use default position for tab bar (requires restart)"),
)
self.tabs_default_pos.setToolTip(
tr("Place the tab bar below the main menu instead of next to it\n\
On MacOS, the tab bar will fill up the window's width instead."))
tr(
"Place the tab bar below the main menu instead of next to it\n\
On MacOS, the tab bar will fill up the window's width instead."
)
)
layout.addWidget(self.tabs_default_pos)
self.ui_groupbox.setLayout(layout)
self.displayVLayout.addWidget(self.ui_groupbox)

gridlayout = QGridLayout()
gridlayout.setColumnStretch(2, 2)
formlayout = QFormLayout()
result_groupbox = QGroupBox("&Result Table")
result_groupbox = QGroupBox("&" + tr("Result Table"))
self.fontSizeSpinBox = QSpinBox()
self.fontSizeSpinBox.setMinimum(5)
formlayout.addRow(tr("Font size:"), self.fontSizeSpinBox)
self._setupAddCheckbox("reference_bold_font",
tr("Use bold font for references"))
self._setupAddCheckbox(
"reference_bold_font", tr("Use bold font for references")
)
formlayout.addRow(self.reference_bold_font)

self.result_table_ref_foreground_color = ColorPickerButton(self)
formlayout.addRow(tr("Reference foreground color:"),
self.result_table_ref_foreground_color)
formlayout.addRow(
tr("Reference foreground color:"), self.result_table_ref_foreground_color
)
self.result_table_ref_background_color = ColorPickerButton(self)
formlayout.addRow(tr("Reference background color:"),
self.result_table_ref_background_color)
formlayout.addRow(
tr("Reference background color:"), self.result_table_ref_background_color
)
self.result_table_delta_foreground_color = ColorPickerButton(self)
formlayout.addRow(tr("Delta foreground color:"),
self.result_table_delta_foreground_color)
formlayout.addRow(
tr("Delta foreground color:"), self.result_table_delta_foreground_color
)
formlayout.setLabelAlignment(Qt.AlignLeft)

# Keep same vertical spacing as parent layout for consistency
Expand All @@ -189,31 +202,45 @@ def _setupDisplayPage(self):
result_groupbox.setLayout(gridlayout)
self.displayVLayout.addWidget(result_groupbox)

details_groupbox = QGroupBox("&Details Window")
details_groupbox = QGroupBox("&" + tr("Details Window"))
self.details_groupbox_layout = QVBoxLayout()
self._setupAddCheckbox("details_dialog_titlebar_enabled",
tr("Show the title bar and can be docked"))
self._setupAddCheckbox(
"details_dialog_titlebar_enabled",
tr("Show the title bar and can be docked"),
)
self.details_dialog_titlebar_enabled.setToolTip(
tr("While the title bar is hidden, \
use the modifier key to drag the floating window around") if ISLINUX else
tr("The title bar can only be disabled while the window is docked"))
tr(
"While the title bar is hidden, \
use the modifier key to drag the floating window around"
)
if ISLINUX
else tr("The title bar can only be disabled while the window is docked")
)
self.details_groupbox_layout.addWidget(self.details_dialog_titlebar_enabled)
self._setupAddCheckbox("details_dialog_vertical_titlebar",
tr("Vertical title bar"))
self._setupAddCheckbox(
"details_dialog_vertical_titlebar", tr("Vertical title bar")
)
self.details_dialog_vertical_titlebar.setToolTip(
tr("Change the title bar from horizontal on top, to vertical on the left side"))
tr(
"Change the title bar from horizontal on top, to vertical on the left side"
)
)
self.details_groupbox_layout.addWidget(self.details_dialog_vertical_titlebar)
self.details_dialog_vertical_titlebar.setEnabled(
self.details_dialog_titlebar_enabled.isChecked())
self.details_dialog_titlebar_enabled.isChecked()
)
self.details_dialog_titlebar_enabled.stateChanged.connect(
self.details_dialog_vertical_titlebar.setEnabled)
self.details_dialog_vertical_titlebar.setEnabled
)
gridlayout = QGridLayout()
formlayout = QFormLayout()
self.details_table_delta_foreground_color = ColorPickerButton(self)
# Padding on the right side and space between label and widget to keep it somewhat consistent across themes
gridlayout.setColumnStretch(1, 1)
formlayout.setHorizontalSpacing(50)
formlayout.addRow(tr("Delta foreground color:"), self.details_table_delta_foreground_color)
formlayout.addRow(
tr("Delta foreground color:"), self.details_table_delta_foreground_color
)
gridlayout.addLayout(formlayout, 0, 0)
self.details_groupbox_layout.addLayout(gridlayout)
details_groupbox.setLayout(self.details_groupbox_layout)
Expand Down Expand Up @@ -255,8 +282,8 @@ def _setupUi(self):
self.mainVLayout.addWidget(self.tabwidget)
self.mainVLayout.addWidget(self.buttonBox)
self.layout().setSizeConstraint(QLayout.SetFixedSize)
self.tabwidget.addTab(self.page_general, "General")
self.tabwidget.addTab(self.page_display, "Display")
self.tabwidget.addTab(self.page_general, tr("General"))
self.tabwidget.addTab(self.page_display, tr("Display"))
self.displayVLayout.addStretch(0)
self.widgetsVLayout.addStretch(0)

Expand Down Expand Up @@ -285,19 +312,27 @@ def load(self, prefs=None, section=Sections.ALL):
if section & Sections.DISPLAY:
setchecked(self.reference_bold_font, prefs.reference_bold_font)
setchecked(self.tabs_default_pos, prefs.tabs_default_pos)
setchecked(self.details_dialog_titlebar_enabled,
prefs.details_dialog_titlebar_enabled)
setchecked(self.details_dialog_vertical_titlebar,
prefs.details_dialog_vertical_titlebar)
setchecked(
self.details_dialog_titlebar_enabled,
prefs.details_dialog_titlebar_enabled,
)
setchecked(
self.details_dialog_vertical_titlebar,
prefs.details_dialog_vertical_titlebar,
)
self.fontSizeSpinBox.setValue(prefs.tableFontSize)
self.details_table_delta_foreground_color.setColor(
prefs.details_table_delta_foreground_color)
prefs.details_table_delta_foreground_color
)
self.result_table_ref_foreground_color.setColor(
prefs.result_table_ref_foreground_color)
prefs.result_table_ref_foreground_color
)
self.result_table_ref_background_color.setColor(
prefs.result_table_ref_background_color)
prefs.result_table_ref_background_color
)
self.result_table_delta_foreground_color.setColor(
prefs.result_table_delta_foreground_color)
prefs.result_table_delta_foreground_color
)
try:
langindex = self.supportedLanguages.index(self.app.prefs.language)
except ValueError:
Expand All @@ -315,12 +350,24 @@ def save(self):
prefs.ignore_hardlink_matches = ischecked(self.ignoreHardlinkMatches)
prefs.debug_mode = ischecked(self.debugModeBox)
prefs.reference_bold_font = ischecked(self.reference_bold_font)
prefs.details_dialog_titlebar_enabled = ischecked(self.details_dialog_titlebar_enabled)
prefs.details_dialog_vertical_titlebar = ischecked(self.details_dialog_vertical_titlebar)
prefs.details_table_delta_foreground_color = self.details_table_delta_foreground_color.color
prefs.result_table_ref_foreground_color = self.result_table_ref_foreground_color.color
prefs.result_table_ref_background_color = self.result_table_ref_background_color.color
prefs.result_table_delta_foreground_color = self.result_table_delta_foreground_color.color
prefs.details_dialog_titlebar_enabled = ischecked(
self.details_dialog_titlebar_enabled
)
prefs.details_dialog_vertical_titlebar = ischecked(
self.details_dialog_vertical_titlebar
)
prefs.details_table_delta_foreground_color = (
self.details_table_delta_foreground_color.color
)
prefs.result_table_ref_foreground_color = (
self.result_table_ref_foreground_color.color
)
prefs.result_table_ref_background_color = (
self.result_table_ref_background_color.color
)
prefs.result_table_delta_foreground_color = (
self.result_table_delta_foreground_color.color
)
prefs.destination_type = self.copyMoveDestinationComboBox.currentIndex()
prefs.custom_command = str(self.customCommandEdit.text())
prefs.tableFontSize = self.fontSizeSpinBox.value()
Expand Down Expand Up @@ -364,8 +411,8 @@ def __init__(self, parent):
@pyqtSlot()
def onClicked(self):
color = QColorDialog.getColor(
self.color if self.color is not None else Qt.white,
self.parent)
self.color if self.color is not None else Qt.white, self.parent
)
self.setColor(color)

def setColor(self, color):
Expand Down
4 changes: 4 additions & 0 deletions qtlib/locale/qtlib.pot
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ msgstr ""
msgid "Vietnamese"
msgstr ""

#: qtlib\preferences.py:39
msgid "Japanese"
msgstr ""

#: qtlib\recent.py:54
msgid "Clear List"
msgstr ""
Expand Down
1 change: 1 addition & 0 deletions qtlib/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_langnames():
"pt_BR": tr("Brazilian"),
"es": tr("Spanish"),
"vi": tr("Vietnamese"),
"ja": tr("Japanese"),
}


Expand Down

0 comments on commit fbdb333

Please sign in to comment.