Expand translations
This commit is contained in:
parent
f599454875
commit
b6b7541524
|
@ -346,7 +346,8 @@ func main() {
|
|||
if ec < 2 {
|
||||
logpath := filepath.Join(conf.ConfigDir.QueryCacheFolder().Path, logging.LOGFILE)
|
||||
fmt.Println(tr.Value("error.checklog", logpath))
|
||||
fmt.Println(ioutil.ReadFile(logpath))
|
||||
bs, _ := ioutil.ReadFile(logpath)
|
||||
fmt.Println(string(bs))
|
||||
}
|
||||
}
|
||||
os.Exit(ec)
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,9 +1,9 @@
|
|||
module github.com/xxxserxxx/gotop/v4
|
||||
|
||||
require (
|
||||
github.com/cloudfoundry-attic/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
github.com/VictoriaMetrics/metrics v1.11.2
|
||||
github.com/cloudfoundry-attic/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
||||
github.com/distatus/battery v0.9.0
|
||||
github.com/gizak/termui/v3 v3.1.0
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -43,6 +43,8 @@ github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k9
|
|||
github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
||||
golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0 h1:4Khi5GeNOkZS5DqSBRn4Sy7BE6GuxwOqARPqfurkdNk=
|
||||
golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
configfile="Config file"
|
||||
usage="Usage: {0} [options]\n\nOptions:\n"
|
||||
total="Total"
|
||||
|
||||
|
||||
[help]
|
||||
|
@ -35,10 +36,102 @@ List <devices|layouts|colorschemes|paths|keys>
|
|||
write="Write out a default config file."
|
||||
|
||||
|
||||
[errors]
|
||||
[error]
|
||||
configparse="failed to parse config file: {0}"
|
||||
cliparse="parsing CLI args: {0}"
|
||||
logsetup="failed to setup log file: {0}"
|
||||
unknownopt="Unknown option \"{0}\"; try layouts, colorschemes, keys, paths, or devices\n"
|
||||
writefail="Failed to write configuration file: {0}"
|
||||
checklog="errors encountered; from {0}:"
|
||||
metricsetup="error setting up {0} metrics: {1}"
|
||||
nometrics="no metrics for {0} {0}"
|
||||
fatalfetch="fatal error fetching {0} info: {1}"
|
||||
recovfetch="recoverable error fetching {0} info; skipping {0}: {0}"
|
||||
nodevfound="no usable {0} found"
|
||||
setuperr="error setting up {0}: {1}"
|
||||
|
||||
|
||||
[widget.label]
|
||||
disk=" Disk Usage "
|
||||
cpu=" CPU Usage "
|
||||
gauge=" Power Level "
|
||||
battery=" Battery Status "
|
||||
batt=" Battery "
|
||||
temp=" Temperatures "
|
||||
net=" Network Usage "
|
||||
netint=" Network Usage: {0} "
|
||||
mem=" Memory Usage "
|
||||
help="""
|
||||
Quit: q or <C-c>
|
||||
|
||||
Process navigation:
|
||||
- k and <Up>: up
|
||||
- j and <Down>: down
|
||||
- <C-u>: half page up
|
||||
- <C-d>: half page down
|
||||
- <C-b>: full page up
|
||||
- <C-f>: full page down
|
||||
- gg and <Home>: jump to top
|
||||
- G and <End>: jump to bottom
|
||||
|
||||
Process actions:
|
||||
- <Tab>: toggle process grouping
|
||||
- dd: kill selected process or group of processes with SIGTERM (15)
|
||||
- d3: kill selected process or group of processes with SIGQUIT (3)
|
||||
- d9: kill selected process or group of processes with SIGKILL (9)
|
||||
|
||||
Process sorting:
|
||||
- c: CPU
|
||||
- m: Mem
|
||||
- p: PID
|
||||
|
||||
Process filtering:
|
||||
- /: start editing filter
|
||||
- (while editing):
|
||||
- <Enter>: accept filter
|
||||
- <C-c> and <Escape>: clear filter
|
||||
|
||||
CPU and Mem graph scaling:
|
||||
- h: scale in
|
||||
- l: scale out
|
||||
|
||||
Network:
|
||||
- b: toggle between mbps and scaled bytes per second
|
||||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
netactivity="failed to get network activity from gopsutil: {0}"
|
||||
negvalrecv="error: negative value for recently received network data from gopsutil. recentBytesRecv: {0}"
|
||||
negvalsent="error: negative value for recently sent network data from gopsutil. recentBytesSent: {0}"
|
||||
|
||||
|
||||
[widget.disk]
|
||||
disk="Disk"
|
||||
mount="Mount"
|
||||
used="Used"
|
||||
free="Free"
|
||||
rs="R/s"
|
||||
ws="W/s"
|
||||
|
||||
|
||||
[widget.proc]
|
||||
filter=" Filter: "
|
||||
label=" Processes "
|
||||
[widget.proc.header]
|
||||
count="Count"
|
||||
command="Command"
|
||||
cpu="CPU%"
|
||||
mem="Mem%"
|
||||
pid="PID"
|
||||
[widget.proc.err]
|
||||
count="failed to get CPU count from gopsutil: {0}"
|
||||
retrieve="failed to retrieve processes: {0}"
|
||||
ps="failed to execute 'ps' command: {0}"
|
||||
gopsutil="failed to get processes from gopsutil: {0}"
|
||||
pidconv="failed to convert PID to int: {0}. line: {1}"
|
||||
cpuconv="failed to convert CPU usage to float: {0}. line: {1}"
|
||||
memconv="failed to convert Mem usage to float: {0}. line: {1}"
|
||||
getcmd="failed to get process command from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
cpupercent="failed to get process cpu usage from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
mempercent="failed to get process memeory usage from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
configfile="Config file"
|
||||
usage="Usage: {0} [options]\n\nOptions:\n"
|
||||
total="Total"
|
||||
|
||||
|
||||
[help]
|
||||
|
@ -36,26 +37,30 @@ write="Write out a default config file."
|
|||
|
||||
|
||||
[error]
|
||||
configparse="0: failed to parse config file: {0}"
|
||||
cliparse="1: parsing CLI args: {0}"
|
||||
logsetup="2: failed to setup log file: {0}"
|
||||
unknownopt="3: Unknown option \"{0}\"; try layouts, colorschemes, keys, paths, or devices\n"
|
||||
writefail="4: Failed to write configuration file: {0}"
|
||||
checklog="5: errors encountered; from {0}:"
|
||||
metricsetup="6: error setting up {0} metrics: {1}"
|
||||
nometrics="7: no metrics for {0} {0}"
|
||||
fatalfetch="8: fatal error fetching {0} info: {1}"
|
||||
recovfetch="9: recoverable error fetching {0} info; skipping {0}: {0}"
|
||||
nodevfound="10: no usable {0} found"
|
||||
setuperr="11: error setting up {0}: {1}"
|
||||
configparse="failed to parse config file: {0}"
|
||||
cliparse="parsing CLI args: {0}"
|
||||
logsetup="failed to setup log file: {0}"
|
||||
unknownopt="Unknown option \"{0}\"; try layouts, colorschemes, keys, paths, or devices\n"
|
||||
writefail="Failed to write configuration file: {0}"
|
||||
checklog="errors encountered; from {0}:"
|
||||
metricsetup="error setting up {0} metrics: {1}"
|
||||
nometrics="no metrics for {0} {0}"
|
||||
fatalfetch="fatal error fetching {0} info: {1}"
|
||||
recovfetch="recoverable error fetching {0} info; skipping {0}: {0}"
|
||||
nodevfound="no usable {0} found"
|
||||
setuperr="error setting up {0}: {1}"
|
||||
|
||||
|
||||
[widget]
|
||||
[widget.label]
|
||||
disk=" Disk Usage "
|
||||
cpu=" CPU Usage "
|
||||
gauge=" Power Level "
|
||||
battery=" Battery Status "
|
||||
batt=
|
||||
batt=" Battery "
|
||||
temp=" Temperatures "
|
||||
net=" Network Usage "
|
||||
netint=" Network Usage: {0} "
|
||||
mem=" Memory Usage "
|
||||
help="""
|
||||
Quit: q or <C-c>
|
||||
|
||||
|
@ -95,6 +100,12 @@ Network:
|
|||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
netactivity="failed to get network activity from gopsutil: {0}"
|
||||
negvalrecv="error: negative value for recently received network data from gopsutil. recentBytesRecv: {0}"
|
||||
negvalsent="error: negative value for recently sent network data from gopsutil. recentBytesSent: {0}"
|
||||
|
||||
|
||||
[widget.disk]
|
||||
disk="Disk"
|
||||
mount="Mount"
|
||||
|
@ -102,3 +113,25 @@ used="Used"
|
|||
free="Free"
|
||||
rs="R/s"
|
||||
ws="W/s"
|
||||
|
||||
|
||||
[widget.proc]
|
||||
filter=" Filter: "
|
||||
label=" Processes "
|
||||
[widget.proc.header]
|
||||
count="Count"
|
||||
command="Command"
|
||||
cpu="CPU%"
|
||||
mem="Mem%"
|
||||
pid="PID"
|
||||
[widget.proc.err]
|
||||
count="failed to get CPU count from gopsutil: {0}"
|
||||
retrieve="failed to retrieve processes: {0}"
|
||||
ps="failed to execute 'ps' command: {0}"
|
||||
gopsutil="failed to get processes from gopsutil: {0}"
|
||||
pidconv="failed to convert PID to int: {0}. line: {1}"
|
||||
cpuconv="failed to convert CPU usage to float: {0}. line: {1}"
|
||||
memconv="failed to convert Mem usage to float: {0}. line: {1}"
|
||||
getcmd="failed to get process command from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
cpupercent="failed to get process cpu usage from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
mempercent="failed to get process memeory usage from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
|
|
137
translations/tt_TT.toml
Normal file
137
translations/tt_TT.toml
Normal file
|
@ -0,0 +1,137 @@
|
|||
configfile="CFG FLE"
|
||||
usage="egasU: {0} [snoitpo]\n\nsnoitpO:\n"
|
||||
total="latoT"
|
||||
|
||||
|
||||
[help]
|
||||
paths="redro ni ,rof dehcraes era ,elif gifnoc eht dna ,stuoyal & semehcsroloc elbadaoL:"
|
||||
log="ni si elif gol ehT {0}"
|
||||
written="ot nettirw gifnoC {0}"
|
||||
|
||||
|
||||
[args]
|
||||
help=".neercs siht wohS"
|
||||
color=".emehcsroloc a teS"
|
||||
scale="0> ,rotcaf elacs hparG"
|
||||
version=".tixe dna noisrev tnirP"
|
||||
percpu=".tegdiw UPC eht ni UPC hcae wohS"
|
||||
cpuavg=".tegdiw UPC eht ni UPC egareva wohS"
|
||||
temp=".tiehnerhaf ni serutarepmet wohS.tiehnerhaf ni serutarepmet wohS"
|
||||
statusbar=".emit eht htiw rabsutats a wohS"
|
||||
rate=".sm001 yreve hserfer = \"sm001\" .etunim yreve hserfer = \"m1\" .detpecca stinu emit tsoM .ycneuqerf hserfeR"
|
||||
layout="Name of layout spec file for the UI. Use \"-\" to pipe."
|
||||
net="gnisu derongi eb osla nac secafretnI .seulav detarapes ammoc gnisu denifed eb nac secafretni lareveS .ecafretni krowten tceleS \"!\""
|
||||
export=".trop deificeps eht no tropxe rof scirtem elbanE"
|
||||
mbps=".spbm sa etar krowten wohS"
|
||||
test=".edoc eruliaf/sseccus htiw stixe dna stset snuR"
|
||||
conffile=")TNEMUGRA TSRIF EB TSUM( tluafed fo daetsni esu ot elif gifnoC"
|
||||
list="""
|
||||
>syek|shtap|semehcsroloc|stuoyal|secived< tsiL
|
||||
stegdiw elbaretlif rof seman ecived tuo stnirP :secived
|
||||
stuoyal ni-dliub stsiL :stuoyal
|
||||
semehcsroloc ni-tliub stsiL :semehcsroloc
|
||||
shtap hcraes elif noitarugifnoc tuo tsiL :shtap
|
||||
tuoyal a ni desu eb nac taht stegdiW :stegdiw
|
||||
.sgnidnib draobyek eht wohS :syek """
|
||||
write=".elif gifnoc tluafed a tuo etirW"
|
||||
|
||||
|
||||
[error]
|
||||
configparse="elif gifnoc esrap ot deliaf: {0}"
|
||||
cliparse="sgra ILC gnisrap: {0}"
|
||||
logsetup="elif gol putes ot deliaf: {0}"
|
||||
unknownopt="noitpo nwonknU \"{0}\"; secived ro ,shtap ,syek ,semehcsroloc ,stuoyal yrt\n"
|
||||
writefail="elif noitarugifnoc etirw ot deliaF: {0}"
|
||||
checklog="morf ;deretnuocne srorre {0}:"
|
||||
metricsetup="pu gnittes rorre {0} scirtem: {1}"
|
||||
nometrics="rof scirtem on {0} {0}"
|
||||
fatalfetch="gnihctef rorre lataf {0} ofni: {1}"
|
||||
recovfetch="gnihctef rorre elbarevocer {0} gnippiks ;ofni {0}: {0}"
|
||||
nodevfound="elbasu on {0} dnuof"
|
||||
setuperr="pu gnittes rorre {0}: {1}"
|
||||
|
||||
|
||||
[widget.label]
|
||||
disk=" egasU ksiD "
|
||||
cpu=" egasU UPC "
|
||||
gauge=" leveL rewoP "
|
||||
battery=" sutatS yrettaB "
|
||||
batt=" yrettaB "
|
||||
temp=" serutarepmeT "
|
||||
net=" egasU krowteN "
|
||||
netint=" egasU krowteN: {0} "
|
||||
mem=" egasU yromeM "
|
||||
help="""
|
||||
>c-C< ro q :tiuQ
|
||||
|
||||
:noitagivan ssecorP
|
||||
pu :>pU< dna k -
|
||||
nwod :>nwoD< dna j -
|
||||
pu egap flah :>u-C< -
|
||||
nwod egap flah :>d-C< -
|
||||
pu egap lluf :>b-C< -
|
||||
nwod egap lluf :>f-C< -
|
||||
pot ot pmuj :>emoH< dna gg -
|
||||
mottob ot pmuj :>dnE< dna G -
|
||||
|
||||
:snoitca ssecorP
|
||||
gnipuorg ssecorp elggot :>baT< -
|
||||
)51( MRETGIS htiw sessecorp fo puorg ro ssecorp detceles llik :dd -
|
||||
)3( TIUQGIS htiw sessecorp fo puorg ro ssecorp detceles llik :3d -
|
||||
)9( LLIKGIS htiw sessecorp fo puorg ro ssecorp detceles llik :9d -
|
||||
|
||||
:gnitros ssecorP
|
||||
UPC :c -
|
||||
meM :m -
|
||||
DIP :p -
|
||||
|
||||
:gniretlif ssecorP
|
||||
retlif gnitide trats :/ -
|
||||
:)gnitide elihw( -
|
||||
retlif tpecca :>retnE< -
|
||||
retlif raelc :>epacsE< dna >c-C< -
|
||||
|
||||
:gnilacs hparg meM dna UPC
|
||||
ni elacs :h -
|
||||
tuo elacs :l -
|
||||
|
||||
:krowteN
|
||||
dnoces rep setyb delacs dna spbm neewteb elggot :b -
|
||||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
netactivity="lituspog morf ytivitca krowten teg ot deliaf: {0}"
|
||||
negvalrecv=":vceRsetyBtnecer .lituspog morf atad krowten deviecer yltnecer rof eulav evitagen :rorre {0}"
|
||||
negvalsent=":tneSsetyBtnecer .lituspog morf atad krowten tnes yltnecer rof eulav evitagen :rorre {0}"
|
||||
|
||||
|
||||
[widget.disk]
|
||||
disk="ksiD"
|
||||
mount="tnuoM"
|
||||
used="desU"
|
||||
free="eerF"
|
||||
rs="s/R"
|
||||
ws="s/W"
|
||||
|
||||
|
||||
[widget.proc]
|
||||
filter=" :retliF "
|
||||
label=" sessecorP "
|
||||
[widget.proc.header]
|
||||
count="tnuoC"
|
||||
command="dnammoC"
|
||||
cpu="%UPC"
|
||||
mem="%meM"
|
||||
pid="DIP"
|
||||
[widget.proc.err]
|
||||
count=":lituspog morf tnuoc UPC teg ot deliaf {0}"
|
||||
retrieve=":sessecorp eveirter ot deliaf {0}"
|
||||
ps=":dnammoc 'sp' etucexe ot deliaf {0}"
|
||||
gopsutil=":lituspog morf sessecorp teg ot deliaf {0}"
|
||||
pidconv=":tni ot DIP trevnoc ot deliaf {0}. enil: {1}"
|
||||
cpuconv=":taolf ot egasu UPC trevnoc ot deliaf {0}. :enil {1}"
|
||||
memconv=":taolf ot egasu meM trevnoc ot deliaf {0}. :enil {1}"
|
||||
getcmd=":lituspog morf dnammoc ssecorp teg ot deliaf {0}. corPsp: {1}. i: {2}. dip: {3}"
|
||||
cpupercent="lituspog morf egasu upc ssecorp teg ot deliaf: {0}. corPsp: {1}. i: {2}. dip: {3}"
|
||||
mempercent="spog morf egasu yroemem ssecorp teg ot deliafutil: {0}. corPsp: {1}. i: {2}. dip: {3}"
|
|
@ -1,5 +1,6 @@
|
|||
configfile="配置文件"
|
||||
usage="使用方法: {0} [选项]\n\n选项:\n"
|
||||
total="Total"
|
||||
|
||||
|
||||
[help]
|
||||
|
@ -26,19 +27,111 @@ test="执行测试并返回成功或失败码。"
|
|||
conffile="用于替代缺省参数的配置文件(必须是第一个参数)"
|
||||
list="""
|
||||
List <devices|layouts|colorschemes|paths|keys>
|
||||
devices: 显示可用于过滤的设备名
|
||||
layouts: 列出所有内置布局方案
|
||||
colorschemes: 列出所有内置配色方案
|
||||
paths: 列出配置文件的搜索路径
|
||||
widgets: 所有可被用于布局的组件
|
||||
keys: 显示所有热键。"""
|
||||
write="将当前配置写入缺省配置文件。"
|
||||
devices: Prints out device names for filterable widgets
|
||||
layouts: Lists build-in layouts
|
||||
colorschemes: Lists built-in colorschemes
|
||||
paths: List out configuration file search paths
|
||||
widgets: Widgets that can be used in a layout
|
||||
keys: Show the keyboard bindings."""
|
||||
write="Write out a default config file."
|
||||
|
||||
|
||||
[errors]
|
||||
configparse="无法解析配置文件: {0}"
|
||||
cliparse="解析命令行参数: {0}"
|
||||
logsetup="无法创建日志文件: {0}"
|
||||
unknownopt="不认识 \"{0}\"; 请使用 layouts, colorschemes, keys, paths, 或 devices\n"
|
||||
writefail="无法写入配置文件: {0}"
|
||||
checklog="出错了; 位于 {0}:"
|
||||
[error]
|
||||
configparse="failed to parse config file: {0}"
|
||||
cliparse="parsing CLI args: {0}"
|
||||
logsetup="failed to setup log file: {0}"
|
||||
unknownopt="Unknown option \"{0}\"; try layouts, colorschemes, keys, paths, or devices\n"
|
||||
writefail="Failed to write configuration file: {0}"
|
||||
checklog="errors encountered; from {0}:"
|
||||
metricsetup="error setting up {0} metrics: {1}"
|
||||
nometrics="no metrics for {0} {0}"
|
||||
fatalfetch="fatal error fetching {0} info: {1}"
|
||||
recovfetch="recoverable error fetching {0} info; skipping {0}: {0}"
|
||||
nodevfound="no usable {0} found"
|
||||
setuperr="error setting up {0}: {1}"
|
||||
|
||||
|
||||
[widget.label]
|
||||
disk=" Disk Usage "
|
||||
cpu=" CPU Usage "
|
||||
gauge=" Power Level "
|
||||
battery=" Battery Status "
|
||||
batt=" Battery "
|
||||
temp=" Temperatures "
|
||||
net=" Network Usage "
|
||||
netint=" Network Usage: {0} "
|
||||
mem=" Memory Usage "
|
||||
help="""
|
||||
Quit: q or <C-c>
|
||||
|
||||
Process navigation:
|
||||
- k and <Up>: up
|
||||
- j and <Down>: down
|
||||
- <C-u>: half page up
|
||||
- <C-d>: half page down
|
||||
- <C-b>: full page up
|
||||
- <C-f>: full page down
|
||||
- gg and <Home>: jump to top
|
||||
- G and <End>: jump to bottom
|
||||
|
||||
Process actions:
|
||||
- <Tab>: toggle process grouping
|
||||
- dd: kill selected process or group of processes with SIGTERM (15)
|
||||
- d3: kill selected process or group of processes with SIGQUIT (3)
|
||||
- d9: kill selected process or group of processes with SIGKILL (9)
|
||||
|
||||
Process sorting:
|
||||
- c: CPU
|
||||
- m: Mem
|
||||
- p: PID
|
||||
|
||||
Process filtering:
|
||||
- /: start editing filter
|
||||
- (while editing):
|
||||
- <Enter>: accept filter
|
||||
- <C-c> and <Escape>: clear filter
|
||||
|
||||
CPU and Mem graph scaling:
|
||||
- h: scale in
|
||||
- l: scale out
|
||||
|
||||
Network:
|
||||
- b: toggle between mbps and scaled bytes per second
|
||||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
netactivity="failed to get network activity from gopsutil: {0}"
|
||||
negvalrecv="error: negative value for recently received network data from gopsutil. recentBytesRecv: {0}"
|
||||
negvalsent="error: negative value for recently sent network data from gopsutil. recentBytesSent: {0}"
|
||||
|
||||
|
||||
[widget.disk]
|
||||
disk="Disk"
|
||||
mount="Mount"
|
||||
used="Used"
|
||||
free="Free"
|
||||
rs="R/s"
|
||||
ws="W/s"
|
||||
|
||||
|
||||
[widget.proc]
|
||||
filter=" Filter: "
|
||||
label=" Processes "
|
||||
[widget.proc.header]
|
||||
count="Count"
|
||||
command="Command"
|
||||
cpu="CPU%"
|
||||
mem="Mem%"
|
||||
pid="PID"
|
||||
[widget.proc.err]
|
||||
count="failed to get CPU count from gopsutil: {0}"
|
||||
retrieve="failed to retrieve processes: {0}"
|
||||
ps="failed to execute 'ps' command: {0}"
|
||||
gopsutil="failed to get processes from gopsutil: {0}"
|
||||
pidconv="failed to convert PID to int: {0}. line: {1}"
|
||||
cpuconv="failed to convert CPU usage to float: {0}. line: {1}"
|
||||
memconv="failed to convert Mem usage to float: {0}. line: {1}"
|
||||
getcmd="failed to get process command from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
cpupercent="failed to get process cpu usage from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
mempercent="failed to get process memeory usage from gopsutil: {0}. psProc: {1}. i: {2}. pid: {3}"
|
||||
|
|
|
@ -23,7 +23,7 @@ func NewBatteryWidget(horizontalScale int) *BatteryWidget {
|
|||
LineGraph: ui.NewLineGraph(),
|
||||
updateInterval: time.Minute,
|
||||
}
|
||||
self.Title = tr.Value("widget.battery")
|
||||
self.Title = tr.Value("widget.label.battery")
|
||||
self.HorizontalScale = horizontalScale
|
||||
|
||||
// intentional duplicate
|
||||
|
@ -60,7 +60,7 @@ func (b *BatteryWidget) EnableMetric() {
|
|||
}
|
||||
|
||||
func makeID(i int) string {
|
||||
return tr.Value("widget.batt") + strconv.Itoa(i)
|
||||
return tr.Value("widget.label.batt") + strconv.Itoa(i)
|
||||
}
|
||||
|
||||
func (b *BatteryWidget) Scale(i int) {
|
||||
|
|
|
@ -18,7 +18,7 @@ type BatteryGauge struct {
|
|||
|
||||
func NewBatteryGauge() *BatteryGauge {
|
||||
self := &BatteryGauge{Gauge: termui.NewGauge()}
|
||||
self.Title = tr.Value("widget.gauge")
|
||||
self.Title = tr.Value("widget.label.gauge")
|
||||
|
||||
self.update()
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ func NewCPUWidget(updateInterval time.Duration, horizontalScale int, showAverage
|
|||
ShowPerCPULoad: showPerCPULoad,
|
||||
cpuLoads: make(map[string]float64),
|
||||
}
|
||||
self.Title = tr.Value("cpu")
|
||||
self.Title = tr.Value("widget.label.cpu")
|
||||
self.HorizontalScale = horizontalScale
|
||||
|
||||
if !(self.ShowAverageLoad || self.ShowPerCPULoad) {
|
||||
|
|
|
@ -37,7 +37,7 @@ func NewDiskWidget() *DiskWidget {
|
|||
updateInterval: time.Second,
|
||||
Partitions: make(map[string]*Partition),
|
||||
}
|
||||
self.Title = tr.Value("widget.disk")
|
||||
self.Title = tr.Value("widget.label.disk")
|
||||
self.Header = []string{tr.Value("disk.disk"), tr.Value("disk.mount"), tr.Value("disk.used"), tr.Value("disk.free"), tr.Value("disk.rs"), tr.Value("disk.ws")}
|
||||
self.ColGap = 2
|
||||
self.ColResizer = func() {
|
||||
|
|
|
@ -21,7 +21,7 @@ func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget
|
|||
LineGraph: ui.NewLineGraph(),
|
||||
updateInterval: updateInterval,
|
||||
}
|
||||
widg.Title = " Memory Usage "
|
||||
widg.Title = tr.Value("widget.label.mem")
|
||||
widg.HorizontalScale = horizontalScale
|
||||
mems := make(map[string]devices.MemoryInfo)
|
||||
devices.UpdateMem(mems)
|
||||
|
|
|
@ -47,9 +47,9 @@ func NewNetWidget(netInterface string) *NetWidget {
|
|||
updateInterval: time.Second,
|
||||
NetInterface: strings.Split(netInterface, ","),
|
||||
}
|
||||
self.Title = " Network Usage "
|
||||
self.Title = tr.Value("widget.label.net")
|
||||
if netInterface != "all" {
|
||||
self.Title = fmt.Sprintf(" Network Usage: %s ", netInterface)
|
||||
self.Title = tr.Value("widget.label.netint", netInterface)
|
||||
}
|
||||
|
||||
self.update()
|
||||
|
@ -73,7 +73,7 @@ func (net *NetWidget) EnableMetric() {
|
|||
func (net *NetWidget) update() {
|
||||
interfaces, err := psNet.IOCounters(true)
|
||||
if err != nil {
|
||||
log.Printf("failed to get network activity from gopsutil: %v", err)
|
||||
log.Println(tr.Value("widget.net.err.netactivity", err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -114,12 +114,14 @@ func (net *NetWidget) update() {
|
|||
recentBytesSent = totalBytesSent - net.totalBytesSent
|
||||
|
||||
if int(recentBytesRecv) < 0 {
|
||||
log.Printf("error: negative value for recently received network data from gopsutil. recentBytesRecv: %v", recentBytesRecv)
|
||||
v := fmt.Sprintf("%d", recentBytesRecv)
|
||||
log.Println(tr.Value("widget.net.err.negvalrecv", v))
|
||||
// recover from error
|
||||
recentBytesRecv = 0
|
||||
}
|
||||
if int(recentBytesSent) < 0 {
|
||||
log.Printf("error: negative value for recently sent network data from gopsutil. recentBytesSent: %v", recentBytesSent)
|
||||
v := fmt.Sprintf("%d", recentBytesSent)
|
||||
log.Printf(tr.Value("widget.net.err.negvalsent", v))
|
||||
// recover from error
|
||||
recentBytesSent = 0
|
||||
}
|
||||
|
@ -160,7 +162,7 @@ func (net *NetWidget) update() {
|
|||
recentConverted, unitRecent = utils.ConvertBytes(recent)
|
||||
}
|
||||
|
||||
net.Lines[i].Title1 = fmt.Sprintf(" Total %s: %5.1f %s", label, totalConverted, unitTotal)
|
||||
net.Lines[i].Title1 = fmt.Sprintf(" %s %s: %5.1f %s", tr.Value("total"), label, totalConverted, unitTotal)
|
||||
net.Lines[i].Title2 = fmt.Sprintf(format, rate, recentConverted, unitRecent)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ type ProcWidget struct {
|
|||
func NewProcWidget() *ProcWidget {
|
||||
cpuCount, err := psCPU.Counts(false)
|
||||
if err != nil {
|
||||
log.Printf("failed to get CPU count from gopsutil: %v", err)
|
||||
log.Println(tr.Value("error.proc.err.count", err.Error()))
|
||||
}
|
||||
self := &ProcWidget{
|
||||
Table: ui.NewTable(),
|
||||
|
@ -63,14 +63,14 @@ func NewProcWidget() *ProcWidget {
|
|||
}
|
||||
self.entry = &ui.Entry{
|
||||
Style: self.TitleStyle,
|
||||
Label: " Filter: ",
|
||||
Label: tr.Value("widget.proc.filter"),
|
||||
Value: "",
|
||||
UpdateCallback: func(val string) {
|
||||
self.filter = val
|
||||
self.update()
|
||||
},
|
||||
}
|
||||
self.Title = " Processes "
|
||||
self.Title = tr.Value("widget.proc.label")
|
||||
self.ShowCursor = true
|
||||
self.ShowLocation = true
|
||||
self.ColGap = 3
|
||||
|
@ -137,7 +137,7 @@ func (proc *ProcWidget) filterProcs(procs []Proc) []Proc {
|
|||
func (proc *ProcWidget) update() {
|
||||
procs, err := getProcs()
|
||||
if err != nil {
|
||||
log.Printf("failed to retrieve processes: %v", err)
|
||||
log.Printf(tr.Value("widget.proc.error.retrieve", err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,15 @@ func (proc *ProcWidget) update() {
|
|||
// sortProcs sorts either the grouped or ungrouped []Process based on the sortMethod.
|
||||
// Called with every update, when the sort method is changed, and when processes are grouped and ungrouped.
|
||||
func (proc *ProcWidget) sortProcs() {
|
||||
proc.Header = []string{"Count", "Command", "CPU%", "Mem%"}
|
||||
proc.Header = []string{
|
||||
tr.Value("widget.proc.header.count"),
|
||||
tr.Value("widget.proc.header.command"),
|
||||
tr.Value("widget.proc.header.cpu"),
|
||||
tr.Value("widget.proc.header.mem"),
|
||||
}
|
||||
|
||||
if !proc.showGroupedProcs {
|
||||
proc.Header[0] = "PID"
|
||||
proc.Header[0] = tr.Value("widget.proc.header.pid")
|
||||
}
|
||||
|
||||
var procs *[]Proc
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
func getProcs() ([]Proc, error) {
|
||||
output, err := exec.Command("ps", "-axo", "pid:10,comm:50,pcpu:5,pmem:5,args").Output()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to execute 'ps' command: %v", err)
|
||||
return nil, fmt.Errorf(tr.Value("widget.proc.err.ps", err.Error()))
|
||||
}
|
||||
|
||||
// converts to []string, removing trailing newline and header
|
||||
|
@ -21,15 +21,15 @@ func getProcs() ([]Proc, error) {
|
|||
for _, line := range linesOfProcStrings {
|
||||
pid, err := strconv.Atoi(strings.TrimSpace(line[0:10]))
|
||||
if err != nil {
|
||||
log.Printf("failed to convert PID to int: %v. line: %v", err, line)
|
||||
log.Println(tr.Value("widget.proc.err.pidconv", err.Error(), line))
|
||||
}
|
||||
cpu, err := strconv.ParseFloat(strings.TrimSpace(line[63:68]), 64)
|
||||
if err != nil {
|
||||
log.Printf("failed to convert CPU usage to float: %v. line: %v", err, line)
|
||||
log.Println(tr.Value("widget.proc.err.cpuconv", err.Error(), line))
|
||||
}
|
||||
mem, err := strconv.ParseFloat(strings.TrimSpace(line[69:74]), 64)
|
||||
if err != nil {
|
||||
log.Printf("failed to convert Mem usage to float: %v. line: %v", err, line)
|
||||
log.Println(tr.Value("widget.proc.err.memconv", err.Error(), line))
|
||||
}
|
||||
proc := Proc{
|
||||
Pid: pid,
|
||||
|
|
|
@ -23,7 +23,7 @@ func getProcs() ([]Proc, error) {
|
|||
keywords := fmt.Sprintf("pid=%s,comm=%s,pcpu=%s,pmem=%s,args", ten, fifty, five, five)
|
||||
output, err := exec.Command("ps", "-caxo", keywords).Output()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to execute 'ps' command: %v", err)
|
||||
return nil, fmt.Errorf(tr.Value("widget.proc.err.ps", err.Error()))
|
||||
}
|
||||
|
||||
// converts to []string and removes the header
|
||||
|
@ -33,15 +33,15 @@ func getProcs() ([]Proc, error) {
|
|||
for _, line := range linesOfProcStrings {
|
||||
pid, err := strconv.Atoi(strings.TrimSpace(line[0:10]))
|
||||
if err != nil {
|
||||
log.Printf("failed to convert first field to int: %v. split: %v", err, line)
|
||||
log.Println(tr.Value("widget.proc.err.pidconv", err.Error(), line))
|
||||
}
|
||||
cpu, err := strconv.ParseFloat(utils.ConvertLocalizedString(strings.TrimSpace(line[63:68])), 64)
|
||||
if err != nil {
|
||||
log.Printf("failed to convert third field to float: %v. split: %v", err, line)
|
||||
log.Println(tr.Value("widget.proc.err.cpuconv", err.Error(), line))
|
||||
}
|
||||
mem, err := strconv.ParseFloat(utils.ConvertLocalizedString(strings.TrimSpace(line[69:74])), 64)
|
||||
if err != nil {
|
||||
log.Printf("failed to convert fourth field to float: %v. split: %v", err, line)
|
||||
log.Println(tr.Value("widget.proc.err.memconv", err.Error(), line))
|
||||
}
|
||||
proc := Proc{
|
||||
Pid: pid,
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
func getProcs() ([]Proc, error) {
|
||||
psProcs, err := psProc.Processes()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get processes from gopsutil: %v", err)
|
||||
return nil, fmt.Errorf(tr.Value("widget.proc.err.gopsutil", err.Error()))
|
||||
}
|
||||
|
||||
procs := make([]Proc, len(psProcs))
|
||||
|
@ -18,15 +18,15 @@ func getProcs() ([]Proc, error) {
|
|||
pid := psProc.Pid
|
||||
command, err := psProc.Name()
|
||||
if err != nil {
|
||||
log.Printf("failed to get process command from gopsutil: %v. psProc: %v. i: %v. pid: %v", err, psProc, i, pid)
|
||||
log.Println(tr.Value("widget.proc.err.getcmd", err, psProc, i, pid))
|
||||
}
|
||||
cpu, err := psProc.CPUPercent()
|
||||
if err != nil {
|
||||
log.Printf("failed to get process cpu usage from gopsutil: %v. psProc: %v. i: %v. pid: %v", err, psProc, i, pid)
|
||||
log.Println(tr.Value("widget.proc.err.cpupercent", err, psProc, i, pid))
|
||||
}
|
||||
mem, err := psProc.MemoryPercent()
|
||||
if err != nil {
|
||||
log.Printf("failed to get process memeory usage from gopsutil: %v. psProc: %v. i: %v. pid: %v", err, psProc, i, pid)
|
||||
log.Println(tr.Value("widget.proc.err.mempercent", err, psProc, i, pid))
|
||||
}
|
||||
|
||||
procs[i] = Proc{
|
||||
|
|
|
@ -39,7 +39,7 @@ func NewTempWidget(tempScale TempScale, filter []string) *TempWidget {
|
|||
TempThreshold: 80,
|
||||
TempScale: tempScale,
|
||||
}
|
||||
self.Title = " Temperatures "
|
||||
self.Title = tr.Value("widget.label.temp")
|
||||
if len(filter) > 0 {
|
||||
for _, t := range filter {
|
||||
self.Data[t] = 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user