Skip to content

Commit 7d442e1

Browse files
committed
feat: wrap tooltip strings in translation methods
1 parent 3d3785c commit 7d442e1

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

ORStools/proc/base_processing_algorithm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def provider_parameter(self) -> QgsProcessingParameterEnum:
123123
defaultValue=providers[0],
124124
)
125125

126-
self.setToolTip(parameter, "Select the provider that should be used.")
126+
self.setToolTip(parameter, self.tr("Select the provider that should be used."))
127127

128128
return parameter
129129

@@ -150,7 +150,7 @@ def output_parameter(self) -> QgsProcessingParameterFeatureSink:
150150
name=self.OUT,
151151
description=self.GROUP,
152152
)
153-
self.setToolTip(parameter, "Select where the output should be saved.")
153+
self.setToolTip(parameter, self.tr("Select where the output should be saved."))
154154

155155
return parameter
156156

@@ -188,10 +188,10 @@ def option_parameters(self) -> [QgsProcessingParameterDefinition]:
188188
),
189189
]
190190

191-
self.setToolTip(parameters[0], "Select features that should be avoided by the algorithm.")
192-
self.setToolTip(parameters[1], "Select borders that should be avoided by the algorithm.")
193-
self.setToolTip(parameters[2], "Select countries that should be avoided by the algorithm.")
194-
self.setToolTip(parameters[3], "Select polygons that should be avoided by the algorithm.")
191+
self.setToolTip(parameters[0], self.tr("Select features that should be avoided by the algorithm."))
192+
self.setToolTip(parameters[1], self.tr("Select borders that should be avoided by the algorithm."))
193+
self.setToolTip(parameters[2], self.tr("Select countries that should be avoided by the algorithm."))
194+
self.setToolTip(parameters[3], self.tr("Select polygons that should be avoided by the algorithm."))
195195

196196
return parameters
197197

ORStools/proc/directions_lines_proc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ def __init__(self):
8787
self.setToolTip(self.PARAMETERS[0], "LineString or MultiLineString layer.")
8888
self.setToolTip(
8989
self.PARAMETERS[1],
90-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
90+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
9191
)
9292
self.setToolTip(
93-
self.PARAMETERS[2], "Dictates the cost. For longer routes don't use Shortest Path."
93+
self.PARAMETERS[2], self.tr("Dictates the cost. For longer routes don't use Shortest Path.")
9494
)
9595
self.setToolTip(
9696
self.PARAMETERS[3],
97-
"You can optionally perform a Traveling Salesman on the waypoints of each MultiPoint feature. Enabling Traveling Salesman will erase all other advanced configuration and assume the preference to be fastest Advanced Parameters: see the documentation for descriptions.",
97+
self.tr("You can optionally perform a Traveling Salesman on the waypoints of each MultiPoint feature. Enabling Traveling Salesman will erase all other advanced configuration and assume the preference to be fastest Advanced Parameters: see the documentation for descriptions."),
9898
)
9999

100100
def processAlgorithm(self, parameters, context, feedback):

ORStools/proc/directions_points_layer_proc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@ def __init__(self):
9292
),
9393
]
9494

95-
self.setToolTip(self.PARAMETERS[0], "Point or MultiPoint layer.")
95+
self.setToolTip(self.PARAMETERS[0], self.tr("Point or MultiPoint layer."))
9696
self.setToolTip(
9797
self.PARAMETERS[1],
98-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
98+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
9999
)
100100
self.setToolTip(
101101
self.PARAMETERS[2],
102-
"Before running the algorithm points are sorted by the values of this field (Be aware of the field type! Text fields will be sorted like 1,13,2,D,a,x).",
102+
self.tr("Before running the algorithm points are sorted by the values of this field (Be aware of the field type! Text fields will be sorted like 1,13,2,D,a,x)."),
103103
)
104104
self.setToolTip(
105-
self.PARAMETERS[3], "Dictates the cost. For longer routes don't use Shortest Path."
105+
self.PARAMETERS[3], self.tr("Dictates the cost. For longer routes don't use Shortest Path.")
106106
)
107107
self.setToolTip(
108108
self.PARAMETERS[4],
109-
"You can optionally perform a Traveling Salesman Optimization on the waypoints of each (Multi)Point feature. Enabling Traveling Salesman will erase all other advanced configuration and assume the preference to be fastest.",
109+
self.tr("You can optionally perform a Traveling Salesman Optimization on the waypoints of each (Multi)Point feature. Enabling Traveling Salesman will erase all other advanced configuration and assume the preference to be fastest."),
110110
)
111111

112112
def processAlgorithm(self, parameters, context, feedback):

ORStools/proc/directions_points_layers_proc.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,30 +108,30 @@ def __init__(self):
108108
defaultValue=self.MODE_SELECTION[0],
109109
),
110110
]
111-
self.setToolTip(self.PARAMETERS[0], "Only Point layers are allowed, not MultiPoint.")
111+
self.setToolTip(self.PARAMETERS[0], self.tr("Only Point layers are allowed, not MultiPoint."))
112112
self.setToolTip(
113113
self.PARAMETERS[1],
114-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
114+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
115115
)
116116
self.setToolTip(
117117
self.PARAMETERS[2],
118-
"Before running the algorithm points are sorted by the values of this field (Be aware of the field type! Text fields will be sorted like 1,13,2,D,a,x)",
118+
self.tr("Before running the algorithm points are sorted by the values of this field (Be aware of the field type! Text fields will be sorted like 1,13,2,D,a,x)"),
119119
)
120120
self.setToolTip(self.PARAMETERS[3], "Only Point layers are allowed, not MultiPoint.")
121121
self.setToolTip(
122122
self.PARAMETERS[4],
123-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
123+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
124124
)
125125
self.setToolTip(
126126
self.PARAMETERS[5],
127-
"Before running the algorithm points are sorted by the values of this field (Be aware of the field type! Text fields will be sorted like 1,13,2,D,a,x)",
127+
self.tr("Before running the algorithm points are sorted by the values of this field (Be aware of the field type! Text fields will be sorted like 1,13,2,D,a,x)"),
128128
)
129129
self.setToolTip(
130-
self.PARAMETERS[6], "Dictates the cost. For longer routes don't use Shortest Path."
130+
self.PARAMETERS[6], self.tr("Dictates the cost. For longer routes don't use Shortest Path.")
131131
)
132132
self.setToolTip(
133133
self.PARAMETERS[7],
134-
"Either 'row-by-row' until one layers has no more features or 'all-by-all' for every feature combination",
134+
self.tr("Either 'row-by-row' until one layers has no more features or 'all-by-all' for every feature combination"),
135135
)
136136

137137
# TODO: preprocess parameters to options the range cleanup below:

ORStools/proc/isochrones_layer_proc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,22 @@ def __init__(self):
104104
),
105105
]
106106

107-
self.setToolTip(self.PARAMETERS[0], "Only Point layers are allowed, not MultiPoint.")
107+
self.setToolTip(self.PARAMETERS[0], self.tr("Only Point layers are allowed, not MultiPoint."))
108108
self.setToolTip(
109109
self.PARAMETERS[1],
110-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
110+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
111111
)
112112
self.setToolTip(
113113
self.PARAMETERS[3],
114-
"Parameter needs to be a comma-separated list of integer values, no decimal points.",
114+
self.tr("Parameter needs to be a comma-separated list of integer values, no decimal points."),
115115
)
116116
self.setToolTip(
117117
self.PARAMETERS[4],
118-
"Applies a level of generalisation to the isochrone polygons generated as a smoothing_factor between 0 and 100.",
118+
self.tr("Applies a level of generalisation to the isochrone polygons generated as a smoothing_factor between 0 and 100."),
119119
)
120120
self.setToolTip(
121121
self.PARAMETERS[5],
122-
"Start treats the location(s) as starting point, destination as goal.",
122+
self.tr("Start treats the location(s) as starting point, destination as goal."),
123123
)
124124

125125
# Save some important references

ORStools/proc/isochrones_point_proc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ def __init__(self):
9090
),
9191
]
9292

93-
self.setToolTip(self.PARAMETERS[0], "Choose a Point from the map.")
93+
self.setToolTip(self.PARAMETERS[0], self.tr("Choose a Point from the map."))
9494
self.setToolTip(
9595
self.PARAMETERS[2],
96-
"Parameter needs to be a comma-separated list of integer values, no decimal points.",
96+
self.tr("Parameter needs to be a comma-separated list of integer values, no decimal points."),
9797
)
9898
self.setToolTip(
9999
self.PARAMETERS[3],
100-
"Applies a level of generalisation to the isochrone polygons generated as a smoothing_factor between 0 and 100.",
100+
self.tr("Applies a level of generalisation to the isochrone polygons generated as a smoothing_factor between 0 and 100."),
101101
)
102102
self.setToolTip(
103103
self.PARAMETERS[4],
104-
"Start treats the location(s) as starting point, destination as goal.",
104+
self.tr("Start treats the location(s) as starting point, destination as goal."),
105105
)
106106

107107
# Save some important references

ORStools/proc/matrix_proc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ def __init__(self):
8282
),
8383
]
8484

85-
self.setToolTip(self.PARAMETERS[0], "Only Point layers are allowed, not MultiPoint.")
85+
self.setToolTip(self.PARAMETERS[0], self.tr("Only Point layers are allowed, not MultiPoint."))
8686
self.setToolTip(
8787
self.PARAMETERS[1],
88-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
88+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
8989
)
9090
self.setToolTip(self.PARAMETERS[2], "Only Point layers are allowed, not MultiPoint.")
9191
self.setToolTip(
9292
self.PARAMETERS[3],
93-
"Values will transfer to the output layer and can be used to join layers or group features afterwards.",
93+
self.tr("Values will transfer to the output layer and can be used to join layers or group features afterwards."),
9494
)
9595

9696
def processAlgorithm(self, parameters, context, feedback):

0 commit comments

Comments
 (0)