From 814eb520d8a4073bc50c460a98a568c79803d7eb Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 30 Nov 2020 11:56:35 -0700 Subject: [PATCH] feat(plg): added multi-language support for Unraid.net page --- dynamix.unraid.net.plg | 382 +++++++++++++++++++++++++++++++---------- 1 file changed, 288 insertions(+), 94 deletions(-) diff --git a/dynamix.unraid.net.plg b/dynamix.unraid.net.plg index 7af398c6e..c9e9d30e2 100644 --- a/dynamix.unraid.net.plg +++ b/dynamix.unraid.net.plg @@ -23,8 +23,9 @@ +/dev/null /etc/rc.d/rc.unraid-api uninstall rm -f /etc/rc.d/rc.unraid-api rm -f /etc/rc.d/rc.flash_backup @@ -39,7 +40,10 @@ if [ -e /etc/rc.d/rc.unraid-api ]; then rm -f /usr/local/emhttp/webGui/javascript/vue.js rm -f /usr/local/emhttp/webGui/javascript/vue.min.js rm -rf /usr/local/emhttp/webGui/wc + find /usr/local/emhttp/languages -type f \( -iname unraidnet.txt -o -iname unraidnet.dot \) -delete + exit 0 fi +]]> @@ -120,10 +124,6 @@ echo json_encode($arr); &node-api; - -env="&env;" - - if [ "&env;" = "production" ] || [ ! -f /boot/config/plugins/Unraid.net/env ]; then @@ -372,7 +372,239 @@ This is work in progress. Use this for testing purposes only! - + + + Der WAN-Netzwerkport ist die externe TCP-Portnummer, die auf Ihrem Router für NAT / Port eingerichtet wurde. +> Leiten Sie den Datenverkehr vom Internet an diesen weiter Der SSL-Netzwerkport des unRAID-Servers für sicheren Webverkehr +:end + +:unraidnet_inactivespanel_help: +> Klicken Sie auf Aktivieren, um ein lokales Git-Repo für Ihr lokales USB-Flash-Startgerät einzurichten und eine Verbindung zu einer dedizierten Fernbedienung auf unraid.net herzustellen, die an diesen Server gebunden ist. +:end + +:unraidnet_changespanel_help: +> Der Status "Nicht auf dem neuesten Stand" zeigt an, dass lokale Dateien im Vergleich zur Fernbedienung auf unraid.net geändert wurden. + +> Klicken Sie auf Aktualisieren, um Änderungen auf den Remote-Server zu übertragen. + +> Klicken Sie auf Änderungen, um zu sehen, was sich geändert hat. +:end + +:unraidnet_uptodatepanel_help: +> Der Status "auf dem neusten Stand" zeigt an, dass Ihre lokale Konfiguration mit der auf der unraid.net-Fernbedienung gespeicherten übereinstimmt. +:end + +:unraidnet_activepanel_help: +> Klicken Sie auf Deaktivieren, um die Kommunikation mit Ihrer Fernbedienung auf unraid.net zu unterbrechen. + +> Klicken Sie auf Neu initialisieren, um den gesamten Änderungsverlauf sowohl auf dem lokalen als auch auf dem unraid.net-Remoteserver zu löschen. +:end +]]> + + + + + + Le port WAN est la configuration du numéro de port TCP externe sur votre routeur vers le trafic NAT / Port Forward d'Internet vers ce +> Port SSL du serveur Unraid pour un trafic Web sécurisé. +:end + +:unraidnet_inactivespanel_help: +> Cliquez sur Activer pour configurer un référentiel git local pour votre périphérique de démarrage USB Flash local et connectez-vous à une télécommande dédiée sur unraid.net liée à ce serveur. +:end + +:unraidnet_changespanel_help: +> L'état "Non à jour" indique que des fichiers locaux sont modifiés par rapport au serveur distant sur le serveur unraid.net. + +> Cliquez sur "Mettre à jour" pour envoyer les modifications au serveur distant. + +> Cliquez sur "Modifications" pour voir ce qui a changé. +:end + +:unraidnet_uptodatepanel_help: +> L'état "À jour" indique les correspondances de votre configuration locale avec celles stockées sur le serveur distant unraid.net. +:end + +:unraidnet_activepanel_help: +> Cliquez sur Désactiver pour interrompre la communication avec votre télécommande sur unraid.net. + +> Cliquez sur Réinitialiser pour effacer tout l'historique des modifications dans la télécommande locale et unraid.net +:end +]]> + + + + + + El puerto WAN es la configuración del número de puerto TCP externo en su enrutador para el tráfico de reenvío de puerto / NAT desde Internet a este +> Puerto SSL del servidor Unraid para un tráfico web seguro. +:end + +:unraidnet_inactivespanel_help: +> Haga clic en Activar para configurar un repositorio de git local para su dispositivo de arranque flash USB local y conéctese a un control remoto dedicado en unraid.net vinculado a este servidor. +:end + +:unraidnet_changespanel_help: +> El estado "No actualizado" indica que hay archivos locales que se cambiaron en comparación con la copia de seguridad remota en unraid.net. + +> Haga clic en "Actualizar" para enviar los cambios al servidor remoto. + +> Haga clic en "Cambios" para ver qué ha cambiado. +:end + +:unraidnet_uptodatepanel_help: +> El estado "actualizado" indica que su configuración local coincide con la almacenada en el servidor remoto de unraid.net. +:end + +:unraidnet_activepanel_help: +> Haga clic en "Desactivar" para pausar la comunicación con su copia de seguridad remota en unraid.net. + +> Haga clic en "Reinicializar" para borrar todo el historial de cambios en el servidor local y remoto de Unraid.net. +:end +]]> + + + + + + WAN Port is the external TCP port number setup on your router to NAT/Port Forward traffic from the internet to this +> Unraid server SSL port for secure web traffic. +:end + +:unraidnet_inactivespanel_help: +> Click Activate to set up a local git repo for your local USB Flash boot device and connect to a dedicated remote on unraid.net tied to this server. +:end + +:unraidnet_changespanel_help: +> The Not Up-to-date status indicates there are local files which are changed vs. the remote on unraid.net. + +> Click Update to push changes to the remote. + +> Click Changes to see what has changed. +:end + +:unraidnet_uptodatepanel_help: +> The Up-to-date status indicates your local configuration matches that stored on the unraid.net remote. +:end + +:unraidnet_activepanel_help: +> Click Deactivate to pause communication with your remote on unraid.net. + +> Click Reinitialize to erase all change history in both local and unraid.net remote. +:end +]]> + + + + " + _("The error is") + ": " + obj.error + "."; $(button).prop("disabled", false).html(oldlabel); swal('Oops',msg,'error'); }; @@ -444,57 +675,27 @@ function registerServer(button) { "remote_wanport": $('#wanport').val() },function(data2) { - swal({title:"",text:"Your server has been registered",type:"success",allowEscapeKey:false},function(){button.form.submit();}); + swal({title:"",text:_("Your server has been registered"),type:"success",allowEscapeKey:false},function(){button.form.submit();}); button.form.submit(); }); } else { - failure({"status": 403, "responseJSON": {"error": "Unable to register this Unraid Server"}}); + failure({"status": 403, "responseJSON": {"error": _("Unable to register this Unraid Server")}}); } }; - $(button).prop("disabled", true).html(" "+oldlabel+"ing"); + $(button).prop("disabled", true).html(_("Applying") + " "); $.post("/webGui/include/UpdateDNS.php",{username:$('#ips_username').val(),password:$('#ips_password').val(),externalport:$('#wanport').val(),remoteaccess:$('#wanaccess').val()},success).fail(failure); } -function unregisterServer(button) { - var oldlabel = $.trim($(button).text()); - - var failure = function(data) { - var status = data.status; - var obj = data.responseJSON; - var msg = "Sorry, an error ("+status+") occurred unregistering this server. " + - "The error is: "+obj.error+"."; - $(button).prop("disabled", false).html(oldlabel); - swal('Oops',msg,'error'); - }; - - var success = function(data) { - $.post('/webGui/include/Dispatcher.php',{ - "#cfg": "/boot/config/plugins/dynamix/dynamix.cfg", - "remote_apikey": "", - "remote_wanaccess": $('#wanaccess').val(), - "remote_wanport": $('#wanport').val() - }); - $(button).prop("disabled", false).html(oldlabel); - swal({title:"",text:"Your server has been unregistered",type:"success",allowEscapeKey:false},function(){button.form.submit();}); - }; - - swal({title:"Remove Registration",text:"Are you sure you want to unregister your server?",type:'warning',confirmButtonText:'Unregister',showCancelButton:true},function(){ - $(button).prop("disabled", true).html(" "+oldlabel+"ing"); - $.post("https://keys.lime-technology.com/account/server/unregister",{keyfile:""},success).fail(failure); - }); -} - function dnsCheckServer(button) { var oldlabel = $.trim($(button).text()); var failure = function(data) { var status = data.status; var obj = data.responseJSON; - var msg = "Sorry, an error ("+status+") occurred checking this server. " + - "The error is: "+obj.error+"."; + var msg = _("Sorry, an error occurred") + "
" + _("The error is") + ": "+obj.error+"."; $(button).prop("disabled", false).html(oldlabel); swal('Oops',msg,'error'); }; @@ -502,13 +703,13 @@ function dnsCheckServer(button) { var success = function(data) { $(button).prop("disabled", false).html(oldlabel); if (data.status) { - swal("","Your Unraid Server is reachable from the internet","success"); + swal("",_("Your Unraid Server is reachable from the internet"),"success"); } else { - swal("Oops","This Unraid Server was unreachable from the outside","error"); + swal("Oops",_("This Unraid Server was unreachable from the outside"),"error"); } }; - $(button).prop("disabled", true).html(" "+oldlabel+"ing"); + $(button).prop("disabled", true).html(_("Checking") + " "); $.post("https://keys.lime-technology.com/account/server/checkdns",{externalport:$('#wanport').val(),keyfile:""},success).fail(failure); } @@ -526,8 +727,7 @@ function enableFlashBackup(button) { var failure = function(data) { var status = data.status; var obj = data.responseJSON; - var msg = "Sorry, an error ("+status+") occurred enabling Flash backup. " + - "The error is: "+obj.error+"."; + var msg = _("Sorry, an error occurred") + "
" + _("The error is") + ": "+obj.error+"."; $(button).prop("disabled", false).html(oldlabel); swal({title:"",text:msg,type:"error",allowEscapeKey:false},function(){button.form.submit();}); }; @@ -537,28 +737,28 @@ function enableFlashBackup(button) { button.form.submit(); }; - if (oldlabel == 'Activate') { - $(button).prop("disabled", true).html(" Activating"); + if (oldlabel == _("Activate")) { + $(button).prop("disabled", true).html(_("Activating") + " "); $.post("/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php",{command:"activate"},success).fail(failure); } - if (oldlabel == 'Deactivate') { - swal({title:"Deactivate",text:"Are you sure you want pause communication with your remote flash backup on unraid.net?",type:'warning',confirmButtonText:'Deactivate',showCancelButton:true},function(){ - $(button).prop("disabled", true).html(" Deactivating"); + if (oldlabel == _("Deactivate")) { + swal({title:_("Deactivate"),text:_("Are you sure you want pause communication with your remote flash backup on unraid.net?"),type:'warning',confirmButtonText:_("Deactivate"),showCancelButton:true},function(){ + $(button).prop("disabled", true).html(_("Deactivating") + " "); $.post("/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php",{command:"deactivate"},success).fail(failure); }); } - if (oldlabel == 'Update') { - $(button).prop("disabled", true).html(" Updating"); + if (oldlabel == _("Update")) { + $(button).prop("disabled", true).html(_("Updating") + " "); $.post("/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php",{command:"flush"},success).fail(failure); } - if (oldlabel == 'Reinitialize') { - swal({title:"Reinitialize",text:"Are you sure you want erase all change history in both local and unraid.net remote?",type:'warning',confirmButtonText:'Reinitialize',showCancelButton:true},function(){ - $(button).prop("disabled", true).html(" Reinitializing"); + if (oldlabel == _("Reinitialize")) { + swal({title:_("Reinitialize"),text:_("Are you sure you want to erase all change history in both local and unraid.net remote?"),type:'warning',confirmButtonText:_("Reinitialize"),showCancelButton:true},function(){ + $(button).prop("disabled", true).html(_("Reinitializing") + " "); $.post("/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php",{command:"reinit"},success).fail(failure); }); } - if (oldlabel == 'Changes') { - openBox("/webGui/include/gitstatus.php", "Changes", 600,600, false); + if (oldlabel == _("Changes")) { + openBox("/webGui/include/gitstatus.php", _("Changes"), 600,600, false); } } @@ -566,7 +766,7 @@ function buttonStateReset(newstate) { $('#loadingpanel,#inactivespanel,#activepanel,#changespanel,#uptodatepanel').hide(); if (newstate['loading'] && newstate['loading']!='') { - $('#loadingtext').text(newstate['loading']); + $('#loadingtext').html(newstate['loading'] + ' '); $('#loadingpanel').show(); return; } @@ -587,35 +787,35 @@ $.post('/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php',{command:"sta
-Unraid.net Status: +_(Unraid.net Status)_: : -Allow Remote Access: +_(Allow Remote Access)_: -: Disabled until you Provision an unraid.net SSL Cert and set SSL/TLS to Auto +: _(Disabled until you Provision an unraid.net SSL Cert and set SSL-TLS to Auto)_ -: Disabled until your root user account is password-protected +: _(Disabled until your root user account is password-protected)_ :
-WAN Port: -: +_(WAN Port)_: +: + +:unraidnet_wanpanel_help: -> WAN Port is the external TCP port number setup on your router to NAT/Port Forward traffic from the internet to this -> Unraid server SSL port for secure web traffic.
  -: +:
@@ -623,53 +823,47 @@ WAN Port:
-Flash backup: -: Loading +_(Flash backup)_: +: _(Loading)_
@@ -678,7 +872,7 @@ var flashbackupsub = new NchanSubscriber('/sub/flashbackup'); flashbackupsub.on('message', function(data) { var ini = parseINI(data); - console.info('Flash backup state: ', ini['flashbackup']); + //console.info('Flash backup state: ', ini['flashbackup']); buttonStateReset(ini['flashbackup']); }); $(function() {