From dda488efc26aa10718b751852deb87b4478d0ca9 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Mon, 24 Sep 2018 11:26:16 +0300 Subject: [PATCH] Add title to 'add' dialog for details of 'Certificate' entity To improve translation quality the title of 'Add' dialog, which is initialized within details of the entity, should be specified explicitly in the spec and should be an entire sentence. Fixes: https://pagure.io/freeipa/issue/7712 Fixes: https://pagure.io/freeipa/issue/7714 Reviewed-By: Serhii Tsymbaliuk --- install/ui/src/freeipa/certificate.js | 24 ++++++------------------ ipaserver/plugins/internal.py | 14 +++++++------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 0cb43c718..542a15620 100644 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -696,7 +696,6 @@ IPA.cert.request_action = function(spec) { spec.hide_cond = spec.hide_cond || ['ra_disabled']; var that = IPA.action(spec); - that.entity_label = spec.entity_label; that.generic = spec.generic !== undefined ? spec.generic : false; that.execute_action = function(facet) { @@ -709,15 +708,12 @@ IPA.cert.request_action = function(spec) { var certificate = facet.certificate; if (!certificate) facet.refresh(); - var entity_label = that.entity_label || facet.entity.metadata.label_singular; - entity_principal = certificate.entity_info.principal; var entity_name = certificate.entity_info.name; cn = certificate.entity_info.cn || cn; cn_name = certificate.entity_info.cn_name || cn_name; - title = text.get('@i18n:objects.cert.issue_certificate'); - title = title.replace('${entity}', entity_label); + title = text.get(spec.title) || title; title = title.replace('${primary_key}', entity_name); } @@ -823,20 +819,16 @@ IPA.cert.revoke_action = function(spec) { spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true; var that = IPA.action(spec); - that.entity_label = spec.entity_label; that.confirm_msg = spec.request_message; that.update_confirm_dialog = function(facet) { var certificate = facet.certificate; - - var entity_label = that.entity_label || facet.entity.metadata.label_singular; var entity_name = certificate.entity_info.name; var title = text.get('@i18n:objects.cert.revoke_certificate_simple'); - if (entity_name && entity_label) { - title = text.get('@i18n:objects.cert.revoke_certificate'); - title = title.replace('${entity}', entity_label); + if (entity_name) { + title = text.get(spec.title) || title; title = title.replace('${primary_key}', entity_name); } @@ -879,20 +871,16 @@ IPA.cert.remove_hold_action = function(spec) { spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true; var that = IPA.action(spec); - that.entity_label = spec.entity_label; that.update_confirm_dialog = function(facet) { var certificate = facet.certificate; - var entity_label = that.entity_label || facet.entity.metadata.label_singular; var entity_name = certificate.entity_info.name; - var title = text.get('@i18n:objects.cert.remove_certificate_hold_simple'); - if (entity_name && entity_label) { - title = text.get('@i18n:objects.cert.remove_certificate_hold'); - title = title.replace('${entity}', entity_label); + if (entity_name) { + title = text.get(spec.title) || title; title = title.replace('${primary_key}', entity_name); } @@ -1203,7 +1191,7 @@ IPA.cert.certs_widget = function(spec) { var sn = row.widget.certificate.serial_number; var message = text.get('@i18n:actions.delete_confirm'); message = message.replace('${object}', - text.get('@i18n:objects.cert.delete_cert_end') + sn); + text.get('@i18n:objects.cert.delete_cert_end') + ' ' + sn); return message; }; diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py index e94aade9f..71f6437e5 100644 --- a/ipaserver/plugins/internal.py +++ b/ipaserver/plugins/internal.py @@ -580,8 +580,10 @@ class i18n_messages(Command): "fingerprints": _("Fingerprints"), "get_certificate": _("Get Certificate"), "hold_removed": _("Certificate Hold Removed"), - "issue_certificate": _("Issue New Certificate for ${entity} ${primary_key}"), - "issue_certificate_generic": _("Issue New Certificate"), + "issue_for_user": _( + "Issue new certificate for user '${primary_key}'" + ), + "issue_certificate_generic": _("Issue new certificate"), "issued_by": _("Issued By"), "issued_on": _("Issued On"), "issued_to": _("Issued To"), @@ -595,17 +597,15 @@ class i18n_messages(Command): "present": _("${count} certificate(s) present"), "privilege_withdrawn": _("Privilege Withdrawn"), "reason": _("Reason for Revocation"), - "remove_hold": _("Remove Hold"), - "remove_certificate_hold": _("Remove Certificate Hold for ${entity} ${primary_key}"), - "remove_certificate_hold_simple": _("Remove Certificate Hold"), + "remove_hold": _("Remove hold"), + "remove_certificate_hold_simple": _("Remove certificate hold"), "remove_certificate_hold_confirmation": _("Do you want to remove the certificate hold?"), "remove_from_crl": _("Remove from CRL"), "request_message": _("
  1. Create a certificate database or use an existing one. To create a new database:
    # certutil -N -d <database path>
  2. Create a CSR with subject CN=<${cn_name}>,O=<realm>, for example:
    # certutil -R -d <database path> -a -g <key size> -s 'CN=${cn},O=${realm}'${san}
  3. Copy and paste the CSR (from -----BEGIN NEW CERTIFICATE REQUEST----- to -----END NEW CERTIFICATE REQUEST-----) into the text area below:
"), "request_message_san": _(" -8 '${cn}'"), "requested": _("Certificate requested"), "revocation_reason": _("Revocation reason"), - "revoke_certificate": _("Revoke Certificate for ${entity} ${primary_key}"), - "revoke_certificate_simple": _("Revoke Certificate"), + "revoke_certificate_simple": _("Revoke certificate"), "revoke_confirmation": _("Do you want to revoke this certificate? Select a reason from the pull-down list."), "revoked": _("Certificate Revoked"), "revoked_status": _("REVOKED"),