Complete i18n support for the aout admin interface
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Oct 2008 03:38:48 +0000 (03:38 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Oct 2008 03:38:48 +0000 (03:38 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10829 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/conify/global/actor/org_unit_type.html
Open-ILS/web/js/dojo/openils/conify/nls/aout.js

index 01b793a..f3c1f49 100644 (file)
@@ -76,7 +76,7 @@
                         method : 'open-ils.permacrud.search.aout.atomic',
                         timeout : 10,
                         params : [ ses, { id : { "!=" : null } }, { order_by : { aout : 'name' } } ],
-                        onerror : function (r) { status_update('Problem fetching types') },
+                        onerror : function (r) { status_update( aout_strings.ERROR_FETCHING_TYPES ) },
                         oncomplete : function (r) {
                             ou_type_store = new dojo.data.ItemFileWriteStore({ data : aout.toStoreData( r.recv().content() ) });
                             ou_type_store.onSet = function (item, attr, o, n) {
@@ -95,8 +95,7 @@
 
                                 if (dirtyStore.length > 0) {
                                     var confirmation = confirm(
-                                        'There are unsaved modified Organization Types!  '+
-                                        'OK to save these changes, Cancel to abandon them.'
+                                                                               aout_strings.CONFIRM_UNSAVED_CHANGES
                                     );
 
                                     if (confirmation) {
                                                current_fm_type = new aout().fromStoreItem(item);
 
                                                highlighter.editor_pane.green.play();
-                                               status_update( 'Now editing ' + this.store.getValue( item, 'name' ) );
+                                               status_update( dojo.string.substitute( aout_strings.STATUS_EDITING, [this.store.getValue( item, 'name' )] ) );
 
                                                new_kid_button.disabled = false;
                                                save_out_button.disabled = false;
        
                                                                        if (ou_type_store.getValue( current_type, '_trueRoot' ) == 'true') {
                                                                                highlighter.editor_pane.red.play();
-                                                                               status_update( 'Cannot delete' + ou_type_store.getValue( current_type, 'name' ) + ', you need at least one.' );
+                                                                               status_update( dojo.string.substitute( aout_strings.ERROR_DELETING_LAST, [ou_type_store.getValue( current_type, 'name' )] ) );
                                                                                return false;
                                                                        }
 
                                                                                );
                                                                                if ( existing_kids.length > 0) {
                                                                                        highlighter.editor_pane.red.play();
-                                                                                       status_update( 'Cannot delete' + ou_type_store.getValue( current_type, 'name' ) + ', ' + existing_kids.length + ' subordinates still exist.' );
+                                                                                       status_update( dojo.string.substitute( aout_strings.ERROR_ORPHANS, [ou_type_store.getValue( current_type, 'name' ), existing_kids.length] ) );
                                                                                        return;
                                                                                }
                                                                        }
        
-                                                                       if ( confirm('Are you sure you want to delete ' + current_type.name + '?')) {
+                                                                       if ( confirm( dojo.string.substitute ( aout_strings.CONFIRM_DELETE, [current_type.name] ))) {
                                                                                ou_type_store.setValue( current_type, 'isdeleted', 1 );
        
                                                                                var modified_aout = new aout().fromStoreItem( current_type );
                                                                                        params : [ ses, modified_aout ],
                                                                                        onerror : function (r) {
                                                                                                highlighter.editor_pane.red.play();
-                                                                                               status_update( 'Problem deleting ' + ou_type_store.getValue( current_type, 'name' ) );
+                                                                                               status_update( dojo.string.substitute ( aout_strings.ERROR_DELETING, [ou_type_store.getValue( current_type, 'name' )] ) );
                                                                                        },
                                                                                        oncomplete : function (r) {
                                                                                                var res = r.recv();
                                                                                                        window["editor_pane_can_have_users"].setChecked( false ); // unset the value
                        
                                                                                                        highlighter.editor_pane.green.play();
-                                                                                                       status_update( old_name + ' deleted' );
+                                                                                                       status_update( dojo.string.substitute( aout_strings.STATUS_DELETED, [old_name] ) );
                                                                                                } else {
                                                                                                        highlighter.editor_pane.red.play();
-                                                                                                       status_update( 'Problem deleting ' + old_name );
+                                                                                                       status_update( dojo.string.substitute( aout_strings.ERROR_DELETING, [old_name] ) );
                                                                                                }
                                                                                        }
                                                                                }).send();
                                                        <script type="dojo/connect" event="onClick">
                                                                var new_fm_obj = new aout().fromHash({
                                                                        isnew                   : 1,
-                                                                       name                    : 'New Type',
+                                                                       name                    : aout_strings.LABEL_NEW_TYPE,
                                                                        can_have_vols   : 'f',
                                                                        can_have_users  : 'f',
                                                                        depth                   : 1 + parseInt(ou_type_store.getValue( current_type, 'depth' )),
                                                                        params : [ ses, new_fm_obj ],
                                                                        onerror : function (r) {
                                                                                highlighter.editor_pane.red.play();
-                                                                               status_update( 'Problem calling method to create child Org Type' );
+                                                                               status_update( aout_strings.ERROR_CREATING_CHILD_METHOD );
                                                                                err = true;
                                                                        },
                                                                        oncomplete : function (r) {
                                                                                        );
                                                                                } else {
                                                                                        highlighter.editor_pane.red.play();
-                                                                                       status_update( 'Problem creating child Org Type' );
+                                                                                       status_update( aout_strings.ERROR_CREATING_CHILD );
                                                                                        err = true;
                                                                                }
                                                                        },
                                                                if (!err) {
                                                                        highlighter.editor_pane.green.play();
                                                                        highlighter.type_tree.green.play();
-                                                                       status_update( 'New child Organization Type created for ' + ou_type_store.getValue( current_type, 'name' ) );
+                                                                       status_update( dojo.string.substitute( aout_strings.SUCCESS_CREATING_CHILD, [ou_type_store.getValue( current_type, 'name' )] ) );
                                                                }
 -->
                                                        </script>
index cd7e663..e2a7016 100644 (file)
@@ -1,4 +1,17 @@
 {
+
+       CONFIRM_UNSAVED_CHANGES: "There are unsaved changes to your organization types. Click OK to save these changes, or Cancel to abandon them.",
+       CONFIRM_DELETE: "Are you sure you want to delete ${0}?",
+       ERROR_CREATING_CHILD: "Problem creating child Organization Type",
+       ERROR_CREATING_CHILD_METHOD: "Problem calling method to create child Organization Type",
+       ERROR_DELETING: "Problem deleting ${0}",
+       ERROR_DELETING_LAST: "Cannot delete ${0}. You need at least one organization type.",
+       ERROR_ORPHANS: "Cannot delete ${0}; ${1} subordinates still exist.",
        ERROR_SAVING_DATA: "Problem saving data for ${0}",
+       ERROR_FETCHING_TYPES: "Problem fetching organization types",
+       LABEL_NEW_TYPE: "New Type",
+       STATUS_DELETED: "${0} deleted", 
+       STATUS_EDITING: "Now editing ${0}", 
+       SUCCESS_CREATING_CHILD: "New child Organization Type created for ${0}",
        SUCCESS_SAVING_DATA: "Saved changes to ${0}"
 }