Skip to content

Commit

Permalink
Add translation for server error "You are not invited to this room" (#…
Browse files Browse the repository at this point in the history
…515)

* Add translation for server error "You are not invited to this room"

* Add patch

* Change translation for title and subtitle
  • Loading branch information
aulamber authored Apr 3, 2023
1 parent 20194de commit a7cb6b9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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..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 {
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("Access possible only by invitation of a member of the room.");
+ }
+ /* end :TCHAP: */
+
if (err.name === "ConnectionError") {
description = _t("There was an error joining.");
} else if (err.errcode === "M_INCOMPATIBLE_ROOM_VERSION") {
7 changes: 7 additions & 0 deletions patches/patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,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"
]
}
}
8 changes: 8 additions & 0 deletions src/i18n/strings/tchap_translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -814,5 +814,13 @@
"Generate a new code": {
"fr": "Générer un nouveau code",
"en": "Generate a new code"
},
"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."
}
}

0 comments on commit a7cb6b9

Please sign in to comment.