1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 14:25:02 -05:00

* work around missing JFX WebView navigator.language settings

This commit is contained in:
Reinhard Pointner 2015-06-12 10:44:44 +00:00
parent 53aadcd8ae
commit 2602dc20ef
2 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import static net.filebot.Settings.*;
import java.awt.Desktop;
import java.lang.reflect.Field;
import java.net.URI;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@ -75,6 +76,9 @@ public class GettingStartedStage {
// force black background while page is loading
setBackground(webview.getEngine(), 0xFF000000);
// make sure that we can read the user locale in JS
webview.getEngine().executeScript(String.format("navigator.locale = '%s'", Locale.getDefault()));
}
public void show() {

View File

@ -49,7 +49,7 @@ function getData() {
}]
var links = location.hash.length > 0
var youtube = !(/zh(.CN)?/i).test(navigator.language) // YouTube is blocked in China (mainland)
var youtube = !(/zh(.CN)?/i).test(navigator.locale ? navigator.locale : navigator.language) // YouTube is blocked in China (mainland)
if (links) {
data = data.slice(0, 5) // use only tutorial images