WIP new WebAdmin: add missing translations for events page

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-01-29 10:49:21 +01:00
parent 0900a63b83
commit b18b37042d
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
5 changed files with 79 additions and 9 deletions

4
go.mod
View file

@ -25,7 +25,7 @@ require (
github.com/eikenb/pipeat v0.0.0-20210730190139-06b3e6902001
github.com/fclairamb/ftpserverlib v0.22.0
github.com/fclairamb/go-log v0.4.1
github.com/go-acme/lego/v4 v4.14.2
github.com/go-acme/lego/v4 v4.15.0
github.com/go-chi/chi/v5 v5.0.11
github.com/go-chi/jwtauth/v5 v5.3.0
github.com/go-chi/render v1.0.3
@ -156,7 +156,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect

7
go.sum
View file

@ -138,8 +138,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-acme/lego/v4 v4.14.2 h1:/D/jqRgLi8Cbk33sLGtu2pX2jEg3bGJWHyV8kFuUHGM=
github.com/go-acme/lego/v4 v4.14.2/go.mod h1:kBXxbeTg0x9AgaOYjPSwIeJy3Y33zTz+tMD16O4MO6c=
github.com/go-acme/lego/v4 v4.15.0 h1:A7MHEU3b+TDFqhC/HmzMJnzPbyeaYvMZQBbqgvbThhU=
github.com/go-acme/lego/v4 v4.15.0/go.mod h1:eeGhjW4zWT7Ccqa3sY7ayEqFLCAICx+mXgkMHKIkLxg=
github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA=
github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/jwtauth/v5 v5.3.0 h1:X7RKGks1lrVeIe2omGyz47pNaNjG2YmwlRN5UKhN8qg=
@ -403,8 +403,9 @@ github.com/yl2chen/cidranger v1.0.3-0.20210928021809-d1cb2c52f37a h1:XfF01GyP+0e
github.com/yl2chen/cidranger v1.0.3-0.20210928021809-d1cb2c52f37a/go.mod h1:aXb8yZQEWo1XHGMf1qQfnb83GR/EJ2EBlwtUgAaNBoE=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=

View file

@ -864,5 +864,18 @@
"path": "Path",
"object": "Object",
"event": "Event"
},
"provider_objects": {
"user": "User",
"folder": "Folder",
"group": "Group",
"admin": "Admin",
"api_key": "API key",
"share": "Share",
"event_action": "Action",
"event_rule": "Rule",
"role": "role",
"ip_list_entry": "IP list entry",
"configs": "Configurations"
}
}

View file

@ -864,5 +864,18 @@
"path": "Percorso",
"object": "Oggetto",
"event": "Evento"
},
"provider_objects": {
"user": "Utente",
"folder": "Cartella virtuale",
"group": "Gruppo",
"admin": "Amministratore",
"api_key": "Chiave API",
"share": "Condivisione",
"event_action": "Azione",
"event_rule": "Regola",
"role": "ruolo",
"ip_list_entry": "Elemento lista IP",
"configs": "Configurazioni"
}
}

View file

@ -221,13 +221,17 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
function humanizeMilliseconds(val) {
let units = ["d", "h", "m", "s", "ms"];
let decimalPoints = 1;
if (val > 1000){
units = ["d", "h", "m", "s"]
}
if (val > 60000){
decimalPoints = 0;
}
return humanizeDuration(val, {
language: i18next.resolvedLanguage,
fallbacks: ["en"],
maxDecimalPoints: 1,
maxDecimalPoints: decimalPoints,
units: units
})
}
@ -704,10 +708,49 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
if (!data){
return "";
}
if (row.object_name){
return escapeHTML(`${data} "${row.object_name}"`);
let message;
switch (data){
case "user":
message = $.t('provider_objects.user');
break;
case "folder":
message = $.t('provider_objects.folder');
break;
case "group":
message = $.t('provider_objects.group');
break;
case "admin":
message = $.t('provider_objects.admin');
break;
case "api_key":
message = $.t('provider_objects.api_key');
break;
case "share":
message = $.t('provider_objects.share');
break;
case "event_action":
message = $.t('provider_objects.event_action');
break;
case "event_rule":
message = $.t('provider_objects.event_rule');
break;
case "role":
message = $.t('provider_objects.role');
break;
case "ip_list_entry":
message = $.t('provider_objects.ip_list_entry');
break;
case "configs":
message = $.t('provider_objects.configs');
break;
default:
console.log("uknown object type: "+data);
return ""
}
return escapeHTML(data);
if (row.object_name && data != "configs"){
return message+= escapeHTML(` "${row.object_name}"`);
}
return message;
}
return data;
}