From fb8efc2772ebda763e82e6d2249348725cece485 Mon Sep 17 00:00:00 2001 From: Kushan Joshi <0o3ko0@gmail.com> Date: Mon, 16 Jan 2017 11:49:06 +0530 Subject: [PATCH] Change translation on the fly --- modules/ui/init.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/ui/init.js b/modules/ui/init.js index 1b5661b42..7e93d9734 100644 --- a/modules/ui/init.js +++ b/modules/ui/init.js @@ -298,6 +298,19 @@ export function uiInit(context) { }); } + ui.restart = function(arg) { + context.container().selectAll('*').remove(); + context.locale(arg); + context.loadLocale(function(err) { + if (!err) { + context.history().unlock(); + render(context.container()); + } + }); + }; + + window.restart = ui.restart; + ui.sidebar = uiSidebar(context); return ui;