From 3ae1e04c0a4498cd55d0fcbbd809686037beac33 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 18:30:13 -0800 Subject: [PATCH] Updated language on key share/receive mode strings to remove the confusing upload and download words --- onionshare_gui/mode/history.py | 32 ++++++++++---------- onionshare_gui/mode/receive_mode/__init__.py | 8 ++--- onionshare_gui/mode/share_mode/__init__.py | 8 ++--- share/locale/en.json | 22 ++++++++------ 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/onionshare_gui/mode/history.py b/onionshare_gui/mode/history.py index e72a3838..3f689bea 100644 --- a/onionshare_gui/mode/history.py +++ b/onionshare_gui/mode/history.py @@ -41,12 +41,12 @@ class HistoryItem(QtWidgets.QWidget): pass -class DownloadHistoryItem(HistoryItem): +class ShareHistoryItem(HistoryItem): """ Download history item, for share mode """ def __init__(self, common, id, total_bytes): - super(DownloadHistoryItem, self).__init__() + super(ShareHistoryItem, self).__init__() self.common = common self.id = id @@ -56,7 +56,7 @@ class DownloadHistoryItem(HistoryItem): self.started_dt = datetime.fromtimestamp(self.started) # Label - self.label = QtWidgets.QLabel(strings._('gui_download_in_progress').format(self.started_dt.strftime("%b %d, %I:%M%p"))) + self.label = QtWidgets.QLabel(strings._('gui_share_mode_transfer_started').format(self.started_dt.strftime("%b %d, %I:%M%p"))) # Progress bar self.progress_bar = QtWidgets.QProgressBar() @@ -110,12 +110,12 @@ class DownloadHistoryItem(HistoryItem): self.started) -class UploadHistoryItemFile(QtWidgets.QWidget): +class ReceiveHistoryItemFile(QtWidgets.QWidget): def __init__(self, common, filename): - super(UploadHistoryItemFile, self).__init__() + super(ReceiveHistoryItemFile, self).__init__() self.common = common - self.common.log('UploadHistoryItemFile', '__init__', 'filename: {}'.format(filename)) + self.common.log('ReceiveHistoryItemFile', '__init__', 'filename: {}'.format(filename)) self.filename = filename self.dir = None @@ -166,10 +166,10 @@ class UploadHistoryItemFile(QtWidgets.QWidget): """ Open the downloads folder, with the file selected, in a cross-platform manner """ - self.common.log('UploadHistoryItemFile', 'open_folder') + self.common.log('ReceiveHistoryItemFile', 'open_folder') if not self.dir: - self.common.log('UploadHistoryItemFile', 'open_folder', "dir has not been set yet, can't open folder") + self.common.log('ReceiveHistoryItemFile', 'open_folder', "dir has not been set yet, can't open folder") return abs_filename = os.path.join(self.dir, self.filename) @@ -184,15 +184,15 @@ class UploadHistoryItemFile(QtWidgets.QWidget): # macOS elif self.common.platform == 'Darwin': - subprocess.call(['open', '-R', abs_filename]) + subprocess.call(['open', '-R', abs_filename]) # Windows elif self.common.platform == 'Windows': subprocess.Popen(['explorer', '/select,{}'.format(abs_filename)]) -class UploadHistoryItem(HistoryItem): +class ReceiveHistoryItem(HistoryItem): def __init__(self, common, id, content_length): - super(UploadHistoryItem, self).__init__() + super(ReceiveHistoryItem, self).__init__() self.common = common self.id = id self.content_length = content_length @@ -259,7 +259,7 @@ class UploadHistoryItem(HistoryItem): for filename in list(data['progress']): # Add a new file if needed if filename not in self.files: - self.files[filename] = UploadHistoryItemFile(self.common, filename) + self.files[filename] = ReceiveHistoryItemFile(self.common, filename) self.files_layout.addWidget(self.files[filename]) # Update the file @@ -280,16 +280,16 @@ class UploadHistoryItem(HistoryItem): self.ended = self.started = datetime.now() if self.started.year == self.ended.year and self.started.month == self.ended.month and self.started.day == self.ended.day: if self.started.hour == self.ended.hour and self.started.minute == self.ended.minute: - text = strings._('gui_upload_finished').format( + text = strings._('gui_receive_mode_transfer_finished').format( self.started.strftime("%b %d, %I:%M%p") ) else: - text = strings._('gui_upload_finished_range').format( + text = strings._('gui_receive_mode_transfer_finished_range').format( self.started.strftime("%b %d, %I:%M%p"), self.ended.strftime("%I:%M%p") ) else: - text = strings._('gui_upload_finished_range').format( + text = strings._('gui_receive_mode_transfer_finished_range').format( self.started.strftime("%b %d, %I:%M%p"), self.ended.strftime("%b %d, %I:%M%p") ) @@ -386,7 +386,7 @@ class History(QtWidgets.QWidget): # Header self.header_label = QtWidgets.QLabel(header_text) self.header_label.setStyleSheet(self.common.css['downloads_uploads_label']) - clear_button = QtWidgets.QPushButton(strings._('gui_clear_history')) + clear_button = QtWidgets.QPushButton(strings._('gui_all_modes_clear_history')) clear_button.setStyleSheet(self.common.css['downloads_uploads_clear']) clear_button.setFlat(True) clear_button.clicked.connect(self.reset) diff --git a/onionshare_gui/mode/receive_mode/__init__.py b/onionshare_gui/mode/receive_mode/__init__.py index c53f1ea1..0cf33557 100644 --- a/onionshare_gui/mode/receive_mode/__init__.py +++ b/onionshare_gui/mode/receive_mode/__init__.py @@ -22,7 +22,7 @@ from PyQt5 import QtCore, QtWidgets, QtGui from onionshare import strings from onionshare.web import Web -from ..history import History, ToggleHistory, UploadHistoryItem +from ..history import History, ToggleHistory, ReceiveHistoryItem from .. import Mode class ReceiveMode(Mode): @@ -50,8 +50,8 @@ class ReceiveMode(Mode): self.history = History( self.common, QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/uploads_transparent.png'))), - strings._('gui_no_uploads'), - strings._('gui_uploads') + strings._('gui_receive_mode_no_files'), + strings._('gui_all_modes_history') ) self.history.hide() @@ -142,7 +142,7 @@ class ReceiveMode(Mode): """ Handle REQUEST_STARTED event. """ - item = UploadHistoryItem(self.common, event["data"]["id"], event["data"]["content_length"]) + item = ReceiveHistoryItem(self.common, event["data"]["id"], event["data"]["content_length"]) self.history.add(event["data"]["id"], item) self.toggle_history.update_indicator(True) self.history.in_progress_count += 1 diff --git a/onionshare_gui/mode/share_mode/__init__.py b/onionshare_gui/mode/share_mode/__init__.py index 0cc00f92..266aaf06 100644 --- a/onionshare_gui/mode/share_mode/__init__.py +++ b/onionshare_gui/mode/share_mode/__init__.py @@ -28,7 +28,7 @@ from onionshare.web import Web from .file_selection import FileSelection from .threads import CompressThread from .. import Mode -from ..history import History, ToggleHistory, DownloadHistoryItem +from ..history import History, ToggleHistory, ShareHistoryItem from ...widgets import Alert @@ -75,8 +75,8 @@ class ShareMode(Mode): self.history = History( self.common, QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/downloads_transparent.png'))), - strings._('gui_no_downloads'), - strings._('gui_downloads') + strings._('gui_share_mode_no_files'), + strings._('gui_all_modes_history') ) self.history.hide() @@ -240,7 +240,7 @@ class ShareMode(Mode): else: filesize = self.web.share_mode.download_filesize - item = DownloadHistoryItem(self.common, event["data"]["id"], filesize) + item = ShareHistoryItem(self.common, event["data"]["id"], filesize) self.history.add(event["data"]["id"], item) self.toggle_history.update_indicator(True) self.history.in_progress_count += 1 diff --git a/share/locale/en.json b/share/locale/en.json index 44eff150..45339333 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -48,8 +48,6 @@ "gui_receive_stop_server_shutdown_timeout_tooltip": "Auto-stop timer ends at {}", "gui_copy_url": "Copy Address", "gui_copy_hidservauth": "Copy HidServAuth", - "gui_downloads": "Download History", - "gui_no_downloads": "No Downloads Yet", "gui_canceled": "Canceled", "gui_copied_url_title": "Copied OnionShare Address", "gui_copied_url": "OnionShare address copied to clipboard", @@ -175,14 +173,18 @@ "systray_page_loaded_title": "OnionShare Page Loaded", "systray_download_page_loaded_message": "A user loaded the download page", "systray_upload_page_loaded_message": "A user loaded the upload page", - "gui_uploads": "Upload History", - "gui_no_uploads": "No Uploads Yet", - "gui_clear_history": "Clear All", - "gui_upload_in_progress": "Upload Started {}", - "gui_upload_finished_range": "Uploaded {} to {}", - "gui_upload_finished": "Uploaded {}", - "gui_download_in_progress": "Download Started {}", "gui_open_folder_error_nautilus": "Cannot open folder because nautilus is not available. The file is here: {}", "gui_settings_language_label": "Preferred language", - "gui_settings_language_changed_notice": "Restart OnionShare for your change in language to take effect." + "gui_settings_language_changed_notice": "Restart OnionShare for your change in language to take effect.", + + "gui_all_modes_history": "History", + "gui_all_modes_clear_history": "Clear All", + + "gui_share_mode_no_files": "No Files Sent Yet", + "gui_share_mode_transfer_started": "Started {}", + + "gui_receive_mode_no_files": "No Files Received Yet", + "gui_receive_mode_transfer_started": "Started {}", + "gui_receive_mode_transfer_finished_range": "Started {}, finished {}", + "gui_receive_mode_transfer_finished": "Finished {}" }