Trayicon Chinese translation.
This commit is contained in:
parent
4e0fea1d8b
commit
83f379a4d1
2 changed files with 34 additions and 15 deletions
|
@ -5,9 +5,12 @@ import atexit
|
||||||
|
|
||||||
from Plugin import PluginManager
|
from Plugin import PluginManager
|
||||||
from Config import config
|
from Config import config
|
||||||
|
from Translate import Translate
|
||||||
|
|
||||||
allow_reload = False # No source reload supported in this plugin
|
allow_reload = False # No source reload supported in this plugin
|
||||||
|
|
||||||
|
if "_" not in locals():
|
||||||
|
_ = Translate("plugins/Trayicon/languages/")
|
||||||
|
|
||||||
@PluginManager.registerTo("Actions")
|
@PluginManager.registerTo("Actions")
|
||||||
class ActionsPlugin(object):
|
class ActionsPlugin(object):
|
||||||
|
@ -46,14 +49,14 @@ class ActionsPlugin(object):
|
||||||
(self.titleConsole, self.toggleConsole),
|
(self.titleConsole, self.toggleConsole),
|
||||||
(self.titleAutorun, self.toggleAutorun),
|
(self.titleAutorun, self.toggleAutorun),
|
||||||
"--",
|
"--",
|
||||||
("ZeroNet Twitter", lambda: self.opensite("https://twitter.com/HelloZeroNet")),
|
(_["ZeroNet Twitter"], lambda: self.opensite("https://twitter.com/HelloZeroNet")),
|
||||||
("ZeroNet Reddit", lambda: self.opensite("http://www.reddit.com/r/zeronet/")),
|
(_["ZeroNet Reddit"], lambda: self.opensite("http://www.reddit.com/r/zeronet/")),
|
||||||
("ZeroNet Github", lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet")),
|
(_["ZeroNet Github"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet")),
|
||||||
("Report bug/request feature", lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet/issues")),
|
(_["Report bug/request feature"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet/issues")),
|
||||||
"--",
|
"--",
|
||||||
("!Open ZeroNet", lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage) )),
|
(_["!Open ZeroNet"], lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage) )),
|
||||||
"--",
|
"--",
|
||||||
("Quit", self.quit),
|
(_["Quit"], self.quit),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -74,29 +77,30 @@ class ActionsPlugin(object):
|
||||||
webbrowser.open(url, new=0)
|
webbrowser.open(url, new=0)
|
||||||
|
|
||||||
def titleIp(self):
|
def titleIp(self):
|
||||||
title = "!IP: %s" % config.ip_external
|
title = "!IP: %s " % config.ip_external
|
||||||
if self.main.file_server.port_opened:
|
if self.main.file_server.port_opened:
|
||||||
title += " (active)"
|
title += _["(active)"]
|
||||||
else:
|
else:
|
||||||
title += " (passive)"
|
title += _["(passive)"]
|
||||||
return title
|
return title
|
||||||
|
|
||||||
def titleConnections(self):
|
def titleConnections(self):
|
||||||
title = "Connections: %s" % len(self.main.file_server.connections)
|
title = _["Connections: %s"] % len(self.main.file_server.connections)
|
||||||
return title
|
return title
|
||||||
|
|
||||||
def titleTransfer(self):
|
def titleTransfer(self):
|
||||||
title = "Received: %.2f MB | Sent: %.2f MB" % (
|
title = _["Received: %.2f MB | Sent: %.2f MB"] % (
|
||||||
float(self.main.file_server.bytes_recv) / 1024 / 1024,
|
float(self.main.file_server.bytes_recv) / 1024 / 1024,
|
||||||
float(self.main.file_server.bytes_sent) / 1024 / 1024
|
float(self.main.file_server.bytes_sent) / 1024 / 1024
|
||||||
)
|
)
|
||||||
return title
|
return title
|
||||||
|
|
||||||
def titleConsole(self):
|
def titleConsole(self):
|
||||||
|
translate = _["Show console window"]
|
||||||
if self.console:
|
if self.console:
|
||||||
return "+Show console window"
|
return "+" + translate
|
||||||
else:
|
else:
|
||||||
return "Show console window"
|
return translate
|
||||||
|
|
||||||
def toggleConsole(self):
|
def toggleConsole(self):
|
||||||
if self.console:
|
if self.console:
|
||||||
|
@ -126,10 +130,11 @@ class ActionsPlugin(object):
|
||||||
return os.path.isfile(path) and open(path).read() == self.formatAutorun()
|
return os.path.isfile(path) and open(path).read() == self.formatAutorun()
|
||||||
|
|
||||||
def titleAutorun(self):
|
def titleAutorun(self):
|
||||||
|
translate = _["Start ZeroNet when Windows starts"]
|
||||||
if self.isAutorunEnabled():
|
if self.isAutorunEnabled():
|
||||||
return "+Start ZeroNet when Windows starts"
|
return "+" + translate
|
||||||
else:
|
else:
|
||||||
return "Start ZeroNet when Windows starts"
|
return translate
|
||||||
|
|
||||||
def toggleAutorun(self):
|
def toggleAutorun(self):
|
||||||
if self.isAutorunEnabled():
|
if self.isAutorunEnabled():
|
||||||
|
|
14
plugins/Trayicon/languages/zh.json
Normal file
14
plugins/Trayicon/languages/zh.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"ZeroNet Twitter": "ZeroNet Twitter",
|
||||||
|
"ZeroNet Reddit": "ZeroNet Reddit",
|
||||||
|
"ZeroNet Github": "ZeroNet Github",
|
||||||
|
"Report bug/request feature": "反馈问题/请求功能",
|
||||||
|
"!Open ZeroNet": "!打开 ZeroNet",
|
||||||
|
"Quit": "退出",
|
||||||
|
"(active)": "(激活)",
|
||||||
|
"(passive)": "(passive)",
|
||||||
|
"Connections: %s": "连接数: %s",
|
||||||
|
"Received: %.2f MB | Sent: %.2f MB": "已收到: %.2f MB | 已发送: %.2f MB",
|
||||||
|
"Show console window": "显示控制台窗口",
|
||||||
|
"Start ZeroNet when Windows starts": "在 Windows 启动时运行 ZeroNet"
|
||||||
|
}
|
Loading…
Reference in a new issue