From b6e21f84e9d474ad4513ed28ed47e911a75636c8 Mon Sep 17 00:00:00 2001 From: lobsam Date: Mon, 9 Sep 2024 12:08:37 +0530 Subject: [PATCH 1/4] small changes --- static/js/CollectionPage.jsx | 2 +- static/js/sefaria/localizationLanguage/chinese.json | 2 +- static/js/sefaria/localizationLanguage/english.json | 2 +- static/js/sefaria/localizationLanguage/tibetan.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/CollectionPage.jsx b/static/js/CollectionPage.jsx index 6dbd015f74..823f6a7290 100644 --- a/static/js/CollectionPage.jsx +++ b/static/js/CollectionPage.jsx @@ -628,7 +628,7 @@ class CollectionMemberListingActions extends Component { {this.props.isAdmin ?
collection.owner - - collection._can_invite_edit_setting + - collection.can_invite_edit_setting
: null } {this.props.isAdmin ? diff --git a/static/js/sefaria/localizationLanguage/chinese.json b/static/js/sefaria/localizationLanguage/chinese.json index a76c56dfb2..b4848688ab 100644 --- a/static/js/sefaria/localizationLanguage/chinese.json +++ b/static/js/sefaria/localizationLanguage/chinese.json @@ -414,7 +414,7 @@ "collection.unpin_sheet": "固定表单 - 点击取消固定", "collection.pinned_sheet": "固定的表单", "collection.pin_sheet": "固定表单", - "collection._can_invite_edit_setting": "可以邀请并编辑设置", + "collection.can_invite_edit_setting": "可以邀请并编辑设置", "collection.add_and_remove_sheets": "可以添加和删除表单", "collection.leave_collection": "离开收藏", "collection.inviting": "邀请中...", diff --git a/static/js/sefaria/localizationLanguage/english.json b/static/js/sefaria/localizationLanguage/english.json index 26bd8dd2ab..b4b59e61e8 100644 --- a/static/js/sefaria/localizationLanguage/english.json +++ b/static/js/sefaria/localizationLanguage/english.json @@ -418,7 +418,7 @@ "collection.unpin_sheet":"Pinned Sheet - click to unpin", "collection.pinned_sheet":"Pinned Sheet", "collection.pin_sheet":"Pin Sheet", - "collection._can_invite_edit_setting":"can invite & edit settings", + "collection.can_invite_edit_setting":"can invite & edit settings", "collection.add_and_remove_sheets":"can add & remove sheets", "collection.leave_collection":"Leave Collection", "collection.inviting":"Inviting...", diff --git a/static/js/sefaria/localizationLanguage/tibetan.json b/static/js/sefaria/localizationLanguage/tibetan.json index ef3b136446..57454725c4 100644 --- a/static/js/sefaria/localizationLanguage/tibetan.json +++ b/static/js/sefaria/localizationLanguage/tibetan.json @@ -417,7 +417,7 @@ "collection.unpin_sheet":"ཤོག་ངོས་འཛེར་ཡོད། - འཛེར་བ་ཕྱིར་ལེན།", "collection.pinned_sheet":"འཛེར་ཡོད་པའི་ཤོག་ངོས།", "collection.pin_sheet":"ཤོག་ངོས་འཛེར།", - "collection._can_invite_edit_setting":"གདན་འདྲེན་བྱེད་ཐུབ། སྒྲིག་འགོད་རྣམས་སྒྲིག", + "collection.can_invite_edit_setting":"གདན་འདྲེན་བྱེད་ཐུབ། སྒྲིག་འགོད་རྣམས་སྒྲིག", "collection.add_and_remove_sheets":"ཤོག་ངོས་སྣོན་ཐུབ་ལ་བསུབ་ཀྱང་ཐུབ།", "collection.leave_collection":"ཕྱོགས་བསྒྲིགས་ནས་ཐོན།", "collection.inviting":"གདན་འདྲེན་བྱེད་བཞིན་པ་་་", From 9fe0a21702822d9fec2ff08fb04c26f23450c26f Mon Sep 17 00:00:00 2001 From: lobsam Date: Tue, 10 Sep 2024 15:26:14 +0530 Subject: [PATCH 2/4] integrate i18n react --- package-lock.json | 259 ++++++++++++++++++++++++++++++++++++-- package.json | 3 + static/js/AboutSheet.jsx | 1 + static/js/Header.jsx | 8 +- static/js/ReaderApp.jsx | 1 + static/js/sefaria/i18n.js | 32 +++++ 6 files changed, 292 insertions(+), 12 deletions(-) create mode 100644 static/js/sefaria/i18n.js diff --git a/package-lock.json b/package-lock.json index e31c058d3a..cfd371c90d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,12 +10,13 @@ "hasInstallScript": true, "license": "GPL-3.0", "dependencies": { + "@sentry/react": "^7.57.0", "body-parser": "^1.15.1", "buffer": "^6.0.3", "cheerio": "^0.22.0", "classnames": "^2.2.5", "cookie-parser": "^1.4.2", - "core-js": "^3.15.2", + "core-js": "^3.31.1", "css-modules-require-hook": "^4.2.3", "deep-merge": "^1.0.0", "diff-match-patch": "^1.0.0", @@ -27,6 +28,8 @@ "file-saver": "^2.0.5", "findandreplacedomtext": "^0.4.6", "humanize-duration": "^3.27.0", + "i18next": "^23.15.1", + "i18next-browser-languagedetector": "^8.0.0", "is-hotkey": "^0.1.6", "jquery": "^2.2.0", "jquery-ui": "1.12.1", @@ -39,6 +42,7 @@ "react": "^16.8.6", "react-class": "^3.2.2", "react-dom": "^16.8.6", + "react-i18next": "^15.0.1", "react-image-crop": "^8.3.1", "react-jsonschema-form": "^1.0.0", "react-markdown": "^6.0.3", @@ -1843,12 +1847,11 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz", - "integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==", - "dev": true, + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", + "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", "dependencies": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" @@ -1873,6 +1876,11 @@ "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", "hasInstallScript": true }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/@babel/template": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", @@ -2288,6 +2296,141 @@ "semver": "bin/semver.js" } }, + "node_modules/@sentry-internal/feedback": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.119.0.tgz", + "integrity": "sha512-om8TkAU5CQGO8nkmr7qsSBVkP+/vfeS4JgtW3sjoTK0fhj26+DljR6RlfCGWtYQdPSP6XV7atcPTjbSnsmG9FQ==", + "dependencies": { + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry-internal/replay-canvas": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.119.0.tgz", + "integrity": "sha512-NL02VQx6ekPxtVRcsdp1bp5Tb5w6vnfBKSIfMKuDRBy5A10Uc3GSoy/c3mPyHjOxB84452A+xZSx6bliEzAnuA==", + "dependencies": { + "@sentry/core": "7.119.0", + "@sentry/replay": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry-internal/tracing": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.119.0.tgz", + "integrity": "sha512-oKdFJnn+56f0DHUADlL8o9l8jTib3VDLbWQBVkjD9EprxfaCwt2m8L5ACRBdQ8hmpxCEo4I8/6traZ7qAdBUqA==", + "dependencies": { + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/browser": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.119.0.tgz", + "integrity": "sha512-WwmW1Y4D764kVGeKmdsNvQESZiAn9t8LmCWO0ucBksrjL2zw9gBPtOpRcO6l064sCLeSxxzCN+kIxhRm1gDFEA==", + "dependencies": { + "@sentry-internal/feedback": "7.119.0", + "@sentry-internal/replay-canvas": "7.119.0", + "@sentry-internal/tracing": "7.119.0", + "@sentry/core": "7.119.0", + "@sentry/integrations": "7.119.0", + "@sentry/replay": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/core": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.119.0.tgz", + "integrity": "sha512-CS2kUv9rAJJEjiRat6wle3JATHypB0SyD7pt4cpX5y0dN5dZ1JrF57oLHRMnga9fxRivydHz7tMTuBhSSwhzjw==", + "dependencies": { + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/integrations": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.119.0.tgz", + "integrity": "sha512-OHShvtsRW0A+ZL/ZbMnMqDEtJddPasndjq+1aQXw40mN+zeP7At/V1yPZyFaURy86iX7Ucxw5BtmzuNy7hLyTA==", + "dependencies": { + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0", + "localforage": "^1.8.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/react": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.119.0.tgz", + "integrity": "sha512-cf8Cei+qdSA26gx+IMAuc/k44PeBImNzIpXi3930SLhUe44ypT5OZ/44L6xTODHZzTIyMSJPduf59vT2+eW9yg==", + "dependencies": { + "@sentry/browser": "7.119.0", + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0", + "hoist-non-react-statics": "^3.3.2" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "react": "15.x || 16.x || 17.x || 18.x" + } + }, + "node_modules/@sentry/replay": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.119.0.tgz", + "integrity": "sha512-BnNsYL+X5I4WCH6wOpY6HQtp4MgVt0NVlhLUsEyrvMUiTs0bPkDBrulsgZQBUKJsbOr3l9nHrFoNVB/0i6WNLA==", + "dependencies": { + "@sentry-internal/tracing": "7.119.0", + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry/types": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.119.0.tgz", + "integrity": "sha512-27qQbutDBPKGbuJHROxhIWc1i0HJaGLA90tjMu11wt0E4UNxXRX+UQl4Twu68v4EV3CPvQcEpQfgsViYcXmq+w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/utils": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.119.0.tgz", + "integrity": "sha512-ZwyXexWn2ZIe2bBoYnXJVPc2esCSbKpdc6+0WJa8eutXfHq3FRKg4ohkfCBpfxljQGEfP1+kfin945lA21Ka+A==", + "dependencies": { + "@sentry/types": "7.119.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@socket.io/component-emitter": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", @@ -4630,9 +4773,9 @@ } }, "node_modules/core-js": { - "version": "3.30.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.30.1.tgz", - "integrity": "sha512-ZNS5nbiSwDTq4hFosEDqm65izl2CWmLz0hARJMyNQBgkUZMIF51cQiMvIQKA6hvuaeWxQDP3hEedM1JZIgTldQ==", + "version": "3.38.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.1.tgz", + "integrity": "sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -6798,6 +6941,14 @@ "node": ">=0.10.0" } }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dependencies": { + "react-is": "^16.7.0" + } + }, "node_modules/home-or-tmp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", @@ -6833,6 +6984,14 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/html-parse-stringify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz", + "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==", + "dependencies": { + "void-elements": "3.1.0" + } + }, "node_modules/htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -6880,6 +7039,36 @@ "resolved": "https://registry.npmjs.org/humanize-duration/-/humanize-duration-3.28.0.tgz", "integrity": "sha512-jMAxraOOmHuPbffLVDKkEKi/NeG8dMqP8lGRd6Tbf7JgAeG33jjgPWDbXXU7ypCI0o+oNKJFgbSB9FKVdWNI2A==" }, + "node_modules/i18next": { + "version": "23.15.1", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.15.1.tgz", + "integrity": "sha512-wB4abZ3uK7EWodYisHl/asf8UYEhrI/vj/8aoSsrj/ZDxj4/UXPOa1KvFt1Fq5hkUHquNqwFlDprmjZ8iySgYA==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, + "node_modules/i18next-browser-languagedetector": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.0.0.tgz", + "integrity": "sha512-zhXdJXTTCoG39QsrOCiOabnWj2jecouOqbchu3EfhtSHxIB5Uugnm9JaizenOy39h7ne3+fLikIjeW88+rgszw==", + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6933,6 +7122,11 @@ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", "dev": true }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, "node_modules/immer": { "version": "9.0.21", "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", @@ -8547,6 +8741,14 @@ "node": ">= 0.8.0" } }, + "node_modules/lie": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -8594,6 +8796,14 @@ "node": ">=8.9.0" } }, + "node_modules/localforage": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "dependencies": { + "lie": "3.1.1" + } + }, "node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -10653,6 +10863,27 @@ "react": "^16.14.0" } }, + "node_modules/react-i18next": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.0.1.tgz", + "integrity": "sha512-NwxLqNM6CLbeGA9xPsjits0EnXdKgCRSS6cgkgOdNcPXqL+1fYNl8fBg1wmnnHvFy812Bt4IWTPE9zjoPmFj3w==", + "dependencies": { + "@babel/runtime": "^7.24.8", + "html-parse-stringify": "^3.0.1" + }, + "peerDependencies": { + "i18next": ">= 23.2.3", + "react": ">= 16.8.0" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, "node_modules/react-image-crop": { "version": "8.6.12", "resolved": "https://registry.npmjs.org/react-image-crop/-/react-image-crop-8.6.12.tgz", @@ -13489,6 +13720,14 @@ "node": ">=4" } }, + "node_modules/void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -14143,4 +14382,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 9097316243..f319c2c49f 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,8 @@ "file-saver": "^2.0.5", "findandreplacedomtext": "^0.4.6", "humanize-duration": "^3.27.0", + "i18next": "^23.15.1", + "i18next-browser-languagedetector": "^8.0.0", "is-hotkey": "^0.1.6", "jquery": "^2.2.0", "jquery-ui": "1.12.1", @@ -72,6 +74,7 @@ "react": "^16.8.6", "react-class": "^3.2.2", "react-dom": "^16.8.6", + "react-i18next": "^15.0.1", "react-image-crop": "^8.3.1", "react-jsonschema-form": "^1.0.0", "react-markdown": "^6.0.3", diff --git a/static/js/AboutSheet.jsx b/static/js/AboutSheet.jsx index eaa43a6541..de9796120b 100644 --- a/static/js/AboutSheet.jsx +++ b/static/js/AboutSheet.jsx @@ -4,6 +4,7 @@ import Sefaria from "./sefaria/sefaria"; import ReactTags from 'react-tag-autocomplete' import { useDebounce } from "./Hooks"; + const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => { const sheet = Sefaria.sheets.loadSheetByID(masterPanelSheetId); diff --git a/static/js/Header.jsx b/static/js/Header.jsx index d8e9687594..6c8e143444 100644 --- a/static/js/Header.jsx +++ b/static/js/Header.jsx @@ -1,4 +1,5 @@ -import React, { useState, useEffect, useRef} from 'react'; +import React, { useState, useEffect, useRef,} from 'react'; +import { withTranslation } from "react-i18next"; import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import Component from 'react-class'; @@ -23,6 +24,7 @@ class Header extends Component { mobileNavMenuOpen: false, }; } + componentDidMount() { window.addEventListener('keydown', this.handleFirstTab); } @@ -36,6 +38,7 @@ class Header extends Component { this.setState({mobileNavMenuOpen: !this.state.mobileNavMenuOpen}); } render() { + const { t, i18n } = this.props; if (this.props.hidden && !this.props.mobileNavMenuOpen) { return null; } @@ -48,6 +51,7 @@ class Header extends Component {
{ Sefaria._siteSettings.TORAH_SPECIFIC ? {logo} : null } + {t("greeting", {name:'samdup'})} header.text header.topic header.community @@ -702,4 +706,4 @@ const HelpButton = () => { }; -export default Header; +export default withTranslation()(Header); diff --git a/static/js/ReaderApp.jsx b/static/js/ReaderApp.jsx index dd67c46259..bf03bcb383 100644 --- a/static/js/ReaderApp.jsx +++ b/static/js/ReaderApp.jsx @@ -9,6 +9,7 @@ import $ from './sefaria/sefariaJquery'; import EditCollectionPage from './EditCollectionPage'; import Footer from './Footer'; import SearchState from './sefaria/searchState'; +import "./sefaria/i18n.js" import {ContentLanguageContext, AdContext, StrapiDataProvider, ExampleComponent, StrapiDataContext} from './context'; import { ContestLandingPage, diff --git a/static/js/sefaria/i18n.js b/static/js/sefaria/i18n.js new file mode 100644 index 0000000000..86d22c441e --- /dev/null +++ b/static/js/sefaria/i18n.js @@ -0,0 +1,32 @@ +import i18n from 'i18next' +import Languagedetector from 'i18next-browser-languagedetector' +import { initReactI18next } from 'react-i18next' +import Sefaria from './sefaria' + +i18n +.use(Languagedetector) +.use(initReactI18next) +.init({ + lng: Sefaria.interfaceLang, + fallbackLng: 'en', + debug: true, + resources: { + english: { + translation: { + greeting: "hello from english {{name}}" + } + }, + hebrew: { + translation: { + greeting: "hello from Tibetan {{name}}" + } + }, + chinese: { + translation: { + greeting: "hello from Chinese {{name}}" + } + } + } +}) + + From b80eedf72a34e8396d64f44f11df6224700d0a8a Mon Sep 17 00:00:00 2001 From: lobsam Date: Thu, 12 Sep 2024 12:06:54 +0530 Subject: [PATCH 3/4] change file to support i18n support --- static/js/AboutSheet.jsx | 6 ++-- static/js/AddToSourceSheet.jsx | 8 ++--- static/js/CalendarsPage.jsx | 2 +- static/js/CommunityPage.jsx | 2 +- static/js/ConnectionsPanel.jsx | 2 +- static/js/Header.jsx | 13 ++++---- static/js/Misc.jsx | 30 ++++++++++++------- static/js/NavSidebar.jsx | 2 +- static/js/ReaderApp.jsx | 8 ++--- static/js/SearchFilters.jsx | 4 +-- static/js/SearchPage.jsx | 5 +--- static/js/TopicPageAll.jsx | 2 +- static/js/sefaria/i18n.js | 21 ++----------- .../sefaria/localizationLanguage/chinese.json | 26 ++++++++++------ .../localizationLanguage/combineSring.js | 13 ++++++++ .../sefaria/localizationLanguage/english.json | 23 +++++++++----- .../sefaria/localizationLanguage/tibetan.json | 28 ++++++++++------- static/js/sefaria/sefaria.js | 10 +++++-- 18 files changed, 118 insertions(+), 87 deletions(-) create mode 100644 static/js/sefaria/localizationLanguage/combineSring.js diff --git a/static/js/AboutSheet.jsx b/static/js/AboutSheet.jsx index de9796120b..33a4de1601 100644 --- a/static/js/AboutSheet.jsx +++ b/static/js/AboutSheet.jsx @@ -276,7 +276,7 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => { return (

{title}

-

{Sefaria._("Sheet")}

+

profile.tab.sheets

{ }; return
-

My Collections

+

collection.editor.my_collection

{!dataLoaded ? null : @@ -428,7 +428,7 @@ const CollectionsEditor = ({ sheetId }) => {
{newName.length ?
- Create + create
: null}
diff --git a/static/js/AddToSourceSheet.jsx b/static/js/AddToSourceSheet.jsx index 8662ed074e..193129b20c 100644 --- a/static/js/AddToSourceSheet.jsx +++ b/static/js/AddToSourceSheet.jsx @@ -269,16 +269,16 @@ class ConfirmAddToSheet extends Component { disallowedTagsMode: 'discard', }); srefTitles = { - "en": `${Sefaria._("sheet.section_from")} "${sheetTitle}"`, - "he": `${Sefaria._("sheet.section_from")} "${sheetTitle}"`, + "en": `${Sefaria._("sheet.section_from", {sheetTitle: sheetTitle})}`, + "he": `${Sefaria._("sheet.section_from",{sheetTitle: sheetTitle})}`, }; } return (); diff --git a/static/js/CalendarsPage.jsx b/static/js/CalendarsPage.jsx index a959fa8b5e..59d89c7f4f 100644 --- a/static/js/CalendarsPage.jsx +++ b/static/js/CalendarsPage.jsx @@ -73,7 +73,7 @@ const CalendarListing = ({calendar}) => { {calendar.enSubtitle ? - {calendar.enSubtitle} + {calendar.enSubtitle} : null }
diff --git a/static/js/CommunityPage.jsx b/static/js/CommunityPage.jsx index a49d0d6140..6c7c6bf14e 100644 --- a/static/js/CommunityPage.jsx +++ b/static/js/CommunityPage.jsx @@ -110,7 +110,7 @@ const RecentlyPublished = ({multiPanel, toggleSignUpModal}) => { recentSheetsContent.splice(6, 0, joinTheConversation); recentSheetsContent.push( - { Sefaria._("load_more")} + { Sefaria._("load_more")} ); } diff --git a/static/js/ConnectionsPanel.jsx b/static/js/ConnectionsPanel.jsx index 21a9ac404a..a3f461e579 100644 --- a/static/js/ConnectionsPanel.jsx +++ b/static/js/ConnectionsPanel.jsx @@ -1817,7 +1817,7 @@ const ConnectionsPanelSection = ({ title, children }) => { <>
- {title} + {title}
{children} diff --git a/static/js/Header.jsx b/static/js/Header.jsx index 6c8e143444..ed3359e2ac 100644 --- a/static/js/Header.jsx +++ b/static/js/Header.jsx @@ -51,7 +51,6 @@ class Header extends Component {
{ Sefaria._siteSettings.TORAH_SPECIFIC ? {logo} : null } - {t("greeting", {name:'samdup'})} header.text header.topic header.community @@ -81,7 +80,7 @@ class Header extends Component { const mobileHeaderContent = ( <>
-
@@ -420,12 +419,12 @@ const LoggedOutButtons = ({mobile, loginOnly}) => {
{mobile ? : null } - Log in + log_in {loginOnly ? null : {mobile ? : null } - Sign up + sign_up } { Sefaria._siteSettings.TORAH_SPECIFIC ? : null}
@@ -503,15 +502,15 @@ const MobileNavMenu = ({onRefClick, showSearch, openTopic, openURL, close, visib
- Texts + header.text - Topics + header.topic - Community + header.community {/* diff --git a/static/js/Misc.jsx b/static/js/Misc.jsx index d40c0bb759..a5b36d0c50 100644 --- a/static/js/Misc.jsx +++ b/static/js/Misc.jsx @@ -24,6 +24,8 @@ import {EditTextInfo} from "./BookPage"; import ReactMarkdown from 'react-markdown'; import TrackG4 from "./sefaria/trackG4"; import { languages } from 'humanize-duration'; +import { useTranslation } from 'react-i18next'; + /** * Component meant to simply denote a language specific string to go inside an InterfaceText element * ``` @@ -65,14 +67,15 @@ const __filterChildrenByLanguage = (children, language) => { return newChildren; }; -const InterfaceText = ({text, html, markdown, children, context, disallowedMarkdownElements=[]}) => { +const InterfaceText = ({text, html, markdown, children, placeholder, disallowedMarkdownElements=[]}) => { + const {t, i18n} = useTranslation() /** * Renders a single span for interface string with either class `int-en`` or `int-he` depending on Sefaria.interfaceLang. * If passed explicit text or html objects as props with "en" and/or "he", will only use those to determine correct text or fallback text to display. * Otherwise: * `children` can be the English string, which will be translated with Sefaria._ if needed. * `children` can also take the form of components above, so they can be used for longer paragrpahs or paragraphs containing html, if needed. - * `context` is passed to Sefaria._ for additional translation context + * `placeholder` is passed to i18n for additional translation context variable */ const contentVariable = html || markdown || text; // assumption is `markdown` or `html` are preferred over `text` if they are present const isHebrew = Sefaria.interfaceLang === "hebrew"; @@ -88,7 +91,13 @@ const InterfaceText = ({text, html, markdown, children, context, disallowedMarkd } else { // Also handle composition with children const chlCount = React.Children.count(children); if (chlCount === 1) { // Same as passing in a `en` key but with children syntax - textResponse = Sefaria._(children, context); + if (placeholder) { + + textResponse = t(children, placeholder) + console.log(textResponse) + } else { + textResponse = t(children) + } } else if (chlCount <= Object.keys(AvailableLanguages()).length){ // When multiple languages are passed in via children let newChildren = __filterChildrenByLanguage(children, Sefaria.interfaceLang); textResponse = newChildren[0]; //assumes one language element per InterfaceText, may be too naive @@ -512,7 +521,7 @@ const FilterableList = ({ className={classNames({'sans-serif': 1, 'sort-option': 1, noselect: 1, active: sortOption === option})} onClick={() => setSort(option)} > - {option} + {option} ))}
@@ -1133,12 +1142,11 @@ const CategoryHeader = ({children, type, data = [], buttonsToDisplay = ["subcat const [addSource, toggleAddSource] = useEditToggle(); const [addSection, toggleAddSection] = useEditToggle(); const [hiddenButtons, setHiddenButtons] = useHiddenButtons(true); - const buttonOptions = {"subcategory": ["Add sub-category", toggleAddCategory], - "source": ["Add a source", toggleAddSource], - "section": ["Add section", toggleAddSection], - "reorder": ["Reorder sources", toggleReorderCategory], - "edit": ["Edit", toggleEditCategory]}; - + const buttonOptions = {"subcategory": ["category.add_sub_category", toggleAddCategory], + "source": ["category.add_source", toggleAddSource], + "section": ["category.add_section", toggleAddSection], + "reorder": ["category.reorder_section", toggleReorderCategory], + "edit": ["edit", toggleEditCategory]}; let wrapper = ""; let adminButtonsSpan = null; @@ -1567,7 +1575,7 @@ class FollowButton extends Component { return (
{this.props.icon ? : null} - {buttonText} + {buttonText}
); } diff --git a/static/js/NavSidebar.jsx b/static/js/NavSidebar.jsx index bd04a85641..d93afcec3d 100644 --- a/static/js/NavSidebar.jsx +++ b/static/js/NavSidebar.jsx @@ -145,7 +145,7 @@ const AboutTranslatedText = ({translationsSlug}) => { const Resources = () => ( - {/*

panel.resources

+ {/*

panel.resources

diff --git a/static/js/ReaderApp.jsx b/static/js/ReaderApp.jsx index bf03bcb383..436d5bebc4 100644 --- a/static/js/ReaderApp.jsx +++ b/static/js/ReaderApp.jsx @@ -444,7 +444,7 @@ class ReaderApp extends Component { switch (state.menuOpen) { case "navigation": var cats = state.navigationCategories ? state.navigationCategories.join("/") : ""; - hist.title = cats ? state.navigationCategories.map(Sefaria._).join(", ") + " | " + Sefaria._(siteName) : Sefaria._("Pecha - Buddhism in your own words"); + hist.title = cats ? state.navigationCategories.map(Sefaria._).join(", ") + " | " + Sefaria._(siteName) : Sefaria._("url.title_descriptions"); hist.url = "texts" + (cats ? "/" + cats : ""); hist.mode = "navigation"; break; @@ -501,7 +501,7 @@ class ReaderApp extends Component { break; case "allTopics": hist.url = "topics/all/" + state.navigationTopicLetter; - hist.title = Sefaria._("Explore Jewish Texts by Topic") + " - " + state.navigationTopicLetter + " | " + Sefaria._(siteName); + hist.title = Sefaria._("url.topic.descriptions", {navigationTopicLetter: state.navigationTopicLetter, siteName: siteName}); hist.mode = "topics"; break; case "community": @@ -758,14 +758,14 @@ class ReaderApp extends Component { hist.url += `&namedEntityText${i}=${encodeURIComponent(histories[i].selectedNamedEntityText)}`; } hist.url += "&w" + i + "=" + histories[i].sources; //.replace("with=", "with" + i + "=").replace("?", "&"); - hist.title += Sefaria._("url.param.&") + histories[i].title; // TODO this doesn't trim title properly + hist.title += Sefaria._("url.param.history_title", {title: histories[i].title}) // TODO this doesn't trim title properly } } else { var next = "&p=" + histories[i].url; next = next.replace("?", "&").replace(/=/g, (i+1) + "="); hist.url += next; hist.url += Sefaria.util.getUrlVersionsParams(histories[i].currVersions, i+1); - hist.title += Sefaria._("url.param.&") + histories[i].title; + hist.title += Sefaria._("url.param.history_title", {title: histories[i].title}); } if (!isMobileConnectionsOpen) { if (histories[i].lang) { diff --git a/static/js/SearchFilters.jsx b/static/js/SearchFilters.jsx index 0186cf4989..8a8f5ecef3 100644 --- a/static/js/SearchFilters.jsx +++ b/static/js/SearchFilters.jsx @@ -229,7 +229,7 @@ const SearchFilterGroup = ({name, filters, updateSelected, expandable, paged, se return (

- {name} + {name}

{search} {content} @@ -409,7 +409,7 @@ const PagedList = ({items, initial=8, pageSize=20}) => { {items.slice(0, cutoff)} {items.length > cutoff ? : null} diff --git a/static/js/SearchPage.jsx b/static/js/SearchPage.jsx index 930985eb58..7ca607ab53 100644 --- a/static/js/SearchPage.jsx +++ b/static/js/SearchPage.jsx @@ -41,10 +41,7 @@ class SearchPage extends Component {

- {_("results_for")}  - - { this.props.query } - + search_page.results_for 

{this.state.totalResults?.getValue() > 0 ?
diff --git a/static/js/TopicPageAll.jsx b/static/js/TopicPageAll.jsx index 3ffc0cf42b..d253f5706c 100644 --- a/static/js/TopicPageAll.jsx +++ b/static/js/TopicPageAll.jsx @@ -158,7 +158,7 @@ const AlphabeticalTopicsNav = () => { diff --git a/static/js/sefaria/i18n.js b/static/js/sefaria/i18n.js index 86d22c441e..cd85e22381 100644 --- a/static/js/sefaria/i18n.js +++ b/static/js/sefaria/i18n.js @@ -2,6 +2,7 @@ import i18n from 'i18next' import Languagedetector from 'i18next-browser-languagedetector' import { initReactI18next } from 'react-i18next' import Sefaria from './sefaria' +import LanguagesJson from './localizationLanguage/combineSring' i18n .use(Languagedetector) @@ -9,24 +10,8 @@ i18n .init({ lng: Sefaria.interfaceLang, fallbackLng: 'en', - debug: true, - resources: { - english: { - translation: { - greeting: "hello from english {{name}}" - } - }, - hebrew: { - translation: { - greeting: "hello from Tibetan {{name}}" - } - }, - chinese: { - translation: { - greeting: "hello from Chinese {{name}}" - } - } - } + debug: false, + resources: { ...LanguagesJson} }) diff --git a/static/js/sefaria/localizationLanguage/chinese.json b/static/js/sefaria/localizationLanguage/chinese.json index b4848688ab..084f88d206 100644 --- a/static/js/sefaria/localizationLanguage/chinese.json +++ b/static/js/sefaria/localizationLanguage/chinese.json @@ -7,6 +7,7 @@ "email": "电子邮箱", "password": "密码", "pecha": "pecha", + "edit": "Edit", "connection_pannel.tool_btn.more": "更多", "connection_pannel.tool_btn.less": "更少", "translations": "翻译", @@ -21,7 +22,6 @@ "calender_page.weekly_learning":"Weekly Learning", "calender_page.daily_learning":"Daily Learning", "mobile_apps": "移动应用", - "url.param.&": " | ", "on": "开", "off": "关", "yes": "是", @@ -38,10 +38,14 @@ "filter_list.relevance": "相关性", "filter_list.chronological": "按时间顺序", "header.notifications": "通知", + "header.menu": "Menu", "like": "喜欢", "unlike": "不喜欢", - "url.param.moderator_toolsmoderator_tools": "管理员工具", + "url.param.history_title": " | {{title}}", + "url.param.moderator_tools": "管理员工具", "url.paramwith": "与", + "url.title_descriptions": "Pecha - Buddhism in your own words", + "url.topic.descriptions": "Explore Buddhist Texts by Topic - {{navigationTopicLetter}} | {{siteName}}", "copy": "复制", "view_in_editor": "在编辑器中查看", "copied": "已复制", @@ -123,7 +127,7 @@ "ladino": "拉迪诺语", "chinese": "中文", "bilingual_layout": "双语布局", - "results_for": "搜索结果:", + "search_page.results_for": "搜索结果: ( {{searchedItem}} )", "results": "结果", "options": "选项", "exact_matches_only": "仅精确匹配", @@ -336,7 +340,7 @@ "sheet.untitled_sourc_sheet": "未命名资源表单", "sheet.untitled": "未命名", "sheet.delete_warning_msg": "您确定要删除此表单吗?此操作无法撤销。", - "sheet.add_sheet_by": "资源表单由", + "sheet.add_sheet_by": "资源表单由 {{owerName}}", "sheet.sheet_public_request": "要将您的资源表单公开吗?", "sheet.share_msg": "您的资源表单看起来很棒!您可以通过公开分享给其他 Pecha 社区成员。", "sheet.make_public": "公开", @@ -389,6 +393,7 @@ "sheet.add_all_connections": "添加所有连接", "sheet.change_source_layout": "更改资源布局/语言", "collection": "收藏", + "collection.editor.my_collection": "My Collections", "collection.about": "关于收藏", "collection.description_detail": "收藏是用户生成的表单合集,可以私下使用,分享给朋友,或在 Pecha 上公开。", "collection.add_to_collection": "添加到收藏", @@ -453,7 +458,10 @@ "add_topic": "添加主题", "create_new_topic": "创建新主题:", "enter_source_ref": "输入资源参考(例如:'Yevamot.62b.9-11' 或 'Yevamot 62b:9-11')", - "add_sub_category": "添加子类别", + "category.add_sub_category": "添加子类别", + "category.add_source": "Add a source", + "category.add_section": "Add section", + "category.reorder_section": "Reorder sources", "reorder_source": "重新排序资源", "topic.all_topics": "所有主题", "topic.reset": "重置", @@ -490,7 +498,7 @@ "sheet.view_sheet": "查看表单", "sheet.select_source": "请选择资源表单。", "sheet.new_source_sheet_name": "新资源表单名称:", - "sheet.source_sheet_by": "资源表单由", + "sheet.source_sheet_by": "资源表单由 {{ownerName}}", "sheet.created_with": "创建于", "sheet.one_person_like_this_sheet": "1 人喜欢此表单", "sheet.people_like_this.sheet": "人喜欢此表单", @@ -607,6 +615,7 @@ "sheet.view_old_sheet_experience": "查看旧表单体验", "ago": "前", "created": "创建于", + "create": "Create", "topic.topics_or_tags": "主题/标签", "topic_no_tags": "无标签", "sheet.new_category": "新类别", @@ -617,11 +626,10 @@ "connection.choose_text_to_connect": "选择要连接的文本", "coutesy_of": "由...提供", "select": "选择", - "currently_seleted": "当前选择", "note.delete_note": "删除笔记", "sheet.your_sheet": "您的表单", - "sheet.section_from": "来自的章节", - "sheet.has_been_added_to": "已添加到", + "sheet.section_from": "{{sheetTitle}} 来自的章节", + "sheet.has_been_added_to": "{{sheetTitle}} 已添加到", "sheet.message.login_before_add_source_sheet": "要将此资源添加到表单,请先登录", "dictionaries": "字典", "go_to_translation": "前往翻译", diff --git a/static/js/sefaria/localizationLanguage/combineSring.js b/static/js/sefaria/localizationLanguage/combineSring.js new file mode 100644 index 0000000000..85738858a8 --- /dev/null +++ b/static/js/sefaria/localizationLanguage/combineSring.js @@ -0,0 +1,13 @@ +import tibetanJson from "./tibetan.json"; +import chineseJson from "./chinese.json"; +import englishJson from "./english.json"; + + +// combine all languages string +const LanguagesJson = { + hebrew: {translation: tibetanJson}, + chinese:{translation: chineseJson}, + english:{translation: englishJson} +}; + +export default LanguagesJson; \ No newline at end of file diff --git a/static/js/sefaria/localizationLanguage/english.json b/static/js/sefaria/localizationLanguage/english.json index b4b59e61e8..24f2bdfa13 100644 --- a/static/js/sefaria/localizationLanguage/english.json +++ b/static/js/sefaria/localizationLanguage/english.json @@ -7,6 +7,7 @@ "email": "Email Address", "password": "Password", "pecha": "pecha", + "edit": "Edit", "connection_pannel.tool_btn.more": "More", "connection_pannel.tool_btn.less": "Less", "translations": "Translations", @@ -22,7 +23,6 @@ "calender_page.daily_learning":"Daily Learning", "mobile_apps": "Mobile Apps", "help": "Help", - "url.param.&": " & ", "on": "On", "off": "Off", "yes": "Yes", @@ -39,10 +39,14 @@ "filter_list.relevance": "Relevance", "filter_list.chronological": "Chronological", "header.notifications":"Notifications", + "header.menu": "Menu", "like":"Like", "unlike":"Unlike", + "url.param.history_title": " & {{title}}", "url.param.moderator_tools":"Moderator Tools", "url.param.with":" with ", + "url.title_descriptions": "Pecha - Buddhism in your own words", + "url.topic.descriptions": "Explore Jewish Texts by Topic - {{navigationTopicLetter}} | {{siteName}}", "copy": "Copy", "sheet.editor.view_in_editor": "View In Editor", "copied": "Copied", @@ -123,7 +127,7 @@ "ladino": "Ladino", "chinese": "Chinese", "bilingual_layout": "Bilingual Layout", - "results_for": "Results for", + "search_page.results_for": "Results for: ( {{searchedItem}} )", "results": "Results", "options": "Options", "search_texts": "Search Texts", @@ -339,7 +343,7 @@ "sheet.untitled_sourc_sheet": "Untitled Source Sheet", "sheet.untitled": "Untitled", "sheet.delete_warning_msg": "Are you sure you want to delete this sheet? There is no way to undo this action.", - "sheet.add_sheet_by": "Source Sheet by", + "sheet.add_sheet_by": "Source Sheet by {{{{ownerName}}}}", "sheet.edit": "Edit", "sheet.sheet_public_request": "Would you like to make your Source Sheet public?", "sheet.share_msg": "Your Source Sheet is looking great! You can share it with other members of the Pecha Community by making it public.", @@ -392,6 +396,7 @@ "sheet.add_all_connections":"Add All Connections", "sheet.change_source_layout":"Change Source Layout/Language", "collection": "Collections", + "collection.editor.my_collection": "My Collections", "collection.about": "About Collections", "collection.description_detail": "Collections are user generated bundles of sheets which can be used privately, shared with friends, or made public on Pecha.", "collection.add_to_collection": "Add to Collection", @@ -457,7 +462,10 @@ "add_topic":"Add Topic", "create_new_topic":"Create a new topic: ", "enter_source_ref":"Enter Source Ref (for example: 'Yevamot.62b.9-11' or 'Yevamot 62b:9-11')", - "add_sub_category":"Add sub-category", + "category.add_sub_category":"Add sub-category", + "category.add_source": "Add a source", + "category.add_section": "Add section", + "category.reorder_section": "Reorder sources", "reorder_source":"Reorder sources", "topic.all_topics":"All Topics", "topic.reset":"Reset", @@ -495,7 +503,7 @@ "sheet.view_sheet":"View sheet", "sheet.select_source":"Please select a source sheet.", "sheet.new_source_sheet_name":"New Source Sheet Name:", - "sheet.source_sheet_by":"Source Sheet by", + "sheet.source_sheet_by":"Source Sheet by {{ownerName}}", "sheet.created_with":"Created with", "sheet.one_person_like_this_sheet": "1 Person Likes This Sheet", "sheet.people_like_this.sheet": " People Like This Sheet", @@ -622,11 +630,10 @@ "connection.choose_text_to_connect":"Choose a text to connect", "coutesy_of":"Courtesy of", "select":"Select", - "currently_seleted": "Currently Selected", "note.delete_note":"Delete Note", "sheet.your_sheet":"Your Sheet", - "sheet.section_from":"Section from", - "sheet.has_been_added_to":"has been added to", + "sheet.section_from":"Section from {{sheetTitle}}", + "sheet.has_been_added_to":"has been added to {{sheetTitle}}", "sheet.message.login_before_add_source_sheet":"In order to add this source to a sheet, please", "dictionaries":"Dictionaries", "go_to_translation":"Go to translations", diff --git a/static/js/sefaria/localizationLanguage/tibetan.json b/static/js/sefaria/localizationLanguage/tibetan.json index 57454725c4..0d6ea3ace7 100644 --- a/static/js/sefaria/localizationLanguage/tibetan.json +++ b/static/js/sefaria/localizationLanguage/tibetan.json @@ -7,7 +7,8 @@ "email": "གློག་འཕྲིན།", "password": "གསང་ཚིག", "pecha": "དཔེ་ཆ་དྲ་ཆིགས།", - "connection_pannel.tool_btnmore": "འདི་ལས་མང་བ།", + "edit": "རྩོམ་སྒྲིག", + "connection_pannel.tool_btn.more": "འདི་ལས་མང་བ།", "connection_pannel.tool_btn.less": "འདི་ལས་ཉུང་བ།", "translations": "འགྱུར་མ།", "collection_list.unlisted": "ཐོ་རུ་བཀོད་མེད་པ།", @@ -21,7 +22,6 @@ "calender_page.weekly_learning":"Weekly Learning", "calender_page.daily_learning":"Daily Learning", "mobile_apps": "ཁ་པར་མཉེན་ཆས་ཁག", - "url.param.&": " | ", "on": "ཉར།", "off": "མི་ཉར།", "yes": "འགྲིག", @@ -38,10 +38,14 @@ "filter_list.relevance": "མཐུན་ཤོས།", "filter_list.chronological": "མ་ཡིག་བྱུང་དུས།", "header.notifications":"གསར་བརྡ་ཁག", + "header.menu": "Menu", "like":"དགའ།", "unlike":"མི་དགའ།", - "url.param.moderator_tools.moderator_tools":"སྟངས་འཛིན་ལག་ཆ་རྣམས།", + "url.param.history_title": " | {{title}}", + "url.param.moderator_tools":"སྟངས་འཛིན་ལག་ཆ་རྣམས།", "url.param.with":"མཉམ་དུ་", + "url.title_descriptions": "Pecha - Buddhism in your own words", + "url.topic.descriptions": "Explore Jewish Texts by Topic - {{navigationTopicLetter}} | {{siteName}}", "copy": "ངོ་བཤུ།", "view_in_editor": "རྩོམ་སྒྲིག་སྟེགས་བུའི་ནང་སྟོན།", "copied": "ངོ་བཤུ་བྱས་ཟིན།", @@ -122,7 +126,7 @@ "ladino": "ལ་དྷི་ནོའི་སྐད་ཡིག", "chinese": "རྒྱ་ཡིག", "bilingual_layout": "སྐད་གཉིས་ཤན་སྦྱར་།", - "results_for": "འདིའི་གྲུབ་འབྲས་ཁག", + "search_page.results_for": "འདིའི་གྲུབ་འབྲས་ཁག: ( {{searchedItem}} )", "results": "གྲུབ་འབྲས་རྣམས།", "options": "བདམ་གསེས།", "search_texts": "ཁ་བྱང་ལྟར་བཙལ་འབྲས་འདེམ་སྒྲུག།", @@ -337,7 +341,7 @@ "sheet.untitled_sourc_sheet": "མཚན་བྱང་མེད་པའི་མ་ཕྱིའི་ཤོག་ངོས།", "sheet.untitled": "མཚན་བྱང་མེད་པ།", "sheet.delete_warning_msg": "ཁྱེད་ཀྱིས་ཤོག་ངོས་འདི་བསུབ་རྒྱུ་གཏན་འཁེལ་ཡིན་ནམ། འདི་བསུབ་རྗེས་སླར་གསོ་བྱེད་མི་ཐུབ།", - "sheet.add_sheet_by": "ཡི་མ་ཕྱིའི་ཤོག་ངོས།", + "sheet.add_sheet_by": "{{ownerName}}ཡི་མ་ཕྱིའི་ཤོག་ངོས།", "sheet.sheet_public_request": "ཟིན་བྲིས་འདི་ཚང་མས་མཐོང་སར་སྤེལ་རྒྱུ་ཡིན་ནམ།", "sheet.share_msg": "ཁྱེད་ཀྱི་ཟིན་བྲིས་དོན་དང་ལྡན་པ་ཞིག་འདུག་པས། མི་ཚང་མས་མཐོང་སར་སྤེལ་ཏེ། དཔེ་ཆ་དྲ་བའི་ཀློག་མཁན་གཞན་དང་མཉམ་སྤྱོད་བྱས་ན་བཟང་།", "sheet.make_public": "ཡོངས་ལ་སྤེལ།", @@ -391,6 +395,7 @@ "sheet.add_all_connections":"འབྲེལ་ཡོད་ཡོངས་རྫོགས་སྣོན།", "sheet.change_source_layout":"མ་ཕྱིའི་ཁྱད་ཆོས་བསྒྱུར་བཅོས།/སྐད་ཡིག", "collection": "ཆེད་བསྒྲིགས།", + "collection.editor.my_collection": "My Collections", "collection.about": "ཆེད་བསྒྲིགས་ཁག་གི་སྐོར།", "collection.description_detail": "དཔེ་ཆ་དྲ་བའི་ཆེད་བསྒྲིགས་རྣམས་ནི་དྲ་བ་འདིའི་ཀློག་མཁན་རྣམས་ཀྱིས་བཟོས་པ་ཡིན་ལ། འདི་དག་བེད་སྤྱོད་བྱེད་སྟངས་གསུམ་ཡོད་དེ། ཁྱེད་རང་གཅིག་པུས་སྤྱོད་པ་དང་། གྲོགས་པོ་གཞན་དང་མཉམ་སྤྱོད་བྱེད་པ། ཡང་ན། ཀློག་མཁན་ཡོངས་ཀྱི་བགོ་སྐལ་དུ་ཕུལ་ཀྱང་ཆོག་པ་ཡིན།", "collection.add_to_collection": "ཟིན་བྲིས་འདི་ཆེད་བསྒྲིགས་གཞན་གྱི་ནང་སྣོན།", @@ -455,7 +460,10 @@ "add_topic":"བརྗོད་གཞི་སྣོན།", "create_new_topic":"བརྗོད་གཞི་གསར་པ་ཞིག་བཟོས།", "enter_source_ref":"དཔྱད་གཞིའི་རྒྱུ་ཆ་ཞིག་ཞོག (དཔེར་ན།: 'Yevamot.62b.9-11' ཡང་ན་ 'Yevamot 62b:9-11')", - "add_sub_category": "ནང་གསེས་ཀྱི་རིགས་དབྱེ་སྣོན།", + "category.add_sub_category": "ནང་གསེས་ཀྱི་རིགས་དབྱེ་སྣོན།", + "category.add_source": "རྒྱུ་ཆ་ཞིག་སྣོན།", + "category.add_section": "Add section", + "category.reorder_section": "ཁུངས་ཀྱི་གོ་རིམ་བསྐྱར་སྒྲིག", "reorder_source":"རྒྱུ་ཆའི་གོ་རིམ་བསྐྱར་སྒྲིག་བྱོས།", "topic.all_topics":"བརྗོད་གཞི་ཆ་ཚང་།", "topic.reset":"བསྐྱར་སྒྲིག", @@ -493,7 +501,7 @@ "sheet.view_sheet": "ཟིན་བྲིས་ཁ་ཕྱེ།", "sheet.select_source":"མ་ཕྱིའི་ཤོག་ངོས་ཤིག་འདེམ་རོགས།", "sheet.new_source_sheet_name":"མ་ཕྱིའི་ཤོག་ངོས་གསར་པའི་མིང་ནི་", - "sheet.source_sheet_by":"ཡི་མ་ཕྱིའི་ཤོག་ངོས།", + "sheet.source_sheet_by":"{{ownerName}}ཡི་མ་ཕྱིའི་ཤོག་ངོས།", "sheet.created_with":"སྤྱད་ནས་བཟོས་པ།", "sheet.one_person_like_this_sheet": "ཤོག་ངོས་འདི་ལ་མི་གཅིག་གིས་དགའ་རྟགས་བཀོད་འདུག", "sheet.people_like_this.sheet": "མི་རྣམས་ཤོག་ངོས་འདི་ལ་དགའ་རྒྱུ་རེད།", @@ -609,6 +617,7 @@ "sheet.view_old_sheet_experience":"རས་རྙིང་ནང་གི་ལྟ་སྣང་།", "ago":"དུས་ན།", "created":"Created", + "create": "Create", "topic.topics_or_tags":" བརྗོད་བྱ།/ཐ་སྙད།", "topic_no_tags":"ཐ་སྙད་མེད།", "sheet.new_category": "སྡེ་ཚན་གསར་པ།", @@ -619,11 +628,10 @@ "connection.choose_text_to_connect":"མཚམས་སྦྱོར་གྱི་དཔེ་ཆ་ཞིག་འདེམས།", "coutesy_of":"གུས་པར་སྨྲ་བ།", "select": "འདེམས་སྒྲུག", - "currently_seleted": "ད་ལྟ་འདེམས་སྒྲུག་བྱས་ཡོད་", "note.delete_note":"མཆན་འགོད།", "sheet.your_sheet":"ཁྱེད་ཀྱི་ཤོག་ངོས་།", - "sheet.section_from":"སྡེ་ཚན་གྱི།", - "sheet.has_been_added_to":"ནང་བསྣན་པ་རེད།", + "sheet.section_from":"{{sheetTitle}} སྡེ་ཚན་གྱི།", + "sheet.has_been_added_to":"{{sheetTitle}} ནང་བསྣན་པ་རེད།", "sheet.message.login_before_add_source_sheet":"ཤོག་ལྷེ་གཅིག་ལ་ཁུངས་འདི་ཁ་སྣོན་བྱེད་ཆེད།", "dictionaries":"ཚིག་མཛོད།", "go_to_translation":"བསྒྱུར་དུ་གཞུག་གོ། །", diff --git a/static/js/sefaria/sefaria.js b/static/js/sefaria/sefaria.js index 65dfb1d384..032d484def 100644 --- a/static/js/sefaria/sefaria.js +++ b/static/js/sefaria/sefaria.js @@ -10,6 +10,7 @@ import Hebrew from './hebrew'; import Util from './util'; import $ from './sefariaJquery'; import Cookies from 'js-cookie'; +import i18n from "i18next"; let Sefaria = Sefaria || { @@ -2986,8 +2987,13 @@ _media: {}, return inputStr; } }, - _: function(inputStr, context=null){ - return Sefaria.translation(Sefaria.interfaceLang, inputStr, context); + _: function(inputStr, placeholder=null){ + const { t } = i18n; + if(placeholder){ + return t(inputStr, placeholder) + } else { + return t(inputStr) + } // if(Sefaria.interfaceLang !== "english"){ // return Sefaria.translation(Sefaria.interfaceLang, inputStr, context); // } else { From 8561cc658e267be19a2129ad18c11916c5c31fea Mon Sep 17 00:00:00 2001 From: lungsangg Date: Fri, 13 Sep 2024 14:40:56 +0530 Subject: [PATCH 4/4] in_progress_label_disable_for_a_while --- static/js/ReaderPanel.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/ReaderPanel.jsx b/static/js/ReaderPanel.jsx index 1e7f84c8b4..b653868d9c 100644 --- a/static/js/ReaderPanel.jsx +++ b/static/js/ReaderPanel.jsx @@ -1310,7 +1310,7 @@ class ReaderControls extends Component { return null } else { return ( -
{Sefaria._("text.versions.in_progress")}
+
{Sefaria._("")}
) } }