Ensure translations are loaded.

Since i18next loads translations asynchronously we need to make sure
that they are loaded before we call the JS code which depends on them.

Fixes #982
This commit is contained in:
Umair Khan
2016-06-10 12:03:36 +05:00
committed by Tim Abbott
parent d29ab6651b
commit c61a3dfbcc
5 changed files with 61 additions and 25 deletions

View File

@@ -126,7 +126,7 @@ function render_bots() {
// Choose avatar stamp fairly randomly, to help get old avatars out of cache.
exports.avatar_stamp = Math.floor(Math.random()*100);
exports.setup_page = function () {
function _setup_page() {
// To build the edit bot streams dropdown we need both the bot and stream
// API results. To prevent a race streams will be initialized to a promise
// at page load. This promise will be resolved with a list of streams after
@@ -670,6 +670,10 @@ exports.setup_page = function () {
}
});
});
}
exports.setup_page = function () {
i18n.ensure_i18n(_setup_page);
};
return exports;