Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
i18n: Remove i18next.
Anders Kaseorgd8a36d07022a
diff --git a/frontend_tests/zjsunit/i18n.js b/frontend_tests/zjsunit/i18n.jsindex d9cdfbc9b21..0d05a40feaf 100644--- a/frontend_tests/zjsunit/i18n.js+++ b/frontend_tests/zjsunit/i18n.js@@ -53,44 +53,3 @@ exports.$t_html = (descriptor, values) =>),},);--exports.i18n = {};-exports.i18n.t = function (str, context) {- // HAPPY PATH: most translations are a simple string:- if (context === undefined) {- return "translated: " + str;- }-- /*- context will be an ordinary JS object like this:-- {minutes: minutes.toString()}-- This supports use cases like the following:-- i18n.t("__minutes__ min to edit", {minutes: minutes.toString()})-- We have to munge in the context here.- */- const keyword_regex = /__(- )?(\w)+__/g;- const keys_in_str = str.match(keyword_regex) || [];- const substitutions = keys_in_str.map((key) => {- let prefix_length;- if (key.startsWith("__- ")) {- prefix_length = 4;- } else {- prefix_length = 2;- }- return {- keyword: key.slice(prefix_length, -2),- prefix: key.slice(0, prefix_length),- suffix: key.slice(-2, key.length),- };- });-- for (const item of substitutions) {- str = str.replace(item.prefix + item.keyword + item.suffix, context[item.keyword]);- }-- return "translated: " + str;-};diff --git a/package.json b/package.jsonindex 5c8dac626da..8b30a1441b9 100644--- a/package.json+++ b/package.json@@ -46,7 +46,6 @@"handlebars": "^4.7.2","handlebars-loader": "^1.7.1","html-webpack-plugin": "^4.0.0-beta.8",- "i18next": "^20.2.1","jquery": "^3.4.1","jquery-caret-plugin": "^1.5.2","jquery-validation": "^1.19.0",diff --git a/static/js/i18n.js b/static/js/i18n.jsindex 20be295578c..79c72997847 100644--- a/static/js/i18n.js+++ b/static/js/i18n.js@@ -2,7 +2,6 @@// https://zulip.readthedocs.io/en/latest/translating/internationalization.htmlimport {createIntl, createIntlCache} from "@formatjs/intl";-import i18next from "i18next";import _ from "lodash";import {page_params} from "./page_params";@@ -37,21 +36,3 @@ export function $t_html(descriptor, values) {),});}--i18next.init({- lng: "lang",- resources: {- lang: {- translation: page_params.translation_data,- },- },- nsSeparator: false,- keySeparator: false,- interpolation: {- prefix: "__",- suffix: "__",- },- returnEmptyString: false, // Empty string is not a valid translation.-});--export const i18n = i18next;diff --git a/version.py b/version.pyindex 79f30a5cec7..0a57cd8b97a 100644--- a/version.py+++ b/version.py@@ -45,4 +45,4 @@ API_FEATURE_LEVEL = 54# historical commits sharing the same major version, in which case a# minor version bump suffices.-PROVISION_VERSION = "139.2"+PROVISION_VERSION = "140.0"diff --git a/yarn.lock b/yarn.lockindex 2c41c6b9400..f4e5d424f04 100644--- a/yarn.lock+++ b/yarn.lock@@ -891,7 +891,7 @@pirates "^4.0.0"source-map-support "^0.5.16"-"@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":+"@babel/runtime@^7.12.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":version "7.13.10"resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d"integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw==@@ -7119,13 +7119,6 @@ human-signals@^2.1.0:resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==-i18next@^20.2.1:- version "20.2.1"- resolved "https://registry.yarnpkg.com/i18next/-/i18next-20.2.1.tgz#8aedfdc596f7d54b9d3f6d87bcb89214467cb785"- integrity sha512-JLruWDEQ3T6tKT6P7u+DsNtToMHUwUcQIYOMRcnNBdUhSfKkoIDUKdVDKgGtmqr//LrirxjADUdr3d5Gwbow6g==- dependencies:- "@babel/runtime" "^7.12.0"-version "0.4.24"resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"diff --git a/zerver/management/commands/makemessages.py b/zerver/management/commands/makemessages.pyindex 6e5fe59ac09..3498fcdd03d 100644--- a/zerver/management/commands/makemessages.py+++ b/zerver/management/commands/makemessages.py@@ -58,10 +58,6 @@ regexes = [r'\(t "(.*?)"\)',r'=\(t "(.*?)"\)(?=[^{]*}})',r"=\(t '(.*?)'\)(?=[^{]*}})",- r"i18n\.t\('([^']*?)'\)",- r"i18n\.t\('(.*?)',\s*.*?[^,]\)",- r'i18n\.t\("([^"]*?)"\)',- r'i18n\.t\("(.*?)",\s*.*?[^,]\)',]tags = [("err_", "error"),diff --git a/zerver/tests/test_i18n.py b/zerver/tests/test_i18n.pyindex 22f27fd5bac..200885e371e 100644--- a/zerver/tests/test_i18n.py+++ b/zerver/tests/test_i18n.py@@ -166,10 +166,6 @@ class FrontendRegexTestCase(ZulipTestCase):('{{t "english text" }}, "extra"}}', "english text"),("{{t 'english text' }}, 'extra'}}", "english text"),("{{> template var=(t 'english text') }}, 'extra'}}", "english text"),- ('i18n.t("english text"), "extra",)', "english text"),- ('i18n.t("english text", context), "extra",)', "english text"),- ("i18n.t('english text'), 'extra',)", "english text"),- ("i18n.t('english text', context), 'extra',)", "english text"),]for input_text, expected in data: