diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-06-30 14:33:33 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-06-30 14:50:09 -0400 |
commit | 2a527234656a08342259ebc30af38b68a592ba8a (patch) | |
tree | bc51d3040bddff6fb4705a3630cafd20ecbc8541 /install | |
parent | d70ba68401b21cf3e46b0f9ff7005ddd77cefd80 (diff) | |
download | freeipa-2a527234656a08342259ebc30af38b68a592ba8a.tar.gz freeipa-2a527234656a08342259ebc30af38b68a592ba8a.tar.xz freeipa-2a527234656a08342259ebc30af38b68a592ba8a.zip |
Fixed hard-coded messages.
Hard-coded messages in the UI have been replaced with I18n messages.
Ticket #1396
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/association.js | 17 | ||||
-rw-r--r-- | install/ui/automount.js | 20 | ||||
-rwxr-xr-x | install/ui/certificate.js | 31 | ||||
-rw-r--r-- | install/ui/details.js | 4 | ||||
-rw-r--r-- | install/ui/dns.js | 41 | ||||
-rw-r--r-- | install/ui/entitle.js | 80 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 56 | ||||
-rw-r--r-- | install/ui/widget.js | 32 |
8 files changed, 177 insertions, 104 deletions
diff --git a/install/ui/association.js b/install/ui/association.js index 6f74bf628..92ccb6058 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -844,7 +844,8 @@ IPA.association_facet = function (spec) { 'class': 'right-aligned-facet-controls' }).appendTo(that.controls); - span.append('Show Results '); + span.append(IPA.messages.association.show_results); + span.append(' '); that.direct_radio = $('<input/>', { type: 'radio', @@ -857,7 +858,9 @@ IPA.association_facet = function (spec) { } }).appendTo(span); - span.append(' Direct Enrollment '); + span.append(' '); + span.append(IPA.messages.association.direct_enrollment); + span.append(' '); that.indirect_radio = $('<input/>', { type: 'radio', @@ -870,7 +873,8 @@ IPA.association_facet = function (spec) { } }).appendTo(span); - span.append(' Indirect Enrollment'); + span.append(' '); + span.append(IPA.messages.association.indirect_enrollment); } }; @@ -1007,7 +1011,7 @@ IPA.association_facet = function (spec) { var pkeys = that.data[that.get_attribute_name()]; if (!pkeys || !pkeys.length) { that.table.empty(); - that.table.summary.text('No entries.'); + that.table.summary.text(IPA.messages.association.no_entries); return; } @@ -1018,7 +1022,10 @@ IPA.association_facet = function (spec) { var end = that.table.current_page * that.table.page_length; end = end > total ? total : end; - var summary = 'Showing '+start+' to '+end+' of '+total+' entries.'; + var summary = IPA.messages.association.paging; + summary = summary.replace('${start}', start); + summary = summary.replace('${end}', end); + summary = summary.replace('${total}', total); that.table.summary.text(summary); var list = pkeys.slice(start-1, end); diff --git a/install/ui/automount.js b/install/ui/automount.js index d4f113d51..56c1fbfaa 100644 --- a/install/ui/automount.js +++ b/install/ui/automount.js @@ -87,21 +87,23 @@ IPA.entity_factories.automountmap = function() { fields:[{factory:IPA.method_radio_widget, name: 'method', undo: false, - label:'Map Type', - options:[{value:'add',label:'Direct'}, - {value:'add_indirect',label:'Indirect'}] + label: IPA.messages.objects.automountmap.map_type, + options: [ + { value: 'add', label: IPA.messages.objects.automountmap.direct }, + { value: 'add_indirect', label: IPA.messages.objects.automountmap.indirect } + ] }, 'automountmapname','description', { - name:'key', - label:'Mount Point', - conditional:true, + name: 'key', + label: IPA.get_method_option('automountmap_add_indirect', 'key').label, + conditional: true, undo: false }, { - name:'parentmap', - label:'Parent Map', - conditional:true, + name: 'parentmap', + label: IPA.get_method_option('automountmap_add_indirect', 'parentmap').label, + conditional: true, undo: false }] }). diff --git a/install/ui/certificate.js b/install/ui/certificate.js index 64d93f9bd..bfecfc5b4 100755 --- a/install/ui/certificate.js +++ b/install/ui/certificate.js @@ -33,17 +33,17 @@ IPA.cert.CERTIFICATE_STATUS_VALID = 1; IPA.cert.CERTIFICATE_STATUS_REVOKED = 2; IPA.cert.CRL_REASON = [ - 'Unspecified', - 'Key Compromise', - 'CA Compromise', - 'Affiliation Changed', - 'Superseded', - 'Cessation of Operation', - 'Certificate Hold', + 'unspecified', + 'key_compromise', + 'ca_compromise', + 'affiliation_changed', + 'superseded', + 'cessation_of_operation', + 'certificate_hold', null, - 'Remove from CRL', - 'Privilege Withdrawn', - 'AA Compromise' + 'remove_from_crl', + 'privilege_withdrawn', + 'aa_compromise' ]; IPA.cert.parse_dn = function(dn) { @@ -155,10 +155,11 @@ IPA.cert.revoke_dialog = function(spec) { that.select = $('<select/>').appendTo(td); for (var i=0; i<IPA.cert.CRL_REASON.length; i++) { - if (!IPA.cert.CRL_REASON[i]) continue; + var reason = IPA.cert.CRL_REASON[i]; + if (!reason) continue; $('<option/>', { 'value': i, - 'html': IPA.cert.CRL_REASON[i] + 'html': IPA.messages.objects.cert[reason] }).appendTo(that.select); } }; @@ -616,8 +617,10 @@ IPA.cert.status_widget = function(spec) { if (!that.is_selfsign()) { that.status_revoked.css('display', status == IPA.cert.CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none'); that.revoke_button.css('display', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'inline' : 'none'); - that.revocation_reason.html(revocation_reason == undefined ? '' : IPA.cert.CRL_REASON[revocation_reason]); - that.restore_button.css('display', revocation_reason == 6 ? 'inline' : 'none'); + + var reason = IPA.cert.CRL_REASON[revocation_reason]; + that.revocation_reason.html(revocation_reason === undefined || reason === null ? '' : IPA.messages.objects.cert[reason]); + that.restore_button.css('display', reason == 'certificate_hold' ? 'inline' : 'none'); } } diff --git a/install/ui/details.js b/install/ui/details.js index 17f9ab5ac..4c70530e5 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -388,7 +388,7 @@ IPA.details_facet = function(spec) { that.expand_button = IPA.action_button({ name: 'expand_all', href: 'expand_all', - label: 'Expand All', + label: IPA.messages.details.expand_all, 'class': 'right-aligned-facet-controls', style: 'display: none;', click: function() { @@ -407,7 +407,7 @@ IPA.details_facet = function(spec) { that.collapse_button = IPA.action_button({ name: 'collapse_all', href: 'collapse_all', - label: 'Collapse All', + label: IPA.messages.details.collapse_all, 'class': 'right-aligned-facet-controls', click: function() { that.expand_button.css('display', 'inline'); diff --git a/install/ui/dns.js b/install/ui/dns.js index 8bc14a309..d689a8941 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -68,11 +68,11 @@ IPA.entity_factories.dnszone = function() { }, { name: 'type', - label: 'Record Type' + label: IPA.messages.objects.dnsrecord.type }, { name: 'data', - label: 'Data' + label: IPA.messages.objects.dnsrecord.data } ] }). @@ -175,8 +175,12 @@ IPA.dnsrecord_facet = function(spec) { that.add = function() { + var title = IPA.messages.dialogs.add_title; + var label = IPA.metadata.objects.dnsrecord.label_singular; + title = title.replace('${entity}', label); + var dialog = IPA.dialog({ - title: IPA.messages.objects.dnsrecord.add + title: title }); dialog.create = function() { @@ -184,7 +188,7 @@ IPA.dnsrecord_facet = function(spec) { var dl = $('<dl/>').appendTo(dialog.container); $('<dt/>', { - html: IPA.messages.objects.dnsrecord.resource + html: IPA.get_entity_param('dnsrecord', 'idnsname').label }).appendTo(dl); var dd = $('<dd/>').appendTo(dl); @@ -275,23 +279,38 @@ IPA.dnsrecord_facet = function(spec) { }); }); + var title = IPA.messages.dialogs.remove_title; + var label = IPA.metadata.objects.dnsrecord.label; + title = title.replace('${entity}', label); + var dialog = IPA.dialog({ - title: IPA.messages.buttons.remove + title: title }); dialog.create = function() { - var to_delete_table = - $('<table class="search-table" >'+ - '<thead><tr><th>Resource</th><th>Type</th></tr></thead>'+ - '<tbody></tbody></table>').appendTo(dialog.container); + var table = $('<table/>', { + 'class': 'search-table' + }).appendTo(dialog.container); + + var thead = $('<thead/>').appendTo(table); + + var tr = $('<tr/>').appendTo(thead); + + $('<th/>', { + text: IPA.get_entity_param('dnsrecord', 'idnsname').label + }).appendTo(tr); + + $('<th/>', { + text: IPA.messages.objects.dnsrecord.type + }).appendTo(tr); - var to_delete_body = to_delete_table.find('tbody'); + var tbody = $('<tbody/>').appendTo(table); for (var i=0; i<records.length; i++) { var record = records[i]; - var tr = $('<tr></tr>').appendTo(to_delete_body); + tr = $('<tr/>').appendTo(tbody); $('<td/>', { html: record.resource diff --git a/install/ui/entitle.js b/install/ui/entitle.js index 7efec7204..e34668c42 100644 --- a/install/ui/entitle.js +++ b/install/ui/entitle.js @@ -39,12 +39,12 @@ IPA.entity_factories.entitle = function() { name: 'entitle' }). facet_groups([ - { name: 'account', label: 'Account' }, - { name: 'certificates', label: 'Certificates' } + { name: 'account', label: IPA.messages.objects.entitle.account }, + { name: 'certificates', label: IPA.messages.objects.entitle.certificates } ]). details_facet({ factory: IPA.entitle.details_facet, - label: 'Account', + label: IPA.messages.objects.entitle.account, facet_group: 'account', sections: [ { @@ -53,33 +53,33 @@ IPA.entity_factories.entitle = function() { fields: [ { name: 'uuid', - label: 'UUID', + label: IPA.get_method_option('entitle_register', 'ipaentitlementid').label, read_only: true }, { factory: IPA.entitle.download_widget, name: 'certificate', - label: 'Certificate' + label: IPA.messages.objects.entitle.certificate } ] }, { name: 'status', - label: 'Status', + label: IPA.messages.objects.entitle.status, fields: [ { name: 'product', - label: 'Product', + label: IPA.messages.objects.entitle.product, read_only: true }, { name: 'quantity', - label: 'Quantity', + label: IPA.get_method_arg('entitle_consume', 'quantity').label, read_only: true }, { name: 'consumed', - label: 'Consumed', + label: IPA.messages.objects.entitle.consumed, read_only: true } ] @@ -89,29 +89,29 @@ IPA.entity_factories.entitle = function() { search_facet({ factory: IPA.entitle.search_facet, name: 'certificates', - label: 'Certificates', + label: IPA.messages.objects.entitle.certificates, facet_group: 'certificates', columns: [ { name: 'product', - label: 'Product' + label: IPA.messages.objects.entitle.product }, { name: 'quantity', - label: 'Quantity' + label: IPA.get_method_arg('entitle_consume', 'quantity').label }, { name: 'start', - label: 'Start' + label: IPA.messages.objects.entitle.start }, { name: 'end', - label: 'End' + label: IPA.messages.objects.entitle.end }, { factory: IPA.entitle.certificate_column, name: 'certificate', - label: 'Certificate' + label: IPA.messages.objects.entitle.certificate } ] }). @@ -119,11 +119,11 @@ IPA.entity_factories.entitle = function() { dialog({ factory: IPA.entitle.register_online_dialog, name: 'online_registration', - title: 'Registration', + title: IPA.messages.objects.entitle.registration, fields: [ { name: 'username', - label: 'Username', + label: IPA.get_method_arg('entitle_register', 'username').label, undo: false }, { @@ -142,13 +142,12 @@ IPA.entity_factories.entitle = function() { dialog({ factory: IPA.entitle.register_offline_dialog, name: 'offline_registration', - title: 'Import Certificate', - message: 'Enter the Base64-encoded entitlement certificate below:', - label: 'Import', + title: IPA.messages.objects.entitle.import_certificate, + message: IPA.messages.objects.entitle.import_message, fields: [ { name: 'certificate', - label: 'Certificate', + label: IPA.messages.objects.entitle.certificate, undo: false } ] @@ -156,11 +155,11 @@ IPA.entity_factories.entitle = function() { dialog({ factory: IPA.entitle.consume_dialog, name: 'consume', - title: 'Consume Entitlement', + title: IPA.messages.objects.entitle.consume_entitlement, fields: [ { name: 'quantity', - label: 'Quantity', + label: IPA.get_method_arg('entitle_consume', 'quantity').label, undo: false, metadata: IPA.get_method_arg('entitle_consume', 'quantity') } @@ -169,13 +168,12 @@ IPA.entity_factories.entitle = function() { dialog({ factory: IPA.entitle.import_dialog, name: 'import', - title: 'Import Certificate', - message: 'Enter the Base64-encoded entitlement certificate below:', - label: 'Import', + title: IPA.messages.objects.entitle.import_certificate, + message: IPA.messages.objects.entitle.import_message, fields: [ { name: 'certificate', - label: 'Certificate', + label: IPA.messages.objects.entitle.certificate, undo: false } ] @@ -338,7 +336,7 @@ IPA.entitle.details_facet = function(spec) { that.register_online_button = IPA.action_button({ name: 'register', - label: 'Register', + label: IPA.messages.objects.entitle.register, icon: 'ui-icon-plus', click: function() { var dialog = that.entity.get_dialog('online_registration'); @@ -351,7 +349,7 @@ IPA.entitle.details_facet = function(spec) { /* that.register_offline_button = IPA.action_button({ name: 'import', - label: 'Import', + label: IPA.messages.objects.entitle.import, icon: 'ui-icon-plus', click: function() { var dialog = that.entity.get_dialog('offline_registration'); @@ -367,7 +365,7 @@ IPA.entitle.details_facet = function(spec) { that.refresh = function() { var summary = $('span[name=summary]', that.container).empty(); - summary.append('Loading...'); + summary.append(IPA.messages.objects.entitle.loading); function on_success(data, text_status, xhr) { if (that.entity.status == IPA.entitle.unregistered) { @@ -427,7 +425,7 @@ IPA.entitle.search_facet = function(spec) { that.consume_button = IPA.action_button({ name: 'consume', - label: 'Consume', + label: IPA.messages.objects.entitle.consume, icon: 'ui-icon-plus', click: function() { var dialog = that.entity.get_dialog('consume'); @@ -440,7 +438,7 @@ IPA.entitle.search_facet = function(spec) { that.import_button = IPA.action_button({ name: 'import', - label: 'Import', + label: IPA.messages.objects.entitle.import_button, icon: 'ui-icon-plus', click: function() { var dialog = that.entity.get_dialog('import'); @@ -516,10 +514,10 @@ IPA.entitle.certificate_column = function(spec) { $('<a/>', { 'href': '#download', - 'html': 'Download', + 'html': IPA.messages.objects.entitle.download, 'click': function() { var dialog = IPA.cert.download_dialog({ - title: 'Download Certificate', + title: IPA.messages.objects.entitle.download_certificate, certificate: certificate, add_pem_delimiters: false }); @@ -576,7 +574,7 @@ IPA.entitle.register_online_dialog = function(spec) { var that = IPA.dialog(spec); - that.add_button('Register', function() { + that.add_button(IPA.messages.objects.entitle.register, function() { var record = {}; that.save(record); @@ -593,7 +591,7 @@ IPA.entitle.register_online_dialog = function(spec) { ); }); - that.add_button('Cancel', function() { + that.add_button(IPA.messages.buttons.cancel, function() { that.close(); }); @@ -631,7 +629,7 @@ IPA.entitle.consume_dialog = function(spec) { var that = IPA.dialog(spec); - that.add_button('Consume', function() { + that.add_button(IPA.messages.objects.entitle.consume, function() { if (!that.is_valid()) { return; @@ -651,7 +649,7 @@ IPA.entitle.consume_dialog = function(spec) { ); }); - that.add_button('Cancel', function() { + that.add_button(IPA.messages.buttons.cancel, function() { that.close(); }); @@ -692,18 +690,18 @@ IPA.entitle.download_widget = function(spec) { that.create = function(container) { that.link = $('<a/>', { 'href': '#download', - 'html': 'Download', + 'html': IPA.messages.objects.entitle.download, 'click': function() { that.entity.get_accounts( function(data, text_status, xhr) { var userpkcs12 = data.result.result[0].userpkcs12; if (!userpkcs12) { - alert('No certificate.'); + alert(IPA.messages.objects.entitle.no_certificate); return; } var dialog = IPA.cert.download_dialog({ - title: 'Download Certificate', + title: IPA.messages.objects.entitle.download_certificate, certificate: userpkcs12[0].__base64__, add_pem_delimiters: false }); diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 5fe3eb4d8..0dd77585e 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -15553,7 +15553,12 @@ }, "association": { "add": "Add ${other_entity} into ${entity} ${primary_key}", - "remove": "Remove ${other_entity} from ${entity} ${primary_key}" + "direct_enrollment": "Direct Enrollment", + "indirect_enrollment": "Indirect Enrollment", + "no_entries": "No entries.", + "paging": "Showing ${start} to ${end} of ${total} entries.", + "remove": "Remove ${other_entity} from ${entity} ${primary_key}", + "show_results": "Show Results" }, "buttons": { "add": "Add", @@ -15577,6 +15582,8 @@ "view": "View" }, "details": { + "collapse_all": "Collapse All", + "expand_all": "Expand All", "general": "General", "identity": "Identity Settings", "settings": "${entity} ${primary_key} Settings", @@ -15615,7 +15622,11 @@ "automountlocation": { "identity": "Automount Location Settings" }, - "automountmap": {}, + "automountmap": { + "direct": "Direct", + "indirect": "Indirect", + "map_type": "Map Type" + }, "cert": { "aa_compromise": "AA Compromise", "affiliation_changed": "Affiliation Changed", @@ -15663,13 +15674,33 @@ "delegation": {}, "dnsrecord": { "data": "Data", - "resource": "Resource", "title": "Records for DNS Zone", - "type": "Type" + "type": "Record Type" }, "dnszone": { "identity": "DNS Zone Settings" }, + "entitle": { + "account": "Account", + "certificate": "Certificate", + "certificates": "Certificates", + "consume": "Consume", + "consume_entitlement": "Consume Entitlement", + "consumed": "Consumed", + "download": "Download", + "download_certificate": "Download Certificate", + "end": "End", + "import_button": "Import", + "import_certificate": "Import Certificate", + "import_message": "Enter the Base64-encoded entitlement certificate below:", + "loading": "Loading...", + "no_certificate": "No Certificate.", + "product": "Product", + "register": "Register", + "registration": "Registration", + "start": "Start", + "status": "Status" + }, "group": { "details": "Group Settings", "posix": "Is this a POSIX group?" @@ -15820,8 +15851,17 @@ "sudo": "Sudo" }, "widget": { + "next": "Next", "optional": "Optional field: click to show", - "validation_error": "Text does not match field pattern" + "page": "Page", + "prev": "Prev", + "validation": { + "error": "Text does not match field pattern", + "integer": "Must be an integer", + "max_value": "Maximum value is ${value}", + "min_value": "Minimum value is ${value}", + "required": "Required field" + } } } }, @@ -15848,17 +15888,17 @@ ], "krbextradata": [ { - "__base64__": "AAgBAA==" + "__base64__": "AAKl9AlOcm9vdC9hZG1pbkBTRVJWRVIxNS5BWU9VTkcuQk9TVE9OLkRFVkVMLlJFREhBVC5DT00A" }, { - "__base64__": "AAKl9AlOcm9vdC9hZG1pbkBTRVJWRVIxNS5BWU9VTkcuQk9TVE9OLkRFVkVMLlJFREhBVC5DT00A" + "__base64__": "AAgBAA==" } ], "krblastpwdchange": [ "20110628153501Z" ], "krblastsuccessfulauth": [ - "20110629132818Z" + "20110630175326Z" ], "krbpasswordexpiration": [ "20110926153501Z" diff --git a/install/ui/widget.js b/install/ui/widget.js index 5277389ed..c2b13778f 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -78,6 +78,7 @@ IPA.widget = function(spec) { that.hide_error(); that.valid = true; + var message; var values = that.save(); if (!values || !values.length) { @@ -85,7 +86,7 @@ IPA.widget = function(spec) { that.param_info.required && !that.optional) { that.valid = false; - that.show_error('required field'); + that.show_error(IPA.messages.widget.validation.required); } return; } @@ -99,22 +100,23 @@ IPA.widget = function(spec) { if (that.metadata.type == 'int') { if (!value.match(/^-?\d+$/)) { that.valid = false; - // TODO: I18n - that.show_error('must be an integer'); + that.show_error(IPA.messages.widget.validation.integer); return; } if (that.metadata.minvalue && value < that.metadata.minvalue) { that.valid = false; - // TODO: I18n - that.show_error('minimum value is '+that.metadata.minvalue); + message = IPA.messages.widget.validation.min_value; + message = message.replace('${value}', that.metadata.minvalue); + that.show_error(message); return; } if (that.metadata.maxvalue && value > that.metadata.maxvalue) { that.valid = false; - // TODO: I18n - that.show_error('maximum value is '+that.metadata.maxvalue); + message = IPA.messages.widget.validation.max_value; + message = message.replace('${value}', that.metadata.maxvalue); + that.show_error(message); return; } } @@ -386,7 +388,7 @@ IPA.text_widget = function(spec) { $('<span/>', { name: 'error_link', - html: IPA.messages.widget.validation_error, + html: IPA.messages.widget.validation.error, 'class': 'ui-state-error ui-corner-all', style: 'display:none' }).appendTo(container); @@ -541,7 +543,7 @@ IPA.multivalued_text_widget = function(spec) { $('<span/>', { name: 'error_link', - html: IPA.messages.widget.validation_error, + html: IPA.messages.widget.validation.error, 'class': 'ui-state-error ui-corner-all', style: 'display:none' }).appendTo(div); @@ -1065,7 +1067,7 @@ IPA.textarea_widget = function (spec) { $("<span/>",{ name:'error_link', - html: IPA.messages.widget.validation_error, + html: IPA.messages.widget.validation.error, "class":"ui-state-error ui-corner-all", style:"display:none" }).appendTo(container); @@ -1134,7 +1136,7 @@ IPA.column = function (spec) { if (param_info) { that.label = param_info.label; } else { - alert('cannot find label for ' + that.entity_name + ' ' + + alert('Cannot find label for ' + that.entity_name + ' ' + that.name); } } @@ -1370,7 +1372,7 @@ IPA.table_widget = function (spec) { if (that.page_length) { $('<a/>', { - text: 'Prev', + text: IPA.messages.widget.prev, name: 'prev_page', click: function() { that.prev_page(); @@ -1381,7 +1383,7 @@ IPA.table_widget = function (spec) { that.pagination.append(' '); $('<a/>', { - text: 'Next', + text: IPA.messages.widget.next, name: 'next_page', click: function() { that.next_page(); @@ -1389,7 +1391,9 @@ IPA.table_widget = function (spec) { } }).appendTo(that.pagination); - that.pagination.append(' Page: '); + that.pagination.append(' '); + that.pagination.append(IPA.messages.widget.page); + that.pagination.append(': '); that.current_page_input = $('<input/>', { type: 'text', |