On 6/30/2011 11:45 AM, Endi Sukma Dewata wrote:
On 6/30/2011 9:37 AM, Endi Sukma Dewata wrote:
Hard-coded messages in the UI have been replaced with I18n messages.

Ticket #1396

Rebased.

Sent the wrong patch, attached should be the right one.

--
Endi S. Dewata
From 4307e19f772bb6883f683e522e49aadcd2a9064f Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Tue, 28 Jun 2011 10:59:09 -0500
Subject: [PATCH] Fixed hard-coded messages.

Hard-coded messages in the UI have been replaced with I18n messages.

Ticket #1396
---
 install/ui/association.js          |   17 +++++--
 install/ui/automount.js            |   20 +++++----
 install/ui/certificate.js          |   31 ++++++++------
 install/ui/details.js              |    4 +-
 install/ui/dns.js                  |   41 +++++++++++++-----
 install/ui/entitle.js              |   80 +++++++++++++++++------------------
 install/ui/test/data/ipa_init.json |   52 ++++++++++++++++++++---
 install/ui/widget.js               |   32 ++++++++------
 ipalib/plugins/internal.py         |   65 +++++++++++++++++++++++------
 9 files changed, 225 insertions(+), 117 deletions(-)

diff --git a/install/ui/association.js b/install/ui/association.js
index 6f74bf628fbec4c8019b12dfac4edf78d3f6953e..92ccb60581f21480c44bbd4f59e20d4295fe50e0 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 d4f113d516f570b4b7e133236e3227170ffa01d8..56c1fbfaa2a1c0169b881a651bed690388f3d732 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 64d93f9bd05067ded6c2800b9eda4091b9236ba1..bfecfc5b408dd7cc9d89ea3d251defaaaafdc1b5 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 17f9ab5ac4f6ac67c475c66b90ec7c5992a631fb..4c70530e583aeeb675214ffcb002b6d1f029fbdf 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 8bc14a309eac9e46fa757b2bc9009484e34f76c9..d689a89417e883a66152fa349d4a0f51292e1b47 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 to_delete_body =  to_delete_table.find('tbody');
+            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 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 7efec72045ee2857a1b3c831e03f74235559339e..e34668c42a8bbaa6d0f01d614a8674bb17b98b99 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 5fe3eb4d87de35c23055e12bdba1f7ff16ce9739..f99d289191a4482213d3b8d62b9899fd1367e863 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",
@@ -15654,22 +15665,40 @@
                             "view_certificate": "Certificate for ${entity} ${primary_key}"
                         },
                         "config": {
-                            "cn": "Name",
                             "group": "Group Options",
-                            "ipaserver": "Configuration",
                             "search": "Search Options",
                             "user": "User Options"
                         },
                         "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 +15849,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"
+                        }
                     }
                 }
             },
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 5277389eddf1dddb3ec5f218d7021757f9eb06eb..c2b13778fca45e6fab6d441cb23dda02f3e2cd6d 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',
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 4fa3f49338ae96aa60caeef107aaa8fdf422761c..6a8812c3241757b415f2f360cb84be0ce6d5b39a 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -102,6 +102,9 @@ class i18n_messages(Command):
                 "identity":_("Automount Location Settings")
                 },
             "automountmap": {
+                "map_type":_("Map Type"),
+                "direct":_("Direct"),
+                "indirect":_("Indirect"),
                 },
             "automountkey": {
                 },
@@ -145,8 +148,6 @@ class i18n_messages(Command):
                 "restore_certificate":_("Restore Certificate for ${entity} ${primary_key}"),
                 },
             "config": {
-                "ipaserver":_("Configuration"),
-                "cn":_("Name"),
                 "user":_("User Options"),
                 "search":_("Search Options"),
                 "group":_("Group Options"),
@@ -157,11 +158,31 @@ class i18n_messages(Command):
                 "identity":_("DNS Zone Settings"),
                 },
             "dnsrecord": {
-                "resource":_("Resource"),
-                "type":_("Type"),
+                "type":_("Record Type"),
                 "data":_("Data"),
                 "title":_("Records for DNS Zone"),
                 },
+            "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?"),
@@ -295,7 +316,7 @@ class i18n_messages(Command):
                 "password_must_match":_("Passwords must match"),
                 },
             },
-        "buttons":{
+        "buttons": {
             "add":_("Add"),
             "add_and_add_another":_("Add and Add Another"),
             "add_and_edit":_("Add and Edit"),
@@ -316,7 +337,7 @@ class i18n_messages(Command):
             "update":_("Update"),
             "view":_("View"),
             },
-        "dialogs":{
+        "dialogs": {
             "add_title":_("Add ${entity}"),
             "available":_("Available"),
             "dirty_message":_("This page has unsaved changes. Please save or revert."),
@@ -326,7 +347,7 @@ class i18n_messages(Command):
             "remove_title":_("Remove ${entity}"),
             "prospective":_("Prospective"),
             },
-        "facet_groups":{
+        "facet_groups": {
             "managedby":_("Managed by"),
             "member":_("Member"),
             "memberindirect":_("Indirect Member"),
@@ -334,11 +355,11 @@ class i18n_messages(Command):
             "memberofindirect":_("Indirect Member Of"),
             "settings": _("Settings"),
             },
-        "facets":{
+        "facets": {
             "search":_("Search"),
             "details": _("Settings"),
             },
-        "search":{
+        "search": {
             "quick_links":_("Quick Links"),
             "select_all":_("Select All"),
             "unselect_all":_("Unselect All"),
@@ -346,7 +367,9 @@ class i18n_messages(Command):
             "truncated":_(
                 "Query returned more results than the configured size limit. Displaying the first ${counter} results."),
             },
-        "details":{
+        "details": {
+            "collapse_all":_("Collapse All"),
+            "expand_all":_("Expand All"),
             "general":_("General"),
             "identity":_("Identity Settings"),
             "settings":_("${entity} ${primary_key} Settings"),
@@ -363,15 +386,29 @@ class i18n_messages(Command):
             "role":_("Role Based Access Control"),
             "automount":_("Automount")
             },
-        "association":{
+        "association": {
             "add":_("Add ${other_entity} into ${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"),
             },
-        "widget":{
+        "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"),
+                },
             },
-        "ajax":{
+        "ajax": {
             "401":_("Your Kerberos ticket is no longer valid. Please run kinit and then click 'Retry'. If this is your first time running the IPA Web UI <a href='/ipa/config/unauthorized.html'>follow these directions</a> to configure your browser.")
             },
         }
-- 
1.7.5.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to