From a103949c2b4888a42ea2170f2f913458ecb12e29 Mon Sep 17 00:00:00 2001 From: Aditya Bansal Date: Fri, 30 Jun 2017 00:18:49 +0530 Subject: [PATCH] i18n.js: Fix issue of i18n stub not returning 'translated: ' prefix. --- frontend_tests/node_tests/compose.js | 10 +++++----- frontend_tests/zjsunit/i18n.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index 1834a21720..4e652c2969 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -109,7 +109,7 @@ people.add(bob); assert(!$("#sending-indicator").visible()); assert(!$("#compose-send-button").is_focused()); assert.equal($("#compose-send-button").attr('disabled'), undefined); - assert.equal($('#error-msg').html(), 'You have nothing to send!'); + assert.equal($('#error-msg').html(), i18n.t('You have nothing to send!')); $("#new_message_content").val('foobarfoobar'); var zephyr_checked = false; @@ -122,13 +122,13 @@ people.add(bob); }; assert(!compose.validate()); assert(zephyr_checked); - assert.equal($('#error-msg').html(), 'You need to be running Zephyr mirroring in order to send messages!'); + assert.equal($('#error-msg').html(), i18n.t('You need to be running Zephyr mirroring in order to send messages!')); compose_state.set_message_type('private'); compose_state.recipient(''); $("#private_message_recipient").select(noop); assert(!compose.validate()); - assert.equal($('#error-msg').html(), 'Please specify at least one recipient'); + assert.equal($('#error-msg').html(), i18n.t('Please specify at least one recipient')); compose_state.recipient('foo@zulip.com'); global.page_params.realm_is_zephyr_mirror_realm = true; @@ -150,14 +150,14 @@ people.add(bob); compose_state.stream_name(''); $("#stream").select(noop); assert(!compose.validate()); - assert.equal($('#error-msg').html(), 'Please specify a stream'); + assert.equal($('#error-msg').html(), i18n.t('Please specify a stream')); compose_state.stream_name('Denmark'); global.page_params.realm_mandatory_topics = true; compose_state.subject(''); $("#subject").select(noop); assert(!compose.validate()); - assert.equal($('#error-msg').html(), 'Please specify a topic'); + assert.equal($('#error-msg').html(), i18n.t('Please specify a topic')); }()); (function test_set_focused_recipient() { diff --git a/frontend_tests/zjsunit/i18n.js b/frontend_tests/zjsunit/i18n.js index 1a324f4861..1ea3a24c56 100644 --- a/frontend_tests/zjsunit/i18n.js +++ b/frontend_tests/zjsunit/i18n.js @@ -5,7 +5,7 @@ i18n.t = function (str, context) { // of key value pairs and string will be having substitution for keywords // like these "__keyword__". if (context === undefined) { - return str; + return 'translated: ' + str; } var keyword_regex = /__(\w)+__/g; var keys_in_str = str.match(keyword_regex);