From 10a917edcf4d4a610fd091589fa54bb5a7ccef48 Mon Sep 17 00:00:00 2001 From: Audrey Lambert Date: Fri, 31 Mar 2023 11:34:55 +0200 Subject: [PATCH 1/3] Add translation for server error "You are not invited to this room" --- patches/patches.json | 7 +++++++ src/i18n/strings/tchap_translations.json | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/patches/patches.json b/patches/patches.json index daef693c66..0987184be9 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -231,5 +231,12 @@ "src/stores/widgets/WidgetLayoutStore.ts", "src/utils/device/clientInformation.ts" ] + }, + "add-translations-for-server-errors": { + "github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/485", + "package": "matrix-react-sdk", + "files": [ + "src/stores/RoomViewStore.tsx" + ] } } \ No newline at end of file diff --git a/src/i18n/strings/tchap_translations.json b/src/i18n/strings/tchap_translations.json index 4398f48dfc..9fd0349579 100644 --- a/src/i18n/strings/tchap_translations.json +++ b/src/i18n/strings/tchap_translations.json @@ -810,5 +810,9 @@ "Generate a new code": { "fr": "Générer un nouveau code", "en": "Generate a new code" + }, + "You have not been invited to this room.": { + "fr": "Vous n'avez pas été pas invité dans ce salon.", + "en": "You have not been invited to this room." } } From d43a0f4bb7c6f9e642c0e25c0c40ab94d8d0dce5 Mon Sep 17 00:00:00 2001 From: Audrey Lambert Date: Fri, 31 Mar 2023 15:16:48 +0200 Subject: [PATCH 2/3] Add patch --- .../matrix-react-sdk+3.68.0.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch diff --git a/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch b/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch new file mode 100644 index 0000000000..751ae2e2ad --- /dev/null +++ b/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch @@ -0,0 +1,17 @@ +diff --git a/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx b/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx +index 47bc9b9..1c1d4d6 100644 +--- a/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx ++++ b/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx +@@ -581,6 +581,12 @@ export class RoomViewStore extends EventEmitter { + let description: ReactNode = err.message ? err.message : JSON.stringify(err); + logger.log("Failed to join room:", description); + ++ /* :TCHAP: add this for a translation */ ++ if (typeof description === 'string' && description.includes('You are not invited to this room')) { ++ description = _t("You have not been invited to this room."); ++ } ++ /* end :TCHAP: */ ++ + if (err.name === "ConnectionError") { + description = _t("There was an error joining."); + } else if (err.errcode === "M_INCOMPATIBLE_ROOM_VERSION") { From 492aa115e6aa708ac3f8cc63c68547af8a00caa7 Mon Sep 17 00:00:00 2001 From: Audrey Lambert Date: Mon, 3 Apr 2023 11:09:27 +0200 Subject: [PATCH 3/3] Change translation for title and subtitle --- .../matrix-react-sdk+3.68.0.patch | 4 ++-- src/i18n/strings/tchap_translations.json | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch b/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch index 751ae2e2ad..f36e1feecb 100644 --- a/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch +++ b/patches/add-translations-for-server-errors/matrix-react-sdk+3.68.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx b/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx -index 47bc9b9..1c1d4d6 100644 +index 47bc9b9..05902fd 100644 --- a/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx +++ b/node_modules/matrix-react-sdk/src/stores/RoomViewStore.tsx @@ -581,6 +581,12 @@ export class RoomViewStore extends EventEmitter { @@ -8,7 +8,7 @@ index 47bc9b9..1c1d4d6 100644 + /* :TCHAP: add this for a translation */ + if (typeof description === 'string' && description.includes('You are not invited to this room')) { -+ description = _t("You have not been invited to this room."); ++ description = _t("Access possible only by invitation of a member of the room."); + } + /* end :TCHAP: */ + diff --git a/src/i18n/strings/tchap_translations.json b/src/i18n/strings/tchap_translations.json index 8737e4e989..3d73b405e2 100644 --- a/src/i18n/strings/tchap_translations.json +++ b/src/i18n/strings/tchap_translations.json @@ -815,8 +815,12 @@ "fr": "Générer un nouveau code", "en": "Generate a new code" }, - "You have not been invited to this room.": { - "fr": "Vous n'avez pas été pas invité dans ce salon.", - "en": "You have not been invited to this room." + "Failed to join": { + "fr": "Impossible de rejoindre ce salon", + "en": "Failed to join this room." + }, + "Access possible only by invitation of a member of the room.": { + "fr": "Accès possible uniquement sur invitation d'un membre du salon.", + "en": "Access possible only by invitation of a member of the room." } }