js: Convert static/js/i18n.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-03-25 13:38:40 -07:00 committed by Tim Abbott
parent 40c3d07b2c
commit bb1b2048bd
82 changed files with 106 additions and 9 deletions

View File

@ -108,8 +108,7 @@
"files": ["frontend_tests/node_tests/**"], "files": ["frontend_tests/node_tests/**"],
"globals": { "globals": {
"current_msg_list": false, "current_msg_list": false,
"home_msg_list": false, "home_msg_list": false
"i18n": false
} }
}, },
{ {
@ -127,7 +126,6 @@
"csrf_token": false, "csrf_token": false,
"current_msg_list": true, "current_msg_list": true,
"home_msg_list": false, "home_msg_list": false,
"i18n": false,
"page_params": false, "page_params": false,
"StripeCheckout": false, "StripeCheckout": false,
"zxcvbn": false "zxcvbn": false

View File

@ -3,6 +3,7 @@
const {strict: assert} = require("assert"); const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars"); const {stub_templates} = require("../zjsunit/handlebars");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery"); const $ = require("../zjsunit/zjquery");

View File

@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const _ = require("lodash"); const _ = require("lodash");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");

View File

@ -6,6 +6,7 @@ const {JSDOM} = require("jsdom");
const MockDate = require("mockdate"); const MockDate = require("mockdate");
const {stub_templates} = require("../zjsunit/handlebars"); const {stub_templates} = require("../zjsunit/handlebars");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip"); const blueslip = require("../zjsunit/zblueslip");

View File

@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const autosize = require("autosize"); const autosize = require("autosize");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery"); const $ = require("../zjsunit/zjquery");

View File

@ -2,6 +2,7 @@
const {strict: assert} = require("assert"); const {strict: assert} = require("assert");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip"); const blueslip = require("../zjsunit/zblueslip");

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert"); const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace"); const {set_global, unmock_module, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
// We download our translations in `page_params` (which // We download our translations in `page_params` (which
@ -20,6 +20,7 @@ set_global("page_params", {
// We use `i18n.js` to initialize `i18next` and // We use `i18n.js` to initialize `i18next` and
// to set `i18n` to `i18next` on the global namespace // to set `i18n` to `i18next` on the global namespace
// for `templates.js`. // for `templates.js`.
unmock_module("../../static/js/i18n");
zrequire("i18n"); zrequire("i18n");
zrequire("templates"); zrequire("templates");

View File

@ -6,6 +6,7 @@ const {parseISO} = require("date-fns");
const _ = require("lodash"); const _ = require("lodash");
const MockDate = require("mockdate"); const MockDate = require("mockdate");
const {i18n} = require("../zjsunit/i18n");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip"); const blueslip = require("../zjsunit/zblueslip");

View File

@ -3,6 +3,7 @@
const {strict: assert} = require("assert"); const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars"); const {stub_templates} = require("../zjsunit/handlebars");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery"); const $ = require("../zjsunit/zjquery");

View File

@ -3,6 +3,7 @@
const {strict: assert} = require("assert"); const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars"); const {stub_templates} = require("../zjsunit/handlebars");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip"); const blueslip = require("../zjsunit/zblueslip");

View File

@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const _ = require("lodash"); const _ = require("lodash");
const {stub_templates} = require("../zjsunit/handlebars"); const {stub_templates} = require("../zjsunit/handlebars");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip"); const blueslip = require("../zjsunit/zblueslip");

View File

@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const {add} = require("date-fns"); const {add} = require("date-fns");
const MockDate = require("mockdate"); const MockDate = require("mockdate");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace"); const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test"); const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery"); const $ = require("../zjsunit/zjquery");

View File

@ -1,6 +1,7 @@
"use strict"; "use strict";
exports.t = function (str, context) { exports.i18n = {};
exports.i18n.t = function (str, context) {
// HAPPY PATH: most translations are a simple string: // HAPPY PATH: most translations are a simple string:
if (context === undefined) { if (context === undefined) {
return "translated: " + str; return "translated: " + str;

View File

@ -89,7 +89,8 @@ try {
namespace.mock_esm("../../static/js/blueslip", blueslip); namespace.mock_esm("../../static/js/blueslip", blueslip);
require("../../static/js/blueslip"); require("../../static/js/blueslip");
namespace.set_global("i18n", stub_i18n); namespace.mock_esm("../../static/js/i18n", stub_i18n);
require("../../static/js/i18n");
run_one_module(file); run_one_module(file);

View File

@ -93,6 +93,25 @@ exports.mock_esm = (request, obj = {}) => {
return exports.mock_cjs(request, {...obj, __esModule: true}); return exports.mock_cjs(request, {...obj, __esModule: true});
}; };
exports.unmock_module = (request) => {
const filename = Module._resolveFilename(
request,
require.cache[callsites()[1].getFileName()],
false,
);
if (!module_mocks.has(filename)) {
throw new Error(`Cannot unmock ${filename}, which was not mocked`);
}
if (!used_module_mocks.has(filename)) {
throw new Error(`You asked to mock ${filename} but we never saw it during compilation.`);
}
module_mocks.delete(filename);
used_module_mocks.delete(filename);
};
exports.set_global = function (name, val) { exports.set_global = function (name, val) {
if (val === null) { if (val === null) {
throw new Error(` throw new Error(`

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import render_admin_tab from "../templates/admin_tab.hbs"; import render_admin_tab from "../templates/admin_tab.hbs";
import render_settings_organization_settings_tip from "../templates/settings/organization_settings_tip.hbs"; import render_settings_organization_settings_tip from "../templates/settings/organization_settings_tip.hbs";
import {i18n} from "./i18n";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as settings from "./settings"; import * as settings from "./settings";
import * as settings_bots from "./settings_bots"; import * as settings_bots from "./settings_bots";

View File

@ -4,6 +4,7 @@ import render_alert_word_settings_item from "../templates/settings/alert_word_se
import * as alert_words from "./alert_words"; import * as alert_words from "./alert_words";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
export function render_alert_words_ui() { export function render_alert_words_ui() {
const words = alert_words.get_word_list(); const words = alert_words.get_word_list();

View File

@ -4,6 +4,7 @@ import render_settings_upload_space_stats from "../templates/settings/upload_spa
import render_uploaded_files_list from "../templates/uploaded_files_list.hbs"; import render_uploaded_files_list from "../templates/uploaded_files_list.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import * as timerender from "./timerender"; import * as timerender from "./timerender";

View File

@ -4,6 +4,7 @@ import render_confirm_delete_user_avatar from "../templates/confirm_delete_user_
import * as channel from "./channel"; import * as channel from "./channel";
import * as confirm_dialog from "./confirm_dialog"; import * as confirm_dialog from "./confirm_dialog";
import {i18n} from "./i18n";
import * as settings_data from "./settings_data"; import * as settings_data from "./settings_data";
import * as upload_widget from "./upload_widget"; import * as upload_widget from "./upload_widget";

View File

@ -1,6 +1,7 @@
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as compose_fade_users from "./compose_fade_users"; import * as compose_fade_users from "./compose_fade_users";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as people from "./people"; import * as people from "./people";
import * as presence from "./presence"; import * as presence from "./presence";
import * as timerender from "./timerender"; import * as timerender from "./timerender";

View File

@ -10,7 +10,6 @@ import "jquery-validation";
import "flatpickr"; import "flatpickr";
// Import app JS // Import app JS
import "../i18n";
import "../setup"; import "../setup";
import "../message_list"; import "../message_list";
import "../reload"; import "../reload";

View File

@ -18,6 +18,7 @@ import * as compose_state from "./compose_state";
import * as emoji_picker from "./emoji_picker"; import * as emoji_picker from "./emoji_picker";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import * as hotspots from "./hotspots"; import * as hotspots from "./hotspots";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as message_edit_history from "./message_edit_history"; import * as message_edit_history from "./message_edit_history";
import * as message_flags from "./message_flags"; import * as message_flags from "./message_flags";

View File

@ -1,5 +1,7 @@
import $ from "jquery"; import $ from "jquery";
import {i18n} from "./i18n";
export const status_classes = "alert-error alert-success alert-info alert-warning"; export const status_classes = "alert-error alert-success alert-info alert-warning";
// TODO: Move this to the portico codebase. // TODO: Move this to the portico codebase.

View File

@ -18,6 +18,7 @@ import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import * as drafts from "./drafts"; import * as drafts from "./drafts";
import * as echo from "./echo"; import * as echo from "./echo";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as markdown from "./markdown"; import * as markdown from "./markdown";
import * as notifications from "./notifications"; import * as notifications from "./notifications";

View File

@ -12,6 +12,7 @@ import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import * as drafts from "./drafts"; import * as drafts from "./drafts";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications"; import * as notifications from "./notifications";

View File

@ -1,6 +1,7 @@
import autosize from "autosize"; import autosize from "autosize";
import $ from "jquery"; import $ from "jquery";
import {i18n} from "./i18n";
import * as people from "./people"; import * as people from "./people";
import * as user_status from "./user_status"; import * as user_status from "./user_status";

View File

@ -13,6 +13,7 @@ import * as compose from "./compose";
import * as compose_pm_pill from "./compose_pm_pill"; import * as compose_pm_pill from "./compose_pm_pill";
import * as compose_state from "./compose_state"; import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import {i18n} from "./i18n";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as people from "./people"; import * as people from "./people";
import * as rows from "./rows"; import * as rows from "./rows";

View File

@ -12,6 +12,7 @@ import * as compose_actions from "./compose_actions";
import * as compose_fade from "./compose_fade"; import * as compose_fade from "./compose_fade";
import * as compose_state from "./compose_state"; import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import {i18n} from "./i18n";
import {localstorage} from "./localstorage"; import {localstorage} from "./localstorage";
import * as markdown from "./markdown"; import * as markdown from "./markdown";
import * as narrow from "./narrow"; import * as narrow from "./narrow";

View File

@ -10,6 +10,7 @@ import render_emoji_showcase from "../templates/emoji_showcase.hbs";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import {i18n} from "./i18n";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as popovers from "./popovers"; import * as popovers from "./popovers";
import * as reactions from "./reactions"; import * as reactions from "./reactions";

View File

@ -1,6 +1,7 @@
import Handlebars from "handlebars/runtime"; import Handlebars from "handlebars/runtime";
import _ from "lodash"; import _ from "lodash";
import {i18n} from "./i18n";
import * as message_parser from "./message_parser"; import * as message_parser from "./message_parser";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as people from "./people"; import * as people from "./people";

View File

@ -1,6 +1,7 @@
import $ from "jquery"; import $ from "jquery";
import * as hashchange from "./hashchange"; import * as hashchange from "./hashchange";
import {i18n} from "./i18n";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";
import * as navigate from "./navigate"; import * as navigate from "./navigate";

View File

@ -6,7 +6,6 @@
declare let csrf_token: any; declare let csrf_token: any;
declare let current_msg_list: any; declare let current_msg_list: any;
declare let home_msg_list: any; declare let home_msg_list: any;
declare let i18n: any;
declare let page_params: any; declare let page_params: any;
declare let zulip_test: any; declare let zulip_test: any;

View File

@ -1,5 +1,6 @@
import $ from "jquery"; import $ from "jquery";
import {i18n} from "./i18n";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as people from "./people"; import * as people from "./people";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";

View File

@ -19,4 +19,4 @@ i18next.init({
returnEmptyString: false, // Empty string is not a valid translation. returnEmptyString: false, // Empty string is not a valid translation.
}); });
window.i18n = i18next; export const i18n = i18next;

View File

@ -5,6 +5,7 @@ import render_markdown_help from "../templates/markdown_help.hbs";
import * as browser_history from "./browser_history"; import * as browser_history from "./browser_history";
import * as common from "./common"; import * as common from "./common";
import * as components from "./components"; import * as components from "./components";
import {i18n} from "./i18n";
import * as keydown_util from "./keydown_util"; import * as keydown_util from "./keydown_util";
import * as markdown from "./markdown"; import * as markdown from "./markdown";
import * as overlays from "./overlays"; import * as overlays from "./overlays";

View File

@ -10,6 +10,7 @@ import render_settings_dev_env_email_access from "../templates/settings/dev_env_
import * as browser_history from "./browser_history"; import * as browser_history from "./browser_history";
import * as channel from "./channel"; import * as channel from "./channel";
import * as common from "./common"; import * as common from "./common";
import {i18n} from "./i18n";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";
import * as ui from "./ui"; import * as ui from "./ui";

View File

@ -11,6 +11,7 @@ import * as compose_actions from "./compose_actions";
import * as composebox_typeahead from "./composebox_typeahead"; import * as composebox_typeahead from "./composebox_typeahead";
import * as condense from "./condense"; import * as condense from "./condense";
import * as echo from "./echo"; import * as echo from "./echo";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as markdown from "./markdown"; import * as markdown from "./markdown";
import * as message_store from "./message_store"; import * as message_store from "./message_store";

View File

@ -4,6 +4,7 @@ import $ from "jquery";
import render_message_edit_history from "../templates/message_edit_history.hbs"; import render_message_edit_history from "../templates/message_edit_history.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as people from "./people"; import * as people from "./people";
import * as timerender from "./timerender"; import * as timerender from "./timerender";
import * as ui_report from "./ui_report"; import * as ui_report from "./ui_report";

View File

@ -2,6 +2,7 @@ import autosize from "autosize";
import $ from "jquery"; import $ from "jquery";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import {i18n} from "./i18n";
import {MessageListData} from "./message_list_data"; import {MessageListData} from "./message_list_data";
import {MessageListView} from "./message_list_view"; import {MessageListView} from "./message_list_view";
import * as narrow from "./narrow"; import * as narrow from "./narrow";

View File

@ -14,6 +14,7 @@ import * as compose from "./compose";
import * as compose_fade from "./compose_fade"; import * as compose_fade from "./compose_fade";
import * as condense from "./condense"; import * as condense from "./condense";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import render_message_view_header from "../templates/message_view_header.hbs"; import render_message_view_header from "../templates/message_view_header.hbs";
import {i18n} from "./i18n";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as peer_data from "./peer_data"; import * as peer_data from "./peer_data";
import * as recent_topics from "./recent_topics"; import * as recent_topics from "./recent_topics";

View File

@ -5,6 +5,7 @@ import render_topic_muted from "../templates/topic_muted.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import * as feedback_widget from "./feedback_widget"; import * as feedback_widget from "./feedback_widget";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as muting from "./muting"; import * as muting from "./muting";
import * as overlays from "./overlays"; import * as overlays from "./overlays";

View File

@ -9,6 +9,7 @@ import * as compose_state from "./compose_state";
import * as condense from "./condense"; import * as condense from "./condense";
import {Filter} from "./filter"; import {Filter} from "./filter";
import * as hashchange from "./hashchange"; import * as hashchange from "./hashchange";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as message_fetch from "./message_fetch"; import * as message_fetch from "./message_fetch";
import * as message_list from "./message_list"; import * as message_list from "./message_list";

View File

@ -7,6 +7,7 @@ import * as alert_words from "./alert_words";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as channel from "./channel"; import * as channel from "./channel";
import * as favicon from "./favicon"; import * as favicon from "./favicon";
import {i18n} from "./i18n";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as muting from "./muting"; import * as muting from "./muting";
import * as narrow from "./narrow"; import * as narrow from "./narrow";

View File

@ -6,6 +6,7 @@ import * as typeahead from "../shared/js/typeahead";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import {FoldDict} from "./fold_dict"; import {FoldDict} from "./fold_dict";
import {i18n} from "./i18n";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as reload_state from "./reload_state"; import * as reload_state from "./reload_state";
import * as settings_data from "./settings_data"; import * as settings_data from "./settings_data";

View File

@ -24,6 +24,7 @@ import * as condense from "./condense";
import * as emoji_picker from "./emoji_picker"; import * as emoji_picker from "./emoji_picker";
import * as feature_flags from "./feature_flags"; import * as feature_flags from "./feature_flags";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as message_edit_history from "./message_edit_history"; import * as message_edit_history from "./message_edit_history";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";

View File

@ -3,6 +3,7 @@ import _ from "lodash";
import * as blueslip from "../blueslip"; import * as blueslip from "../blueslip";
import * as common from "../common"; import * as common from "../common";
import {i18n} from "../i18n";
import * as google_analytics from "./google-analytics"; import * as google_analytics from "./google-analytics";
import {path_parts} from "./landing-page"; import {path_parts} from "./landing-page";

View File

@ -7,6 +7,7 @@ import render_message_reaction from "../templates/message_reaction.hbs";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as channel from "./channel"; import * as channel from "./channel";
import * as emoji_picker from "./emoji_picker"; import * as emoji_picker from "./emoji_picker";
import {i18n} from "./i18n";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as people from "./people"; import * as people from "./people";

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import * as channel from "./channel"; import * as channel from "./channel";
import * as compose from "./compose"; import * as compose from "./compose";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as notifications from "./notifications"; import * as notifications from "./notifications";
import * as people from "./people"; import * as people from "./people";
import * as transmit from "./transmit"; import * as transmit from "./transmit";

View File

@ -7,6 +7,7 @@ import render_markdown_timestamp from "../templates/markdown_timestamp.hbs";
import view_code_in_playground from "../templates/view_code_in_playground.hbs"; import view_code_in_playground from "../templates/view_code_in_playground.hbs";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import {i18n} from "./i18n";
import * as people from "./people"; import * as people from "./people";
import * as rtl from "./rtl"; import * as rtl from "./rtl";
import * as settings_config from "./settings_config"; import * as settings_config from "./settings_config";

View File

@ -5,6 +5,7 @@ import render_settings_tab from "../templates/settings_tab.hbs";
import * as admin from "./admin"; import * as admin from "./admin";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import {i18n} from "./i18n";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as people from "./people"; import * as people from "./people";
import * as settings_bots from "./settings_bots"; import * as settings_bots from "./settings_bots";

View File

@ -9,6 +9,7 @@ import * as avatar from "./avatar";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as channel from "./channel"; import * as channel from "./channel";
import * as common from "./common"; import * as common from "./common";
import {i18n} from "./i18n";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as people from "./people"; import * as people from "./people";
import * as pill_typeahead from "./pill_typeahead"; import * as pill_typeahead from "./pill_typeahead";

View File

@ -11,6 +11,7 @@ import * as avatar from "./avatar";
import * as bot_data from "./bot_data"; import * as bot_data from "./bot_data";
import * as channel from "./channel"; import * as channel from "./channel";
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget"; import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as people from "./people"; import * as people from "./people";

View File

@ -1,3 +1,5 @@
import {i18n} from "./i18n";
/* /*
This file contains translations between the integer values used in This file contains translations between the integer values used in
the Zulip API to describe values in dropdowns, radio buttons, and the Zulip API to describe values in dropdowns, radio buttons, and

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import * as channel from "./channel"; import * as channel from "./channel";
import * as emojisets from "./emojisets"; import * as emojisets from "./emojisets";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as settings_config from "./settings_config"; import * as settings_config from "./settings_config";

View File

@ -5,6 +5,7 @@ import render_admin_emoji_list from "../templates/admin_emoji_list.hbs";
import render_settings_emoji_settings_tip from "../templates/settings/emoji_settings_tip.hbs"; import render_settings_emoji_settings_tip from "../templates/settings/emoji_settings_tip.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import * as people from "./people"; import * as people from "./people";

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import render_admin_export_list from "../templates/admin_export_list.hbs"; import render_admin_export_list from "../templates/admin_export_list.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import * as people from "./people"; import * as people from "./people";

View File

@ -5,6 +5,7 @@ import render_settings_revoke_invite_modal from "../templates/settings/revoke_in
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import * as people from "./people"; import * as people from "./people";

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import render_admin_linkifier_list from "../templates/admin_linkifier_list.hbs"; import render_admin_linkifier_list from "../templates/admin_linkifier_list.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as ui from "./ui"; import * as ui from "./ui";
import * as ui_report from "./ui_report"; import * as ui_report from "./ui_report";

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import render_stream_specific_notification_row from "../templates/settings/stream_specific_notification_row.hbs"; import render_stream_specific_notification_row from "../templates/settings/stream_specific_notification_row.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as notifications from "./notifications"; import * as notifications from "./notifications";
import * as settings_config from "./settings_config"; import * as settings_config from "./settings_config";
import * as settings_org from "./settings_org"; import * as settings_org from "./settings_org";

View File

@ -7,6 +7,7 @@ import render_settings_admin_realm_domains_list from "../templates/settings/admi
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as channel from "./channel"; import * as channel from "./channel";
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget"; import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as overlays from "./overlays"; import * as overlays from "./overlays";
import * as realm_icon from "./realm_icon"; import * as realm_icon from "./realm_icon";

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import render_admin_default_streams_list from "../templates/admin_default_streams_list.hbs"; import render_admin_default_streams_list from "../templates/admin_default_streams_list.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";

View File

@ -1,6 +1,7 @@
import $ from "jquery"; import $ from "jquery";
import * as components from "./components"; import * as components from "./components";
import {i18n} from "./i18n";
import * as settings_panel_menu from "./settings_panel_menu"; import * as settings_panel_menu from "./settings_panel_menu";
let toggler; let toggler;

View File

@ -1,5 +1,6 @@
import $ from "jquery"; import $ from "jquery";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as ui_report from "./ui_report"; import * as ui_report from "./ui_report";

View File

@ -6,6 +6,7 @@ import render_confirm_delete_user from "../templates/confirm_delete_user.hbs";
import * as channel from "./channel"; import * as channel from "./channel";
import * as confirm_dialog from "./confirm_dialog"; import * as confirm_dialog from "./confirm_dialog";
import {i18n} from "./i18n";
import * as people from "./people"; import * as people from "./people";
import * as pill_typeahead from "./pill_typeahead"; import * as pill_typeahead from "./pill_typeahead";
import * as ui_report from "./ui_report"; import * as ui_report from "./ui_report";

View File

@ -8,6 +8,7 @@ import * as blueslip from "./blueslip";
import * as bot_data from "./bot_data"; import * as bot_data from "./bot_data";
import * as channel from "./channel"; import * as channel from "./channel";
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget"; import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import * as overlays from "./overlays"; import * as overlays from "./overlays";

View File

@ -4,6 +4,7 @@ import render_confirm_unstar_all_messages from "../templates/confirm_unstar_all_
import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_unstar_all_messages_in_topic.hbs"; import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_unstar_all_messages_in_topic.hbs";
import * as confirm_dialog from "./confirm_dialog"; import * as confirm_dialog from "./confirm_dialog";
import {i18n} from "./i18n";
import * as message_flags from "./message_flags"; import * as message_flags from "./message_flags";
export function confirm_unstar_all_messages() { export function confirm_unstar_all_messages() {

View File

@ -3,6 +3,8 @@ import PlotlyBar from "plotly.js/lib/bar";
import Plotly from "plotly.js/lib/core"; import Plotly from "plotly.js/lib/core";
import PlotlyPie from "plotly.js/lib/pie"; import PlotlyPie from "plotly.js/lib/pie";
import {i18n} from "../i18n";
Plotly.register([PlotlyBar, PlotlyPie]); Plotly.register([PlotlyBar, PlotlyPie]);
const font_14pt = { const font_14pt = {

View File

@ -1,6 +1,7 @@
import $ from "jquery"; import $ from "jquery";
import * as color_class from "./color_class"; import * as color_class from "./color_class";
import {i18n} from "./i18n";
import * as message_view_header from "./message_view_header"; import * as message_view_header from "./message_view_header";
import * as subs from "./subs"; import * as subs from "./subs";

View File

@ -6,6 +6,7 @@ import render_subscription_invites_warning_modal from "../templates/subscription
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as channel from "./channel"; import * as channel from "./channel";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as peer_data from "./peer_data"; import * as peer_data from "./peer_data";
import * as people from "./people"; import * as people from "./people";

View File

@ -2,6 +2,7 @@ import * as blueslip from "./blueslip";
import * as color_data from "./color_data"; import * as color_data from "./color_data";
import {FoldDict} from "./fold_dict"; import {FoldDict} from "./fold_dict";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_list from "./message_list"; import * as message_list from "./message_list";
import * as peer_data from "./peer_data"; import * as peer_data from "./peer_data";
import * as people from "./people"; import * as people from "./people";

View File

@ -10,6 +10,7 @@ import * as blueslip from "./blueslip";
import * as browser_history from "./browser_history"; import * as browser_history from "./browser_history";
import * as channel from "./channel"; import * as channel from "./channel";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as input_pill from "./input_pill"; import * as input_pill from "./input_pill";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import render_subscription_type from "../templates/subscription_type.hbs"; import render_subscription_type from "../templates/subscription_type.hbs";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as peer_data from "./peer_data"; import * as peer_data from "./peer_data";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";

View File

@ -12,6 +12,7 @@ import * as channel from "./channel";
import * as components from "./components"; import * as components from "./components";
import * as compose_state from "./compose_state"; import * as compose_state from "./compose_state";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as loading from "./loading"; import * as loading from "./loading";
import * as message_live_update from "./message_live_update"; import * as message_live_update from "./message_live_update";
import * as message_view_header from "./message_view_header"; import * as message_view_header from "./message_view_header";

View File

@ -1,5 +1,6 @@
import Handlebars from "handlebars/runtime"; import Handlebars from "handlebars/runtime";
import {i18n} from "./i18n";
import * as util from "./util"; import * as util from "./util";
// Below, we register Zulip-specific extensions to the handlebars API. // Below, we register Zulip-specific extensions to the handlebars API.

View File

@ -10,6 +10,8 @@ import {
} from "date-fns"; } from "date-fns";
import $ from "jquery"; import $ from "jquery";
import {i18n} from "./i18n";
let next_timerender_id = 0; let next_timerender_id = 0;
export function clear_for_testing() { export function clear_for_testing() {

View File

@ -4,6 +4,7 @@ import render_widgets_todo_widget from "../templates/widgets/todo_widget.hbs";
import render_widgets_todo_widget_tasks from "../templates/widgets/todo_widget_tasks.hbs"; import render_widgets_todo_widget_tasks from "../templates/widgets/todo_widget_tasks.hbs";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import {i18n} from "./i18n";
export class TaskData { export class TaskData {
task_map = new Map(); task_map = new Map();

View File

@ -3,6 +3,7 @@ import SimpleBar from "simplebar/dist/simplebar";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as common from "./common"; import * as common from "./common";
import {i18n} from "./i18n";
import {localstorage} from "./localstorage"; import {localstorage} from "./localstorage";
import * as message_list from "./message_list"; import * as message_list from "./message_list";

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import _ from "lodash"; import _ from "lodash";
import * as common from "./common"; import * as common from "./common";
import {i18n} from "./i18n";
/* Arguments used in the report_* functions are, /* Arguments used in the report_* functions are,
response- response that we want to display response- response that we want to display

View File

@ -7,6 +7,7 @@ import * as compose from "./compose";
import * as compose_actions from "./compose_actions"; import * as compose_actions from "./compose_actions";
import * as compose_state from "./compose_state"; import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import {i18n} from "./i18n";
export function make_upload_absolute(uri) { export function make_upload_absolute(uri) {
if (uri.startsWith(compose.uploads_path)) { if (uri.startsWith(compose.uploads_path)) {

View File

@ -1,3 +1,5 @@
import {i18n} from "./i18n";
const default_max_file_size = 5; const default_max_file_size = 5;
const supported_types = ["image/jpeg", "image/png", "image/gif", "image/tiff"]; const supported_types = ["image/jpeg", "image/png", "image/gif", "image/tiff"];

View File

@ -6,6 +6,7 @@ import * as browser_history from "./browser_history";
import * as channel from "./channel"; import * as channel from "./channel";
import * as common from "./common"; import * as common from "./common";
import * as feedback_widget from "./feedback_widget"; import * as feedback_widget from "./feedback_widget";
import {i18n} from "./i18n";
import * as night_mode from "./night_mode"; import * as night_mode from "./night_mode";
import * as scroll_bar from "./scroll_bar"; import * as scroll_bar from "./scroll_bar";