Skip to content

Commit

Permalink
Fix some strings not translated, format() after the tr()
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Mar 21, 2023
1 parent decb483 commit fcd36a9
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions lizmap/definitions/filter_by_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def __init__(self):
'header': tr('Format'),
'default': '',
'tooltip': tr(
'It can be select, which will show a combo box, or checkboxes which will show one checkbox for each distinct value. '
'The distinct values are dynamically queried by Lizmap Web Client.')
'It can be select, which will show a combo box, or checkboxes which will show one checkbox for each '
'distinct value. The distinct values are dynamically queried by Lizmap Web Client.')
}
self._layer_config['splitter'] = {
'type': InputType.Text,
Expand Down
8 changes: 4 additions & 4 deletions lizmap/definitions/locate_by_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ def __init__(self):
'header': tr('Number of characters before autocompletion'),
'default': 0,
'tooltip': tr(
'If you set a value above 0, autocompletion will be used after this amount of characters while the user types. '
'The classical combobox will be replaced by a editable text input.')
'If you set a value above 0, autocompletion will be used after this amount of characters while the '
'user types. The classical combobox will be replaced by a editable text input.')
}
self._layer_config['filterOnLocate'] = {
'type': InputType.CheckBox,
'header': tr('Filter layer on zoom'),
'default': False,
'tooltip': tr(
'If the layer is published via the attribute layers tool below, and this checkbox is checked, '
'zooming on a feature with the locate tool will trigger the filter of the layer for the selected feature. '
'Only the selected feature will be visible on the map.')
'zooming on a feature with the locate tool will trigger the filter of the layer for the selected '
'feature. Only the selected feature will be visible on the map.')
}

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion lizmap/forms/base_edition_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def validate(self):
if widget.currentField() == '':
names = re.findall('.[^A-Z]*', k)
names = [n.lower().replace('_', ' ') for n in names]
msg = tr('The field "{}" is mandatory.'.format(' '.join(names)))
msg = tr('The field "{}" is mandatory.').format(' '.join(names))
return msg

return None
Expand Down
4 changes: 2 additions & 2 deletions lizmap/forms/edition_edition.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def open_wizard_group(self):
if not layer:
return

helper = tr("Setting groups for the layer editing capabilities '{}'".format(layer.name()))
helper = tr("Setting groups for the layer editing capabilities '{}'").format(layer.name())
super().open_wizard_dialog(helper)

def validate(self) -> str:
Expand Down Expand Up @@ -176,5 +176,5 @@ def validate(self) -> str:
missing_layers = [QgsProject.instance().mapLayer(layer_id).name() for layer_id in missing_layers]
msg = tr(
'The layer "{}" for the snapping must be checked in the "WFS Capabilities"\n'
' option of the QGIS Server tab in the "Project Properties" dialog.'.format(', '.join(missing_layers)))
' option of the QGIS Server tab in the "Project Properties" dialog.').format(', '.join(missing_layers))
return msg
2 changes: 1 addition & 1 deletion lizmap/forms/layout_edition.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,5 @@ def validate(self) -> str:

def open_wizard_group(self):
""" Open the wizard about ACL. """
helper = tr("Setting groups for the layout print capabilities '{}'".format(self.layout.text()))
helper = tr("Setting groups for the layout print capabilities '{}'").format(self.layout.text())
super().open_wizard_dialog(helper)
8 changes: 3 additions & 5 deletions lizmap/lizmap_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ def __init__(self, project, fix_json=False):
), (
'nominatim',
tr('Nominatim (OSM)'),
tr(
'Nominatim is using OpenStreetMap data'
),
tr('Nominatim is using OpenStreetMap data'),
('icons', 'osm-32-32.png'),
), (
'google',
Expand Down Expand Up @@ -393,8 +391,8 @@ def __init__(self, project, fix_json=False):
'expand_at_startup',
tr('Show legend image at startup'),
tr(
'The legend image will be displayed be default at startup. This will make more request to QGIS '
'server. Use with cautious.'
'The legend image will be displayed be default at startup. This will make more request to '
'QGIS server. Use with cautious.'
),
':images/themes/default/mActionShowAllLayers.svg',
), (
Expand Down
16 changes: 10 additions & 6 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,13 @@ def target_repository_changed(self):
def refresh_combo_repositories(self):
""" Refresh the combobox about repositories. """
# Set the default error message that could happen for the dataviz
# TODO change to latest 3.6.X in a few months
error = tr(
"Your current version of the selected server doesn't support the plot preview. "
"You must upgrade at least to Lizmap Web Client "
"<a href=\"https://github.com/3liz/lizmap-web-client/releases/tag/3.6.1\">3.6.1</a>."
"\n\n"
"Upgrade to the latest 3.6.X available."
)
self.dlg.dataviz_error_message.setText(error)

Expand Down Expand Up @@ -1331,7 +1334,7 @@ def open_wizard_group_layer(self):
layer = self._current_selected_layer()
if not layer:
return
helper = tr("Setting groups for the layer visibility '{}'".format(layer.name()))
helper = tr("Setting groups for the layer visibility '{}'").format(layer.name())
self._open_wizard_group(line_edit, helper)

def open_wizard_group_project(self):
Expand Down Expand Up @@ -2582,7 +2585,9 @@ def write_project_config_file(self):

server_metadata = self.dlg.server_combo.currentData(ServerComboData.JsonMetadata.value)

if is_lizmap_dot_com_hosting(server_metadata):
if server_metadata and is_lizmap_dot_com_hosting(server_metadata):
# This shouldn't happen, but if we are very quick closing the plugin, we might not have metadata yet.
# Ticket https://github.com/3liz/lizmap-plugin/issues/481
error, results = valid_saas_lizmap_dot_com(self.project)
if error:
warnings.append(Warnings.SaasLizmapDotCom.value)
Expand Down Expand Up @@ -3095,7 +3100,7 @@ def save_cfg_file(self) -> bool:
'{}\n\n{}\n\n{}'.format(
tr(
"Your Lizmap Web Client target version {version} has not been found in the server "
"table.".format(version=lwc_version.value)),
"table.").format(version=lwc_version.value),
tr(
"Either check your Lizmap Web Client target version in the first panel of the plugin or "
"check you have provided the correct server URL."
Expand Down Expand Up @@ -3192,9 +3197,8 @@ def save_cfg_file(self) -> bool:
return False

msg = tr(
'Lizmap configuration file has been updated and sent to the FTP {}.'.format(
self.server_ftp.host)
)
'Lizmap configuration file has been updated and sent to the FTP {}.'
).format(self.server_ftp.host)

self.iface.messageBar().pushMessage(
'Lizmap',
Expand Down
2 changes: 1 addition & 1 deletion lizmap/server_lwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _edit_row(self, row: int, server_url: str, auth_id: str, name: str):

# LWC Version
cell = QTableWidgetItem()
cell.setText(tr(''))
cell.setText('')
cell.setData(Qt.UserRole, None)
self.table.setItem(row, TableCell.LizmapVersion.value, cell)

Expand Down

0 comments on commit fcd36a9

Please sign in to comment.