Files
zulip/frontend_tests/node_tests/i18n.js
Anders Kaseorg 428956c086 zjsunit: Remove set_global side effect from zrequire.
ES6 and TS modules don’t insert themselves into `window`, so our tests
shouldn’t insert them either.  Since the test `window` behaves like
`global` now, we can rely on legacy modules that do insert themselves
to do it themselves.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 14:29:17 -08:00

65 lines
2.0 KiB
JavaScript

set_global('Handlebars', global.make_handlebars());
zrequire('templates');
set_global('i18n', zrequire('i18n', 'i18next'));
i18n.init({
nsSeparator: false,
keySeparator: false,
interpolation: {
prefix: "__",
suffix: "__",
},
lng: 'fr',
resources: {
fr: {
translation: {
"Quote and reply": "French translation",
"Desktop notifications are triggered for messages that are offscreen when they arrive. Mobile and email notifications are triggered once you have been away from Zulip for a few minutes.": "Some French text",
},
},
},
});
run_test('t_tag', () => {
const args = {
message: {
is_stream: true,
id: "99",
stream: "devel",
subject: "testing",
sender_full_name: "King Lear",
},
should_display_quote_and_reply: true,
can_edit_message: true,
can_mute_topic: true,
narrowed: true,
};
const html = require('../../static/templates/actions_popover_content.hbs')(args);
assert(html.indexOf("French translation") > 0);
});
run_test('tr_tag', () => {
const args = {
page_params: {
full_name: "John Doe",
password_auth_enabled: false,
avatar_url: "http://example.com",
left_side_userlist: false,
twenty_four_hour_time: false,
enable_stream_desktop_notifications: false,
enable_stream_push_notifications: false,
enable_stream_audible_notifications: false,
enable_desktop_notifications: false,
enable_sounds: false,
enable_offline_email_notifications: false,
enable_offline_push_notifications: false,
enable_online_push_notifications: false,
enable_digest_emails: false,
},
};
const html = require('../../static/templates/settings_tab.hbs')(args);
assert(html.indexOf('Some French text') > 0);
});