mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Started moving towards a gettext-based localization.
This commit is contained in:
@@ -17,7 +17,7 @@ from PyQt4.QtGui import QDesktopServices, QFileDialog, QDialog, QMessageBox, QAp
|
||||
|
||||
from jobprogress import job
|
||||
from jobprogress.qt import Progress
|
||||
from hscommon.trans import tr, trmsg
|
||||
from hscommon.trans import trget
|
||||
from hscommon.plat import ISLINUX
|
||||
|
||||
from core.app import JobType
|
||||
@@ -33,6 +33,8 @@ from .directories_dialog import DirectoriesDialog
|
||||
from .problem_dialog import ProblemDialog
|
||||
from .util import createActions
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
JOBID2TITLE = {
|
||||
JobType.Scan: tr("Scanning for duplicates"),
|
||||
JobType.Load: tr("Loading"),
|
||||
@@ -136,13 +138,13 @@ class DupeGuru(QObject):
|
||||
if not dupes:
|
||||
return
|
||||
title = tr("Add to Ignore List")
|
||||
msg = trmsg("IgnoreConfirmMsg").format(len(dupes))
|
||||
msg = tr("IgnoreConfirmMsg").format(len(dupes))
|
||||
if self.confirm(title, msg):
|
||||
self.model.add_selected_to_ignore_list(self)
|
||||
|
||||
def copy_or_move_marked(self, copy):
|
||||
opname = tr("copy") if copy else tr("move")
|
||||
title = trmsg("SelectCopyOrMoveDestinationMsg").format(opname)
|
||||
title = tr("SelectCopyOrMoveDestinationMsg").format(opname)
|
||||
flags = QFileDialog.ShowDirsOnly
|
||||
destination = str(QFileDialog.getExistingDirectory(self.resultWindow, title, '', flags))
|
||||
if not destination:
|
||||
@@ -155,7 +157,7 @@ class DupeGuru(QObject):
|
||||
if not dupes:
|
||||
return
|
||||
title = tr("Remove duplicates")
|
||||
msg = trmsg("FileRemovalConfirmMsg").format(len(dupes))
|
||||
msg = tr("FileRemovalConfirmMsg").format(len(dupes))
|
||||
if self.confirm(title, msg):
|
||||
self.model.remove_selected(self)
|
||||
|
||||
@@ -174,7 +176,7 @@ class DupeGuru(QObject):
|
||||
if cmd:
|
||||
self.model.invoke_command(cmd)
|
||||
else:
|
||||
msg = trmsg("NoCustomCommandMsg")
|
||||
msg = tr("NoCustomCommandMsg")
|
||||
QMessageBox.warning(self.resultWindow, tr("Custom Command"), msg)
|
||||
|
||||
def show_details(self):
|
||||
@@ -205,12 +207,12 @@ class DupeGuru(QObject):
|
||||
if self.model.results.problems:
|
||||
self.problemDialog.show()
|
||||
else:
|
||||
msg = trmsg("OperationSuccessMsg")
|
||||
msg = tr("OperationSuccessMsg")
|
||||
QMessageBox.information(self.resultWindow, tr("Operation Complete"), msg)
|
||||
elif jobid == JobType.Scan:
|
||||
if not self.model.results.groups:
|
||||
title = tr("Scan complete")
|
||||
msg = trmsg("NoDuplicateFoundMsg")
|
||||
msg = tr("NoDuplicateFoundMsg")
|
||||
QMessageBox.information(self.resultWindow, title, msg)
|
||||
else:
|
||||
self.showResultsWindow()
|
||||
@@ -262,7 +264,7 @@ class DupeGuru(QObject):
|
||||
args = (j, ) + tuple(args)
|
||||
self._progress.run(jobid, title, func, args=args)
|
||||
except job.JobInProgressError:
|
||||
msg = trmsg("TaskHangingMsg")
|
||||
msg = tr("TaskHangingMsg")
|
||||
QMessageBox.information(self.resultWindow, 'Action in progress', msg)
|
||||
|
||||
def get_default(self, key):
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
from PyQt4.QtCore import Qt, SIGNAL, QAbstractTableModel
|
||||
from PyQt4.QtGui import QHeaderView, QTableView
|
||||
|
||||
from hscommon.trans import tr
|
||||
from hscommon.trans import trget
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
HEADER = [tr("Attribute"), tr("Selected"), tr("Reference")]
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from PyQt4.QtGui import (QWidget, QFileDialog, QHeaderView, QVBoxLayout, QHBoxLa
|
||||
QAbstractItemView, QSpacerItem, QSizePolicy, QPushButton, QApplication, QMainWindow, QMenuBar,
|
||||
QMenu, QIcon, QPixmap, QLabel)
|
||||
|
||||
from hscommon.trans import tr, trmsg
|
||||
from hscommon.trans import trget
|
||||
from qtlib.recent import Recent
|
||||
from qtlib.util import moveToScreenCenter
|
||||
|
||||
@@ -19,6 +19,8 @@ from . import platform
|
||||
from .directories_model import DirectoriesModel, DirectoriesDelegate
|
||||
from .util import createActions
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
class DirectoriesDialog(QMainWindow):
|
||||
def __init__(self, parent, app):
|
||||
QMainWindow.__init__(self, None)
|
||||
@@ -101,7 +103,7 @@ class DirectoriesDialog(QMainWindow):
|
||||
self.resize(420, 338)
|
||||
self.centralwidget = QWidget(self)
|
||||
self.verticalLayout = QVBoxLayout(self.centralwidget)
|
||||
self.promptLabel = QLabel(trmsg("SelectFolderToScanMsg"), self.centralwidget)
|
||||
self.promptLabel = QLabel(tr("SelectFolderToScanMsg"), self.centralwidget)
|
||||
self.verticalLayout.addWidget(self.promptLabel)
|
||||
self.treeView = QTreeView(self.centralwidget)
|
||||
self.treeView.setItemDelegate(self.directoriesDelegate)
|
||||
@@ -171,7 +173,7 @@ class DirectoriesDialog(QMainWindow):
|
||||
event.accept()
|
||||
if self.app.model.results.is_modified:
|
||||
title = tr("Unsaved results")
|
||||
msg = trmsg("ReallyWantToQuitMsg")
|
||||
msg = tr("ReallyWantToQuitMsg")
|
||||
if not self.app.confirm(title, msg):
|
||||
event.ignore()
|
||||
if event.isAccepted():
|
||||
@@ -179,7 +181,7 @@ class DirectoriesDialog(QMainWindow):
|
||||
|
||||
#--- Events
|
||||
def addFolderTriggered(self):
|
||||
title = trmsg("SelectFolderToAddMsg")
|
||||
title = tr("SelectFolderToAddMsg")
|
||||
flags = QFileDialog.ShowDirsOnly
|
||||
dirpath = str(QFileDialog.getExistingDirectory(self, title, self.lastAddedFolder, flags))
|
||||
if not dirpath:
|
||||
@@ -196,7 +198,7 @@ class DirectoriesDialog(QMainWindow):
|
||||
self.recentFolders.insertItem(folder)
|
||||
|
||||
def loadResultsTriggered(self):
|
||||
title = trmsg("SelectResultToLoadMsg")
|
||||
title = tr("SelectResultToLoadMsg")
|
||||
files = ';;'.join([tr("dupeGuru Results (*.dupeguru)"), tr("All Files (*.*)")])
|
||||
destination = QFileDialog.getOpenFileName(self, title, '', files)
|
||||
if destination:
|
||||
@@ -216,7 +218,7 @@ class DirectoriesDialog(QMainWindow):
|
||||
def scanButtonClicked(self):
|
||||
if self.app.model.results.is_modified:
|
||||
title = tr("Start a new scan")
|
||||
msg = trmsg("ReallyWantToContinueMsg")
|
||||
msg = tr("ReallyWantToContinueMsg")
|
||||
if not self.app.confirm(title, msg):
|
||||
return
|
||||
self.app.model.start_scanning()
|
||||
|
||||
@@ -12,11 +12,13 @@ from PyQt4.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex
|
||||
from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QApplication, QBrush, QStyle,
|
||||
QStyleOptionComboBox, QStyleOptionViewItemV4)
|
||||
|
||||
from hscommon.trans import tr
|
||||
from hscommon.trans import trget
|
||||
from qtlib.tree_model import RefNode, TreeModel
|
||||
|
||||
from core.gui.directory_tree import DirectoryTree
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
HEADERS = [tr("Name"), tr("State")]
|
||||
STATES = [tr("Normal"), tr("Reference"), tr("Excluded")]
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ from PyQt4.QtGui import (QDialog, QDesktopServices, QApplication, QVBoxLayout, Q
|
||||
QFont, QSpacerItem, QSizePolicy, QPushButton)
|
||||
|
||||
from hscommon.plat import ISLINUX
|
||||
from hscommon.trans import tr as trbase, trmsg as trmsgbase
|
||||
tr = lambda s: trbase(s, "ExtraFairwareReminder")
|
||||
trmsg = lambda s: trmsgbase(s, "ExtraFairwareReminder")
|
||||
from hscommon.trans import trget
|
||||
from core.gui.extra_fairware_reminder import ExtraFairwareReminder as ExtraFairwareReminderModel
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
class ExtraFairwareReminder(QDialog):
|
||||
def __init__(self, parent, app):
|
||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint
|
||||
@@ -38,11 +38,11 @@ class ExtraFairwareReminder(QDialog):
|
||||
self.resize(380, dlg_height)
|
||||
self.verticalLayout = QVBoxLayout(self)
|
||||
self.descLabel = QLabel(self)
|
||||
self.descLabel.setText(trmsg("ExtraFairwarePromptMsg"))
|
||||
self.descLabel.setText(tr("ExtraFairwarePromptMsg"))
|
||||
self.descLabel.setWordWrap(True)
|
||||
self.verticalLayout.addWidget(self.descLabel)
|
||||
self.reasonLabel = QLabel(self)
|
||||
self.reasonLabel.setText(trmsg("ExtraFairwareReasonMsg"))
|
||||
self.reasonLabel.setText(tr("ExtraFairwareReasonMsg"))
|
||||
self.reasonLabel.setWordWrap(True)
|
||||
font = QFont()
|
||||
font.setWeight(75)
|
||||
|
||||
@@ -11,9 +11,11 @@ from PyQt4.QtGui import (QDialog, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QL
|
||||
QSlider, QSizePolicy, QSpacerItem, QCheckBox, QLineEdit, QMessageBox, QSpinBox)
|
||||
|
||||
from hscommon.plat import ISOSX, ISLINUX
|
||||
from hscommon.trans import tr, trmsg
|
||||
from hscommon.trans import trget
|
||||
from qtlib.util import horizontalWrap
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
class PreferencesDialogBase(QDialog):
|
||||
def __init__(self, parent, app):
|
||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
||||
@@ -180,7 +182,7 @@ class PreferencesDialogBase(QDialog):
|
||||
if oldlang not in langs:
|
||||
oldlang = 'en'
|
||||
if lang != oldlang:
|
||||
QMessageBox.information(self, "", trmsg("NeedsToRestartToApplyLangMsg"))
|
||||
QMessageBox.information(self, "", tr("NeedsToRestartToApplyLangMsg"))
|
||||
self.app.prefs.language = lang
|
||||
self._save(prefs, ischecked)
|
||||
|
||||
|
||||
@@ -10,11 +10,13 @@ from PyQt4.QtCore import Qt, QMimeData, QByteArray
|
||||
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QComboBox, QListView,
|
||||
QDialogButtonBox, QAbstractItemView, QLabel)
|
||||
|
||||
from hscommon.trans import tr
|
||||
from hscommon.trans import trget
|
||||
from qtlib.selectable_list import ComboboxModel, ListviewModel
|
||||
from qtlib.util import verticalSpacer
|
||||
from core.gui.prioritize_dialog import PrioritizeDialog as PrioritizeDialogModel
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
MIME_INDEXES = 'application/dupeguru.rowindexes'
|
||||
|
||||
class PrioritizationList(ListviewModel):
|
||||
|
||||
@@ -10,10 +10,12 @@ from PyQt4.QtCore import Qt
|
||||
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QSpacerItem, QSizePolicy,
|
||||
QLabel, QTableView, QAbstractItemView, QApplication)
|
||||
|
||||
from hscommon.trans import tr, trmsg
|
||||
from hscommon.trans import trget
|
||||
from core.gui.problem_dialog import ProblemDialog as ProblemDialogModel
|
||||
from .problem_table import ProblemTable
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
class ProblemDialog(QDialog):
|
||||
def __init__(self, parent, app):
|
||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
||||
@@ -33,7 +35,7 @@ class ProblemDialog(QDialog):
|
||||
self.resize(413, 323)
|
||||
self.verticalLayout = QVBoxLayout(self)
|
||||
self.label = QLabel(self)
|
||||
self.label.setText(trmsg("ProblemsDuringProcessingMsg"))
|
||||
self.label.setText(tr("ProblemsDuringProcessingMsg"))
|
||||
self.label.setWordWrap(True)
|
||||
self.verticalLayout.addWidget(self.label)
|
||||
self.tableView = QTableView(self)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2010-04-12
|
||||
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
||||
@@ -7,11 +6,13 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from hscommon.trans import tr
|
||||
from hscommon.trans import trget
|
||||
from qtlib.column import Column
|
||||
from qtlib.table import Table
|
||||
from core.gui.problem_table import ProblemTable as ProblemTableModel
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
class ProblemTable(Table):
|
||||
COLUMNS = [
|
||||
Column('path', tr("File Path"), 150),
|
||||
|
||||
@@ -12,7 +12,7 @@ from PyQt4.QtGui import (QMainWindow, QMenu, QLabel, QHeaderView, QMessageBox, Q
|
||||
QStatusBar, QDialog)
|
||||
|
||||
from hscommon.plat import ISOSX, ISLINUX
|
||||
from hscommon.trans import tr, trmsg
|
||||
from hscommon.trans import trget
|
||||
from hscommon.util import nonone
|
||||
from qtlib.util import moveToScreenCenter
|
||||
|
||||
@@ -21,6 +21,8 @@ from .stats_label import StatsLabel
|
||||
from .util import createActions
|
||||
from .prioritize_dialog import PrioritizeDialog
|
||||
|
||||
tr = trget('ui')
|
||||
|
||||
class ResultWindow(QMainWindow):
|
||||
def __init__(self, app):
|
||||
QMainWindow.__init__(self, None)
|
||||
@@ -226,7 +228,7 @@ class ResultWindow(QMainWindow):
|
||||
|
||||
def applyFilterTriggered(self):
|
||||
title = tr("Apply Filter")
|
||||
msg = trmsg("TypeFilterMsg")
|
||||
msg = tr("TypeFilterMsg")
|
||||
text = nonone(self._last_filter, '[*]')
|
||||
answer, ok = QInputDialog.getText(self, title, msg, QLineEdit.Normal, text)
|
||||
if not ok:
|
||||
@@ -242,12 +244,12 @@ class ResultWindow(QMainWindow):
|
||||
title = tr("Clear Ignore List")
|
||||
count = len(self.app.model.scanner.ignore_list)
|
||||
if not count:
|
||||
QMessageBox.information(self, title, trmsg("NothingToClearMsg"))
|
||||
QMessageBox.information(self, title, tr("NothingToClearMsg"))
|
||||
return
|
||||
msg = trmsg("ClearIgnoreListConfirmMsg").format(count)
|
||||
msg = tr("ClearIgnoreListConfirmMsg").format(count)
|
||||
if self.app.confirm(title, msg, QMessageBox.No):
|
||||
self.app.model.scanner.ignore_list.Clear()
|
||||
QMessageBox.information(self, title, trmsg("IgnoreListClearedMsg"))
|
||||
QMessageBox.information(self, title, tr("IgnoreListClearedMsg"))
|
||||
|
||||
def copyTriggered(self):
|
||||
self.app.copy_or_move_marked(True)
|
||||
@@ -257,7 +259,7 @@ class ResultWindow(QMainWindow):
|
||||
if not count:
|
||||
return
|
||||
title = tr("Delete duplicates")
|
||||
msg = trmsg("SendToTrashConfirmMsg").format(count)
|
||||
msg = tr("SendToTrashConfirmMsg").format(count)
|
||||
if self.app.confirm(title, msg):
|
||||
self.app.model.delete_marked()
|
||||
|
||||
@@ -282,7 +284,7 @@ class ResultWindow(QMainWindow):
|
||||
if not count:
|
||||
return
|
||||
title = tr("Delete and hardlink duplicates")
|
||||
msg = trmsg("HardlinkConfirmMsg").format(count)
|
||||
msg = tr("HardlinkConfirmMsg").format(count)
|
||||
if self.app.confirm(title, msg):
|
||||
self.app.model.delete_marked(replace_with_hardlinks=True)
|
||||
|
||||
@@ -318,7 +320,7 @@ class ResultWindow(QMainWindow):
|
||||
if not count:
|
||||
return
|
||||
title = tr("Remove duplicates")
|
||||
msg = trmsg("FileRemovalConfirmMsg").format(count)
|
||||
msg = tr("FileRemovalConfirmMsg").format(count)
|
||||
if self.app.confirm(title, msg):
|
||||
self.app.model.remove_marked()
|
||||
|
||||
@@ -338,7 +340,7 @@ class ResultWindow(QMainWindow):
|
||||
self.app.model.reveal_selected()
|
||||
|
||||
def saveResultsTriggered(self):
|
||||
title = trmsg("SelectResultToSaveMsg")
|
||||
title = tr("SelectResultToSaveMsg")
|
||||
files = tr("dupeGuru Results (*.dupeguru)")
|
||||
destination = QFileDialog.getSaveFileName(self, title, '', files)
|
||||
if destination:
|
||||
|
||||
Reference in New Issue
Block a user