From 038a2c76929bd3b3ef19f33e1667489414911aff Mon Sep 17 00:00:00 2001 From: Greg Price Date: Fri, 23 Jun 2017 12:55:56 -0700 Subject: [PATCH] unread_ui: Wait for i18n setup before rendering. Without this, the "Since you were last here" text got rendered in English for me every time when I tested in German, both in dev and on chat.zulip.org. This brings us to 9 places we invoke `ensure_i18n`. That seems like a sign that there may well be more places we're still missing, and that we should probably find a more systematic way to make sure all our frontend UI rendering waits for translation to be ready. Anyway, for now, fix this one. --- static/js/unread_ui.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/unread_ui.js b/static/js/unread_ui.js index 5cdd8c216c..25c563c4b6 100644 --- a/static/js/unread_ui.js +++ b/static/js/unread_ui.js @@ -93,7 +93,7 @@ function consider_bankruptcy() { } } -exports.initialize = function initialize() { +function _initialize() { // No matter how the bankruptcy modal is closed, show unread counts after. $("#bankruptcy").on("hide", function () { unread_ui.enable(); @@ -108,8 +108,11 @@ exports.initialize = function initialize() { }); consider_bankruptcy(); -}; +} +exports.initialize = function () { + i18n.ensure_i18n(_initialize); +}; return exports; }());