From 967451b53ff40fba3acf8d5d128f6fd8c6bd4656 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Tue, 7 Jul 2020 13:18:27 +0300 Subject: [PATCH 1/3] Use three dots instead of elipsis. pylupdate5 hardcodes the output to ascii symbols, therefore any unicode is XML encoded and cannot be reverted to the original state. Enforcing `codecForTr` to be utf8 does not work: https://github.com/baoboa/pyqt5/blob/31ef42563dbcaf3885da8803e2e5d84507141c9b/pylupdate/pylupdate_main.py#L231 As the output is hardcoded as ASCII in https://github.com/baoboa/pyqt5/blob/31ef42563dbcaf3885da8803e2e5d84507141c9b/pylupdate/metatranslator.cpp#L435 --- qfieldsync/core/offline_converter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qfieldsync/core/offline_converter.py b/qfieldsync/core/offline_converter.py index 161542c2..98de08c6 100644 --- a/qfieldsync/core/offline_converter.py +++ b/qfieldsync/core/offline_converter.py @@ -103,7 +103,7 @@ def convert(self): for layer in self.__layers: original_layer_info[layer.id()] = (layer.source(), layer.name()) - self.total_progress_updated.emit(0, 1, self.tr('Creating base map…')) + self.total_progress_updated.emit(0, 1, self.tr('Creating base map...')) # Create the base map before layers are removed if self.project_configuration.create_base_map: if 'processing' not in qgis.utils.plugins: @@ -123,7 +123,7 @@ def convert(self): copied_files = list() for current_layer_index, layer in enumerate(self.__layers): self.total_progress_updated.emit(current_layer_index - len(self.__offline_layers), len(self.__layers), - self.tr('Copying layers…')) + self.tr('Copying layers...')) layer_source = LayerSource(layer) if layer_source.action == SyncAction.OFFLINE: @@ -257,7 +257,7 @@ def createBaseMapLayer(self, map_theme, layer, tile_size, map_units_per_pixel): @pyqtSlot(int, int) def on_offline_editing_next_layer(self, layer_index, layer_count): - msg = self.tr('Packaging layer {layer_name}…').format(layer_name=self.__offline_layers[layer_index - 1].name()) + msg = self.tr('Packaging layer {layer_name}...').format(layer_name=self.__offline_layers[layer_index - 1].name()) self.total_progress_updated.emit(layer_index, layer_count, msg) @pyqtSlot('QgsOfflineEditing::ProgressMode', int) From e05d817a121eadb13facf5cf7cb661e98ca63694 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Wed, 8 Jul 2020 15:51:47 +0300 Subject: [PATCH 2/3] Use the obsolete QObject::trUtf8 just to push the changes, later use the .pro workaround --- qfieldsync/core/offline_converter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qfieldsync/core/offline_converter.py b/qfieldsync/core/offline_converter.py index 98de08c6..66c890e7 100644 --- a/qfieldsync/core/offline_converter.py +++ b/qfieldsync/core/offline_converter.py @@ -103,7 +103,7 @@ def convert(self): for layer in self.__layers: original_layer_info[layer.id()] = (layer.source(), layer.name()) - self.total_progress_updated.emit(0, 1, self.tr('Creating base map...')) + self.total_progress_updated.emit(0, 1, self.trUtf8('Creating base map…')) # Create the base map before layers are removed if self.project_configuration.create_base_map: if 'processing' not in qgis.utils.plugins: @@ -123,7 +123,7 @@ def convert(self): copied_files = list() for current_layer_index, layer in enumerate(self.__layers): self.total_progress_updated.emit(current_layer_index - len(self.__offline_layers), len(self.__layers), - self.tr('Copying layers...')) + self.trUtf8('Copying layers…')) layer_source = LayerSource(layer) if layer_source.action == SyncAction.OFFLINE: @@ -257,7 +257,7 @@ def createBaseMapLayer(self, map_theme, layer, tile_size, map_units_per_pixel): @pyqtSlot(int, int) def on_offline_editing_next_layer(self, layer_index, layer_count): - msg = self.tr('Packaging layer {layer_name}...').format(layer_name=self.__offline_layers[layer_index - 1].name()) + msg = self.trUtf8('Packaging layer {layer_name}…').format(layer_name=self.__offline_layers[layer_index - 1].name()) self.total_progress_updated.emit(layer_index, layer_count, msg) @pyqtSlot('QgsOfflineEditing::ProgressMode', int) From 5148db53e2ac83d7d6c246c87ed5e94536458f70 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 13 Jul 2020 15:26:35 +0300 Subject: [PATCH 3/3] Forgotten trUtf8 method --- qfieldsync/core/offline_converter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qfieldsync/core/offline_converter.py b/qfieldsync/core/offline_converter.py index 66c890e7..37d4c8b3 100644 --- a/qfieldsync/core/offline_converter.py +++ b/qfieldsync/core/offline_converter.py @@ -62,6 +62,9 @@ def __init__(self, project, export_folder, extent, offline_editing): self.__convertor_progress = None # for processing feedback self.__layers = list() + # elipsis workaround + self.trUtf8 = self.tr + self.export_folder = export_folder self.extent = extent self.offline_editing = offline_editing