aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-03-06 06:55:44 +0300
committerRblSb <msrblsb@gmail.com>2020-03-06 19:03:23 +0300
commitf4546e9f999e2ae26ee83bc706abcd9971317afa (patch)
tree2f60f4af7e9670723a17c9f2add3e5e4ce0489d0 /src
parent0ca7420ad952c0332ab36e37596b0fa53e710325 (diff)
Load only required languages on client
Diffstat (limited to 'src')
-rw-r--r--src/Lang.hx12
-rw-r--r--src/client/players/Youtube.hx1
-rw-r--r--src/server/Main.hx1
3 files changed, 10 insertions, 4 deletions
diff --git a/src/Lang.hx b/src/Lang.hx
index 8632812..7b7642d 100644
--- a/src/Lang.hx
+++ b/src/Lang.hx
@@ -7,13 +7,17 @@ import sys.io.File;
#else
import haxe.Http;
#end
+using Lambda;
private typedef LangMap = Map<String, String>;
class Lang {
- static final ids = ["en", "ru"];
static final langs:Map<String, LangMap> = [];
+ static var ids = ["en", "ru"];
+ #if (js && !nodejs)
+ static var lang = js.Browser.navigator.language.substr(0, 2).toLowerCase();
+ #end
static function request(path:String, callback:(data:String)->Void):Void {
#if (sys || nodejs)
@@ -26,6 +30,10 @@ class Lang {
}
public static function init(folderPath:String, ?callback:()->Void):Void {
+ #if (js && !nodejs)
+ // Filter unused languages
+ ids = ids.filter(id -> id == lang || id == "en");
+ #end
langs.clear();
var count = 0;
for (name in ids) {
@@ -50,8 +58,6 @@ class Lang {
return text == null ? key : text;
}
#else
- static var lang = js.Browser.navigator.language.substr(0, 2).toLowerCase();
-
public static function get(key:String):String {
if (langs[lang] == null) lang = "en";
final text = langs[lang][key];
diff --git a/src/client/players/Youtube.hx b/src/client/players/Youtube.hx
index 4307514..15eb014 100644
--- a/src/client/players/Youtube.hx
+++ b/src/client/players/Youtube.hx
@@ -80,6 +80,7 @@ class Youtube implements IPlayer {
}
final title:String = item.snippet.title;
final duration:String = item.contentDetails.duration;
+ // TODO duration is PT0S for streams
callback({
duration: convertTime(duration),
title: title
diff --git a/src/server/Main.hx b/src/server/Main.hx
index 5cac674..e9dd816 100644
--- a/src/server/Main.hx
+++ b/src/server/Main.hx
@@ -432,7 +432,6 @@ class Main {
case Rewind:
if (!checkPermission(client, RewindPerm)) return;
if (videoList.length == 0) return;
- // TODO permission
data.rewind.time += videoTimer.getTime();
if (data.rewind.time < 0) data.rewind.time = 0;
videoTimer.setTime(data.rewind.time);
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage