From d58f340bd7f2176a866f7a50b70e29499951891e Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Thu, 7 Apr 2011 19:49:40 +0000 Subject: [PATCH] Internationalization of the client side. --- static/plugin_dbui/locale/app-lang-en.js | 5 ++ static/plugin_dbui/locale/app-lang-fr.js | 51 +++++++++++++++++++ static/plugin_dbui/src/appform.js | 1 + static/plugin_dbui/src/appgridpaging.js | 10 +++- static/plugin_dbui/src/appgridroweditor.js | 22 +++++--- .../src/appgridroweditorcontextmenu.js | 22 +++++--- .../plugin_dbui/src/appviewportintreegrid.js | 12 ++++- 7 files changed, 107 insertions(+), 16 deletions(-) create mode 100644 static/plugin_dbui/locale/app-lang-en.js create mode 100644 static/plugin_dbui/locale/app-lang-fr.js diff --git a/static/plugin_dbui/locale/app-lang-en.js b/static/plugin_dbui/locale/app-lang-en.js new file mode 100644 index 00000000..6bde1430 --- /dev/null +++ b/static/plugin_dbui/locale/app-lang-en.js @@ -0,0 +1,5 @@ +/** + * Mother language + * $Id$ + * + */ diff --git a/static/plugin_dbui/locale/app-lang-fr.js b/static/plugin_dbui/locale/app-lang-fr.js new file mode 100644 index 00000000..21464be9 --- /dev/null +++ b/static/plugin_dbui/locale/app-lang-fr.js @@ -0,0 +1,51 @@ +/** + * France translation + * $Id$ + * + */ + +if (App.form.FormPanel) { + Ext.apply(App.form.FormPanel.prototype, { + textCreate : 'Créer', + textDestroy : 'Détruire', + textDuplicate : 'Dupliquer', + textReset : 'Annuler', + textUpdate : 'Actualiser' + }); +} + +if (App.grid.Paging) { + Ext.apply(App.grid.Paging.prototype, { + textExport: 'Exporter en CSV', + textSlider: 'Enregistrements par page', + + }); +} + +if (App.grid.RowEditor) { + Ext.apply(App.grid.RowEditor.prototype, { + addTitle : "Créer un enregistrement...", + deleteTitle : "Détruire un enregistrement...", + duplicateTitle : "Dupliquer un enregistrement..", + editTitle : "Actualiser un enregistrement...", + viewTitle : "Voir un enregistrement...", + textMsg : 'Sélectioner un enregistrement !', + }); +} + +if (App.grid.RowEditorContextMenu) { + Ext.apply(App.grid.RowEditorContextMenu.prototype, { + textAdd : 'Ajouter', + textCreate : 'Créer', + textDestroy : 'Détruire', + textDuplicate : 'Dupliquer', + textUpdate : 'Actualiser', + textView : 'Voir' + }); +} + +if (App.viewport.InTreePanelGrid) { + Ext.apply(App.viewport.InTreePanelGrid.prototype, { + textReset: 'Annuler', + }); +} diff --git a/static/plugin_dbui/src/appform.js b/static/plugin_dbui/src/appform.js index 0f2c213f..74676c42 100644 --- a/static/plugin_dbui/src/appform.js +++ b/static/plugin_dbui/src/appform.js @@ -84,6 +84,7 @@ App.form.FormPanel = Ext.extend(Ext.form.FormPanel, { // set the default action: create this.setAction('create'); + this.buttonReset.setText(this.textReset); }, /** diff --git a/static/plugin_dbui/src/appgridpaging.js b/static/plugin_dbui/src/appgridpaging.js index 34ffef6f..6b241719 100644 --- a/static/plugin_dbui/src/appgridpaging.js +++ b/static/plugin_dbui/src/appgridpaging.js @@ -18,6 +18,12 @@ App.grid.Paging = Ext.extend(Object, { */ ptype: 'pGridPaging', + /** + * Private attributs for internationalization + */ + textExport: 'Export to CSV', + textSlider: 'Rows per page', + /** * Plugin initialization */ @@ -31,7 +37,7 @@ App.grid.Paging = Ext.extend(Object, { // add the slider and the export button bbar.add('-', - 'Rows per page', + this.textSlider, { xtype: 'slider', plugins: new Ext.slider.Tip(), @@ -45,7 +51,7 @@ App.grid.Paging = Ext.extend(Object, { '->', { xtype: 'xbuttondownload', - text: 'Export to CSV', + text: this.textExport, url: App.csvUrl + '?tableName=' + App.getTableName(grid.store) } ); diff --git a/static/plugin_dbui/src/appgridroweditor.js b/static/plugin_dbui/src/appgridroweditor.js index 73e6d9c4..8d4c7f72 100644 --- a/static/plugin_dbui/src/appgridroweditor.js +++ b/static/plugin_dbui/src/appgridroweditor.js @@ -24,6 +24,16 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { formPanel: null, grid: null, + /** + * Private attributes for internationalization + */ + addTitle: "Create a new record...", + deleteTitle: "Delete the record...", + duplicateTitle: "Duplicate the record...", + editTitle: "Update the record...", + viewTitle: "View the record...", + textMsg: 'Select a row please', + /** * pre-defined configuration options for the window */ @@ -92,7 +102,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { var record = this.grid.getSelectionModel().getSelected(); if (!record) { - Ext.MessageBox.alert('Warning', 'Select a row please'); + Ext.MessageBox.alert('Warning', this.textMsg); return false; } @@ -107,7 +117,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { onAddRow: function () { this.formPanel.setAction('create'); - this.setTitle("Create a new record..."); + this.setTitle(this.addTitle); this.show(); }, @@ -122,7 +132,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { if (!record) {return; } this.formPanel.setAction('destroy', record); - this.setTitle("Delete the record..."); + this.setTitle(this.deleteTitle); this.formPanel.doAction(); }, @@ -137,7 +147,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { if (!record) {return; } this.formPanel.setAction('duplicate', record); - this.setTitle("Duplicate the record..."); + this.setTitle(this.duplicateTitle); this.show(); }, @@ -152,7 +162,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { if (!record) {return; } this.formPanel.setAction('update', record); - this.setTitle("Update the record..."); + this.setTitle(this.editTitle); this.show(); }, @@ -167,7 +177,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { if (!record) {return; } this.formPanel.setAction('view', record); - this.setTitle("View the record..."); + this.setTitle(this.viewTitle); this.show(); }, diff --git a/static/plugin_dbui/src/appgridroweditorcontextmenu.js b/static/plugin_dbui/src/appgridroweditorcontextmenu.js index 11ded891..a2f54c9d 100644 --- a/static/plugin_dbui/src/appgridroweditorcontextmenu.js +++ b/static/plugin_dbui/src/appgridroweditorcontextmenu.js @@ -21,7 +21,17 @@ App.grid.RowEditorContextMenu = Ext.extend(Object, { * Private attribute identifying the type of plugin */ ptype: 'pGridRowEditorContextMenu', - + + /** + * private attributes for internationalization + */ + textAdd: 'Add', + textCreate: 'Create', + textDestroy: 'Delete', + textDuplicate: 'Duplicate', + textUpdate: 'Update', + textView: 'View', + /** * Plugin initialization * @param {Object} grid @@ -40,27 +50,27 @@ App.grid.RowEditorContextMenu = Ext.extend(Object, { grid.addListener('rowcontextmenu', this.onRowContextMenu, menu); menu.add({ - text: 'Add', + text: this.textAdd, iconCls: 'silk-add', handler: grid.rowEditor.onAddRow, scope: grid.rowEditor }, '-', { - text: 'Delete', + text: this.textDestroy, iconCls: 'silk-delete', handler: grid.rowEditor.onDeleteRow, scope: grid.rowEditor }, '-', { - text: 'Duplicate', + text: this.textDuplicate, iconCls: 'silk-clone', handler: grid.rowEditor.onDuplicateRow, scope: grid.rowEditor }, { - text: 'Update', + text: this.textUpdate, iconCls: 'silk-update', handler: grid.rowEditor.onEditRow, scope: grid.rowEditor }, '-', { - text: 'View', + text: this.textView, iconCls: 'silk-view', handler: grid.rowEditor.onViewRow, scope: grid.rowEditor diff --git a/static/plugin_dbui/src/appviewportintreegrid.js b/static/plugin_dbui/src/appviewportintreegrid.js index a0e56b87..c598b8ad 100644 --- a/static/plugin_dbui/src/appviewportintreegrid.js +++ b/static/plugin_dbui/src/appviewportintreegrid.js @@ -29,6 +29,11 @@ Ext.namespace('App.viewport'); App.viewport.InTreePanelGrid = Ext.extend(App.viewport.InTreePanelBase, { + /** + * Private attributs for internationalization + */ + textReset: 'Reset', + /** * private function to instantiate the grid and to add it to the tab * @@ -72,7 +77,10 @@ App.viewport.InTreePanelGrid = Ext.extend(App.viewport.InTreePanelBase, { items: [gridfilter], width: 300, split: true, - buttons: [{text: 'reset', ref: '../../resetButton'}] + buttons: [{ + text: this.textReset, + ref: '../../resetButton' + }] }] }); @@ -91,7 +99,7 @@ App.viewport.InTreePanelGrid = Ext.extend(App.viewport.InTreePanelBase, { // get the name of the database table from the tab id // NOTE: this implementation assume that the node name is equal to - // the database taable name + // the database table name table = this.getNodeNameFromId(component.id); // Ask the server the widget configuration and create it -- GitLab