|
28 | 28 | fill_combo_box, |
29 | 29 | pack_locales_data_into_list, |
30 | 30 | pack_list_data_into_list_widget, |
| 31 | + get_default_language, |
31 | 32 | ) |
32 | 33 | from .utils import get_widget_text_value, reset_widget |
33 | 34 |
|
@@ -239,22 +240,27 @@ def set_ui_from_data(self): |
239 | 240 | # incoming type: possible list of strings or dictionary |
240 | 241 | # limitation: even if YAML had just a list of strings, it will be interpreted here as "en" locale by default |
241 | 242 |
|
| 243 | + default_language = get_default_language(config_data) |
| 244 | + |
242 | 245 | # title |
243 | 246 | pack_locales_data_into_list( |
244 | 247 | config_data.metadata.identification.title, |
245 | 248 | self.dialog.listWidgetMetadataIdTitle, |
| 249 | + default_language, |
246 | 250 | ) |
247 | 251 |
|
248 | 252 | # description |
249 | 253 | pack_locales_data_into_list( |
250 | 254 | config_data.metadata.identification.description, |
251 | 255 | self.dialog.listWidgetMetadataIdDescription, |
| 256 | + default_language, |
252 | 257 | ) |
253 | 258 |
|
254 | 259 | # keywords |
255 | 260 | pack_locales_data_into_list( |
256 | 261 | config_data.metadata.identification.keywords, |
257 | 262 | self.dialog.listWidgetMetadataIdKeywords, |
| 263 | + default_language, |
258 | 264 | ) |
259 | 265 | set_combo_box_value_from_data( |
260 | 266 | combo_box=self.dialog.comboBoxMetadataIdKeywordsType, |
@@ -336,6 +342,7 @@ def refresh_resources_list_ui(self): |
336 | 342 | def set_resource_ui_from_data(self, res_data: ResourceConfigTemplate): |
337 | 343 | """Set values for Resource UI from resource data.""" |
338 | 344 | dialog = self.dialog |
| 345 | + config_data: ConfigData = self.dialog.config_data |
339 | 346 |
|
340 | 347 | # first, reset some fields to defaults (e.g. for data setting, or optional - they might not have a new value to overwrite it) |
341 | 348 | # data entry fields |
@@ -364,20 +371,23 @@ def set_resource_ui_from_data(self, res_data: ResourceConfigTemplate): |
364 | 371 | value=res_data.type, |
365 | 372 | ) |
366 | 373 |
|
| 374 | + # data with locales |
| 375 | + default_language = get_default_language(config_data) |
| 376 | + |
367 | 377 | # title |
368 | 378 | pack_locales_data_into_list( |
369 | | - res_data.title, |
370 | | - dialog.listWidgetResTitle, |
| 379 | + res_data.title, dialog.listWidgetResTitle, default_language |
371 | 380 | ) |
372 | 381 |
|
373 | 382 | # description |
374 | 383 | pack_locales_data_into_list( |
375 | | - res_data.description, |
376 | | - dialog.listWidgetResDescription, |
| 384 | + res_data.description, dialog.listWidgetResDescription, default_language |
377 | 385 | ) |
378 | 386 |
|
379 | 387 | # keywords |
380 | | - pack_locales_data_into_list(res_data.keywords, dialog.listWidgetResKeywords) |
| 388 | + pack_locales_data_into_list( |
| 389 | + res_data.keywords, dialog.listWidgetResKeywords, default_language |
| 390 | + ) |
381 | 391 |
|
382 | 392 | # visibility |
383 | 393 | set_combo_box_value_from_data( |
|
0 commit comments