Translate Sidebar js file

This commit is contained in:
shortcutme 2016-11-18 20:13:12 +01:00
parent c8acb74f0c
commit 1ef3338f9e

View file

@ -15,6 +15,7 @@ import gevent
from Config import config from Config import config
from Plugin import PluginManager from Plugin import PluginManager
from Debug import Debug from Debug import Debug
from Translate import Translate
from util import helper from util import helper
plugin_dir = "plugins/Sidebar" plugin_dir = "plugins/Sidebar"
@ -22,6 +23,8 @@ media_dir = plugin_dir + "/media"
sys.path.append(plugin_dir) # To able to load geoip lib sys.path.append(plugin_dir) # To able to load geoip lib
loc_cache = {} loc_cache = {}
if "_" not in locals():
_ = Translate("plugins/Sidebar/languages/")
@PluginManager.registerTo("UiRequest") @PluginManager.registerTo("UiRequest")
@ -41,6 +44,9 @@ class UiRequestPlugin(object):
# If debugging merge *.css to all.css and *.js to all.js # If debugging merge *.css to all.css and *.js to all.js
from Debug import DebugMedia from Debug import DebugMedia
DebugMedia.merge(plugin_media_file) DebugMedia.merge(plugin_media_file)
if ext == "js":
yield _.translateData(open(plugin_media_file).read())
else:
for part in self.actionFile(plugin_media_file, send_header=False): for part in self.actionFile(plugin_media_file, send_header=False):
yield part yield part
elif path.startswith("/uimedia/globe/"): # Serve WebGL globe files elif path.startswith("/uimedia/globe/"): # Serve WebGL globe files