From ca68848ea463215fc979346328c05c33810f1436 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Sun, 16 Sep 2018 22:52:46 +0300 Subject: [PATCH] Drop concatenated title of remove dialog As for now the default title of remove dialogs, which are initialized from 'association' facet, is set to something like 'Remove ${other_entity} from ${entity} ${primary_key}', where 'other_entity' and 'entity' are also translatable texts. This construction is used via method 'show_remove_dialog' of 'association' facet for the all 'Delete' actions within details of entities. Such concatenation leads to a bad quality translation and should be changed to an entire sentence. From now a mentioned title is taken from a spec and should be specified explicitly. Fixes: https://pagure.io/freeipa/issue/7702 Reviewed-By: Serhii Tsymbaliuk --- install/ui/src/freeipa/association.js | 11 ++++------- ipaserver/plugins/internal.py | 10 +--------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index b2f8f7e97..586054503 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -454,7 +454,7 @@ IPA.association_table_widget = function (spec) { that.read_only = spec.read_only === undefined ? false : spec.read_only; that.add_title = text.get(spec.add_title || '@i18n:association.add.member'); - that.remove_title = text.get(spec.remove_title || '@i18n:association.remove.member'); + that.remove_title = text.get(spec.remove_title); that.adder_columns = $.ordered_map(); @@ -931,7 +931,8 @@ exp.association_facet_pre_op = function(spec, context) { } spec.add_title = '@i18n:association.add.'+spec.attribute_member; - spec.remove_title = '@i18n:association.remove.'+spec.attribute_member; + spec.remove_title = spec.remove_title || + '@i18n:association.remove_title_default'; spec.facet_group = spec.facet_group || spec.attribute_member; @@ -1049,7 +1050,7 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) { that.remove_method = spec.remove_method || 'remove_member'; that.add_title = text.get(spec.add_title || '@i18n:association.add.member'); - that.remove_title = text.get(spec.remove_title || '@i18n:association.remove.member'); + that.remove_title = text.get(spec.remove_title); that.adder_columns = $.ordered_map(); @@ -1272,14 +1273,10 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) { return; } - var entity_label = that.entity.metadata.label_singular; var pkey = that.get_pkey(); - var other_entity_label = that.other_entity.metadata.label; var title = that.remove_title; - title = title.replace('${entity}', entity_label); title = title.replace('${primary_key}', pkey); - title = title.replace('${other_entity}', other_entity_label); var dialog = IPA.association_deleter_dialog({ title: title, diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py index 142560d93..9b92552b7 100644 --- a/ipaserver/plugins/internal.py +++ b/ipaserver/plugins/internal.py @@ -184,15 +184,7 @@ class i18n_messages(Command): "indirect_membership": _("Indirect Membership"), "no_entries": _("No entries."), "paging": _("Showing ${start} to ${end} of ${total} entries."), - "remove": { - "ipasudorunas": _("Remove RunAs ${other_entity} from ${entity} ${primary_key}"), - "ipasudorunasgroup": _("Remove RunAs Groups from ${entity} ${primary_key}"), - "managedby": _("Remove ${other_entity} Managing ${entity} ${primary_key}"), - "member": _("Remove ${other_entity} from ${entity} ${primary_key}"), - "memberallowcmd": _("Remove Allow ${other_entity} from ${entity} ${primary_key}"), - "memberdenycmd": _("Remove Deny ${other_entity} from ${entity} ${primary_key}"), - "memberof": _("Remove ${entity} ${primary_key} from ${other_entity}"), - }, + "remove_title_default": _("Remove"), "removed": _("${count} item(s) removed"), "show_results": _("Show Results"), },