From 42807e39653883bcc8d36221e3236691c20299be Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 15 May 2012 17:28:42 +0200 Subject: [PATCH] Feature #1275: Add french translation to Sunstone and correct minor things. -Prevent scaping of html codes on onready() translations. -Translate allowed operations in ACL tables -Add french datatable translation -Translate VM state --- install.sh | 6 ++ src/sunstone/public/js/locale.js | 10 +- src/sunstone/public/js/opennebula.js | 92 +++++++++---------- src/sunstone/public/js/plugins/acls-tab.js | 2 +- src/sunstone/public/js/plugins/config-tab.js | 3 +- src/sunstone/public/js/plugins/vms-tab.js | 8 +- src/sunstone/public/locale/fr_FR/fr_FR.js | 15 +-- .../public/locale/fr_FR/fr_datatable.txt | 17 ++++ 8 files changed, 85 insertions(+), 68 deletions(-) create mode 100644 src/sunstone/public/locale/fr_FR/fr_datatable.txt diff --git a/install.sh b/install.sh index 083c65d0fd..5954975f19 100755 --- a/install.sh +++ b/install.sh @@ -261,6 +261,7 @@ SUNSTONE_DIRS="$SUNSTONE_LOCATION/models \ $SUNSTONE_LOCATION/public/locale/ru \ $SUNSTONE_LOCATION/public/locale/it_IT \ $SUNSTONE_LOCATION/public/locale/pt_PT \ + $SUNSTONE_LOCATION/public/locale/fr_FR \ $SUNSTONE_LOCATION/public/vendor \ $SUNSTONE_LOCATION/public/vendor/jQueryLayout \ $SUNSTONE_LOCATION/public/vendor/dataTables \ @@ -475,6 +476,7 @@ INSTALL_SUNSTONE_FILES=( SUNSTONE_PUBLIC_LOCALE_RU:$SUNSTONE_LOCATION/public/locale/ru SUNSTONE_PUBLIC_LOCALE_IT_IT:$SUNSTONE_LOCATION/public/locale/it_IT SUNSTONE_PUBLIC_LOCALE_PT_PT:$SUNSTONE_LOCATION/public/locale/pt_PT + SUNSTONE_PUBLIC_LOCALE_PT_PT:$SUNSTONE_LOCATION/public/locale/fr_FR ) INSTALL_SUNSTONE_ETC_FILES=( @@ -1301,6 +1303,10 @@ SUNSTONE_PUBLIC_LOCALE_PT_PT=" src/sunstone/public/locale/pt_PT/pt_PT.js \ src/sunstone/public/locale/pt_PT/pt_datatable.txt" +SUNSTONE_PUBLIC_LOCALE_FR_FR=" +src/sunstone/public/locale/fr_FR/fr_FR.js \ +src/sunstone/public/locale/fr_FR/fr_datatable.txt" + #----------------------------------------------------------------------------- diff --git a/src/sunstone/public/js/locale.js b/src/sunstone/public/js/locale.js index a029ff8d34..fedfc42cc6 100644 --- a/src/sunstone/public/js/locale.js +++ b/src/sunstone/public/js/locale.js @@ -86,9 +86,9 @@ function setLang(lang_str){ $(document).ready(function(){ //Update static translations - $('#doc_link').text(tr("Documentation")); - $('#support_link').text(tr("Support")); - $('#community_link').text(tr("Community")); - $('#welcome').text(tr("Welcome")); - $('#logout').text(tr("Sign out")); + $('#doc_link').html(tr("Documentation")); + $('#support_link').html(tr("Support")); + $('#community_link').html(tr("Community")); + $('#welcome').html(tr("Welcome")); + $('#logout').html(tr("Sign out")); }); \ No newline at end of file diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index a69f0e9809..71ffc29d70 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -48,67 +48,67 @@ var OpenNebula = { { case "HOST": case "host": - return ["INIT", - "MONITORING", - "MONITORED", - "ERROR", - "DISABLED"][value]; + return tr(["INIT", + "MONITORING", + "MONITORED", + "ERROR", + "DISABLED"][value]); break; case "HOST_SIMPLE": case "host_simple": - return ["ON", - "ON", - "ON", - "ERROR", - "OFF"][value]; + return tr(["ON", + "ON", + "ON", + "ERROR", + "OFF"][value]); break; case "VM": case "vm": - return ["INIT", - "PENDING", - "HOLD", - "ACTIVE", - "STOPPED", - "SUSPENDED", - "DONE", - "FAILED"][value]; + return tr(["INIT", + "PENDING", + "HOLD", + "ACTIVE", + "STOPPED", + "SUSPENDED", + "DONE", + "FAILED"][value]); break; case "VM_LCM": case "vm_lcm": - return ["LCM_INIT", - "PROLOG", - "BOOT", - "RUNNING", - "MIGRATE", - "SAVE_STOP", - "SAVE_SUSPEND", - "SAVE_MIGRATE", - "PROLOG_MIGRATE", - "PROLOG_RESUME", - "EPILOG_STOP", - "EPILOG", - "SHUTDOWN", - "CANCEL", - "FAILURE", - "CLEANUP", - "UNKNOWN"][value]; + return tr(["LCM_INIT", + "PROLOG", + "BOOT", + "RUNNING", + "MIGRATE", + "SAVE_STOP", + "SAVE_SUSPEND", + "SAVE_MIGRATE", + "PROLOG_MIGRATE", + "PROLOG_RESUME", + "EPILOG_STOP", + "EPILOG", + "SHUTDOWN", + "CANCEL", + "FAILURE", + "CLEANUP", + "UNKNOWN"][value]); break; case "IMAGE": case "image": - return ["INIT", - "READY", - "USED", - "DISABLED", - "LOCKED", - "ERROR"][value]; + return tr(["INIT", + "READY", + "USED", + "DISABLED", + "LOCKED", + "ERROR"][value]); break; case "VM_MIGRATE_REASON": case "vm_migrate_reason": - return ["NONE", - "ERROR", - "STOP_RESUME", - "USER", - "CANCEL"][value]; + return tr(["NONE", + "ERROR", + "STOP_RESUME", + "USER", + "CANCEL"][value]); break; default: return; diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index d53b4f81f7..4c5616de35 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -292,7 +292,7 @@ function aclElementArray(acl_json){ acl_array[0], acl_array[1], acl_array[2], - acl_array[3], + tr(acl_array[3].charAt(0).toUpperCase()+acl_array[3].substring(1)), //capitalize 1st letter for translation acl.STRING ] } diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index c56e84cd0f..3bab4fda6d 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -29,9 +29,10 @@ var config_tab_content = \ \ \ \ diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 3f621dbe2f..b05cc51fc5 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -654,7 +654,7 @@ function vMachineElementArray(vm_json){ var state = OpenNebula.Helper.resource_state("vm",vm.STATE); var hostname = "--"; - if (state == "ACTIVE" || state == "SUSPENDED"){ + if (state == tr("ACTIVE") || state == tr("SUSPENDED")){ if (vm.HISTORY_RECORDS.HISTORY.constructor == Array){ hostname = vm.HISTORY_RECORDS.HISTORY[vm.HISTORY_RECORDS.HISTORY.length-1].HOSTNAME; } else { @@ -662,7 +662,7 @@ function vMachineElementArray(vm_json){ }; }; - if (state == "ACTIVE") { + if (state == tr("ACTIVE")) { state = OpenNebula.Helper.resource_state("vm_lcm",vm.LCM_STATE); }; @@ -785,7 +785,7 @@ function updateVMInfo(request,vm){ var vm_info = vm.VM; var vm_state = OpenNebula.Helper.resource_state("vm",vm_info.STATE); var hostname = "--" - if (vm_state == "ACTIVE" || vm_state == "SUSPENDED") { + if (vm_state == tr("ACTIVE") || vm_state == tr("SUSPENDED")) { if (vm_info.HISTORY_RECORDS.HISTORY.constructor == Array){ hostname = vm_info.HISTORY_RECORDS.HISTORY[vm_info.HISTORY_RECORDS.HISTORY.length-1].HOSTNAME } else { @@ -1335,7 +1335,7 @@ function vncIcon(vm){ var graphics = vm.TEMPLATE.GRAPHICS; var state = OpenNebula.Helper.resource_state("vm_lcm",vm.LCM_STATE); var gr_icon; - if (graphics && graphics.TYPE == "vnc" && state == "RUNNING"){ + if (graphics && graphics.TYPE == "vnc" && state == tr("RUNNING")){ gr_icon = ''; gr_icon += '\"'+tr("Open'; } diff --git a/src/sunstone/public/locale/fr_FR/fr_FR.js b/src/sunstone/public/locale/fr_FR/fr_FR.js index b88d04671a..c7f49b472d 100644 --- a/src/sunstone/public/locale/fr_FR/fr_FR.js +++ b/src/sunstone/public/locale/fr_FR/fr_FR.js @@ -1,13 +1,6 @@ -//Translated by -// Bug detected: -// - Community and Sign Out strings don't work with é -// - tables like the one displaying users don't seem to use the language file -// - Show, entries, Search, Showing x to y of z entries, First, Previous, Next, Last -// - allowed operations like create or manage -// - state of VM -// - Monitoring information message 'There is no monitoring information for vm xx' +//Translated by Patrice Lachance lang="fr_FR" -datatable_lang="" +datatable_lang="fr_datatable.txt" locale={ "802.1Q":"802.1Q", "Accept (default)":"Accepté (défaut)", @@ -70,7 +63,7 @@ locale={ "Cluster information":"Information cluster", "Cluster name missing!":"Nom de cluster manquant", "Clusters":"Clusters", - "Community":"Communauté", + "Community":"Communauté", "Configuration":"Configuration", "Confirmation of action":"Confirmation d'action", "Context":"Contexte", @@ -416,7 +409,7 @@ locale={ "shared,ssh,iscsi,dummy":"shared,ssh,iscsi,dummy", "Show":"Afficher", "Shutdown":"Arrêter", - "Sign out":"Déconnection", + "Sign out":"Déconnection", "Size":"Taille", "Size in MB":"Taille en Mo", "Size (Mb)":"Taille (Mb)", diff --git a/src/sunstone/public/locale/fr_FR/fr_datatable.txt b/src/sunstone/public/locale/fr_FR/fr_datatable.txt new file mode 100644 index 0000000000..38fa8347c3 --- /dev/null +++ b/src/sunstone/public/locale/fr_FR/fr_datatable.txt @@ -0,0 +1,17 @@ +{ + "sProcessing": "En cours...", + "sLengthMenu": "Affiche _MENU_ éléments", + "sZeroRecords": "Pas d'enregistrement", + "sInfo": "Affiche de _START_ à _END_ sur _TOTAL_", + "sInfoEmpty": "Pas d'enregistrement", + "sInfoFiltered": "(filtré sur un total de _MAX_)", + "sInfoPostFix": "", + "sSearch": "Rechercher:", + "sUrl": "", + "oPaginate": { + "sFirst": "Premier", + "sPrevious": "Précédent", + "sNext": "Suivant", + "sLast": "Dernier" + } +}