Drop concatenated title of 'Add' dialog for details of entity

As for now the 'Add' dialog title, which is initialized within
details of the entity, contains translated concatenated texts,
like:
    'Add ${other_entity} into ${entity} ${primary_key}',
where 'other_entity' and 'entity' are also translatable texts.
This construction is used via method 'show_add_dialog' of
association_facet for the all 'Add' actions within details
of entities.
The 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/7712
Fixes: https://pagure.io/freeipa/issue/7714
Reviewed-By: Serhii Tsymbaliuk <stsymbal@redhat.com>
This commit is contained in:
Stanislav Levin 2018-09-22 21:49:40 +03:00 committed by Serhii Tsymbaliuk
parent 60cb8979a5
commit a502fa939f
4 changed files with 7 additions and 16 deletions

View File

@ -32,6 +32,7 @@ IPA.entity_adder_dialog = function(spec) {
spec = spec || {};
spec.title = spec.title || '@i18n:buttons.add';
spec.name = spec.name || 'entity_adder_dialog';
var that = IPA.dialog(spec);

View File

@ -453,7 +453,7 @@ IPA.association_table_widget = function (spec) {
that.remove_method = spec.remove_method || 'remove_member';
that.read_only = spec.read_only === undefined ? false : spec.read_only;
that.add_title = text.get(spec.add_title || '@i18n:association.add.member');
that.add_title = text.get(spec.add_title);
that.remove_title = text.get(spec.remove_title);
that.adder_columns = $.ordered_map();
@ -926,7 +926,8 @@ exp.association_facet_pre_op = function(spec, context) {
}
}
spec.add_title = '@i18n:association.add.'+spec.attribute_member;
spec.add_title = spec.add_title ||
'@i18n:association.add_title_default';
spec.remove_title = spec.remove_title ||
'@i18n:association.remove_title_default';
@ -1045,7 +1046,7 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) {
that.add_method = spec.add_method || 'add_member';
that.remove_method = spec.remove_method || 'remove_member';
that.add_title = text.get(spec.add_title || '@i18n:association.add.member');
that.add_title = text.get(spec.add_title);
that.remove_title = text.get(spec.remove_title);
that.adder_columns = $.ordered_map();
@ -1203,14 +1204,10 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) {
that.show_add_dialog = function() {
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.add_title;
title = title.replace('${entity}', entity_label);
title = title.replace('${primary_key}', pkey);
title = title.replace('${other_entity}', other_entity_label);
var pkeys = that.data.result.result[that.get_attribute_name()];

View File

@ -801,6 +801,7 @@ IPA.adder_dialog = function(spec) {
spec = spec || {};
spec.title = spec.title || '@i18n:buttons.add';
spec.name = spec.name || 'adder_dialog';
var that = IPA.dialog(spec);

View File

@ -169,15 +169,7 @@ class i18n_messages(Command):
"title": _("Actions"),
},
"association": {
"add": {
"ipasudorunas": _("Add RunAs ${other_entity} into ${entity} ${primary_key}"),
"ipasudorunasgroup": _("Add RunAs Groups into ${entity} ${primary_key}"),
"managedby": _("Add ${other_entity} Managing ${entity} ${primary_key}"),
"member": _("Add ${other_entity} into ${entity} ${primary_key}"),
"memberallowcmd": _("Add Allow ${other_entity} into ${entity} ${primary_key}"),
"memberdenycmd": _("Add Deny ${other_entity} into ${entity} ${primary_key}"),
"memberof": _("Add ${entity} ${primary_key} into ${other_entity}"),
},
"add_title_default": _("Add"),
"added": _("${count} item(s) added"),
"direct_membership": _("Direct Membership"),
"filter_placeholder": _("Filter available ${other_entity}"),