From 1b050ba0c3cfa70077ebfce9e0da93353f903c0f Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Sun, 13 Nov 2016 16:07:10 +0100
Subject: [PATCH] Switch to the actual system locale at startup if we have
 translations for it. Otherwise fall back to the default 'en' locale.

---
 pd/nw/pdlang.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/pd/nw/pdlang.js b/pd/nw/pdlang.js
index 9c1561796..45183e655 100644
--- a/pd/nw/pdlang.js
+++ b/pd/nw/pdlang.js
@@ -1,6 +1,14 @@
 "use strict";
 
-var lang = require('./locales/en/translation.json');
+var lang;
+
+try {
+    // try the locale given by navigator.language
+    lang = require('./locales/'+navigator.language+'/translation.json');
+} catch (e) {
+    // if that fails then fall back to the default locale 'en'
+    lang = require('./locales/en/translation.json');
+}
 
 exports.lang = lang;
 
-- 
GitLab