about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Jordan <alex@strugee.net>2017-01-16 15:08:35 -0500
committerAlex Jordan <alex@strugee.net>2017-01-16 15:08:35 -0500
commit5e84b5cd15cf76a9c4c350d7dfa50fcc48767d24 (patch)
tree15113c64522a6608225857169fd9d1cdf854d5bd
parent1c14861891a24afb412aac1e3d1c8ed684f7a384 (diff)
downloadphp-xmpp-invitation-5e84b5cd15cf76a9c4c350d7dfa50fcc48767d24.tar.gz
Don't initialize i18n until the document is loaded
-rw-r--r--scripts/main.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/main.js b/scripts/main.js
index 632925d..afcda7b 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -2,13 +2,7 @@
 	'use strict';
 
 	var initialized = false;
-
-	// load i18n and perform translation
-	var i18n = new I18nText({path: 'lang'});
-	i18n.once(I18nText.EVT_LOCALE_CHANGE, function (data) {
-		translate_ui();
-	});
-	i18n.setLocale('en');
+	var i18n;
 
 	// i18n key prefix for MUC ("muc.") or 1:1 chat ("chat.")
 	var key_prefix;
@@ -86,6 +80,13 @@
 		if (initialized) return;
 		initialized = true;
 
+		// load i18n and perform translation
+		i18n = new I18nText({path: 'lang'});
+		i18n.once(I18nText.EVT_LOCALE_CHANGE, function (data) {
+			translate_ui();
+		});
+		i18n.setLocale('en');
+
 		// functionality
 		load_clients();
 		rehash();