From 7cf5ad065c1fe7d920ad8440814379abcd0b6933 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 1 Jun 2023 14:28:01 +0100
Subject: [PATCH] Remove hardcoded servers from internationalisation
---
src/LegacyCallHandler.tsx | 12 +++++++-----
.../settings/tabs/user/VoiceUserSettingsTab.tsx | 4 ++++
src/i18n/strings/en_EN.json | 6 +++---
src/settings/Settings.tsx | 3 +--
4 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/LegacyCallHandler.tsx b/src/LegacyCallHandler.tsx
index 3dc7fcc4835..a8b464df43b 100644
--- a/src/LegacyCallHandler.tsx
+++ b/src/LegacyCallHandler.tsx
@@ -26,6 +26,7 @@ import {
CallParty,
CallState,
CallType,
+ FALLBACK_ICE_SERVER,
MatrixCall,
} from "matrix-js-sdk/src/webrtc/call";
import { logger } from "matrix-js-sdk/src/logger";
@@ -825,7 +826,6 @@ export default class LegacyCallHandler extends EventEmitter {
private showICEFallbackPrompt(): void {
const cli = MatrixClientPeg.get();
- const code = (sub: string): JSX.Element => {sub}
;
Modal.createDialog(
QuestionDialog,
{
@@ -838,22 +838,24 @@ export default class LegacyCallHandler extends EventEmitter {
"(%(homeserverDomain)s
) to configure a TURN server in " +
"order for calls to work reliably.",
{ homeserverDomain: cli.getDomain() },
- { code },
+ { code: (sub: string) => {sub}
},
)}
{_t(
"Alternatively, you can try to use the public server at " +
- "turn.matrix.org
, but this will not be as reliable, and " +
+ ", but this will not be as reliable, and " +
"it will share your IP address with that server. You can also manage " +
"this in Settings.",
undefined,
- { code },
+ { server: () => {new URL(FALLBACK_ICE_SERVER).pathname}
},
)}
),
- button: _t("Try using turn.matrix.org"),
+ button: _t("Try using %(server)s", {
+ server: new URL(FALLBACK_ICE_SERVER).pathname,
+ }),
cancelButton: _t("OK"),
onFinished: (allow) => {
SettingsStore.setValue("fallbackICEServerAllowed", null, SettingLevel.DEVICE, allow);
diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx
index f70fdee33aa..b9ff171c4c8 100644
--- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx
+++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx
@@ -17,6 +17,7 @@ limitations under the License.
import React, { ReactNode } from "react";
import { logger } from "matrix-js-sdk/src/logger";
+import { FALLBACK_ICE_SERVER } from "matrix-js-sdk/src/webrtc/call";
import { _t } from "../../../../../languageHandler";
import MediaDeviceHandler, { IMediaDevices, MediaDeviceKindEnum } from "../../../../../MediaDeviceHandler";
@@ -225,6 +226,9 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
/>
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index f4e329696e0..ef4ca5c9cfb 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -75,8 +75,8 @@
"The call was answered on another device.": "The call was answered on another device.",
"Call failed due to misconfigured server": "Call failed due to misconfigured server",
"Please ask the administrator of your homeserver (%(homeserverDomain)s
) to configure a TURN server in order for calls to work reliably.": "Please ask the administrator of your homeserver (%(homeserverDomain)s
) to configure a TURN server in order for calls to work reliably.",
- "Alternatively, you can try to use the public server at turn.matrix.org
, but this will not be as reliable, and it will share your IP address with that server. You can also manage this in Settings.": "Alternatively, you can try to use the public server at turn.matrix.org
, but this will not be as reliable, and it will share your IP address with that server. You can also manage this in Settings.",
- "Try using turn.matrix.org": "Try using turn.matrix.org",
+ "Alternatively, you can try to use the public server at , but this will not be as reliable, and it will share your IP address with that server. You can also manage this in Settings.": "Alternatively, you can try to use the public server at , but this will not be as reliable, and it will share your IP address with that server. You can also manage this in Settings.",
+ "Try using %(server)s": "Try using %(server)s",
"OK": "OK",
"Unable to access microphone": "Unable to access microphone",
"Call failed because microphone could not be accessed. Check that a microphone is plugged in and set up correctly.": "Call failed because microphone could not be accessed. Check that a microphone is plugged in and set up correctly.",
@@ -1046,7 +1046,6 @@
"Show hidden events in timeline": "Show hidden events in timeline",
"Low bandwidth mode": "Low bandwidth mode",
"Requires compatible homeserver.": "Requires compatible homeserver.",
- "Allow fallback call assist server (turn.matrix.org)": "Allow fallback call assist server (turn.matrix.org)",
"Only applies if your homeserver does not offer one. Your IP address would be shared during a call.": "Only applies if your homeserver does not offer one. Your IP address would be shared during a call.",
"Show previews/thumbnails for images": "Show previews/thumbnails for images",
"Enable message search in encrypted rooms": "Enable message search in encrypted rooms",
@@ -1668,6 +1667,7 @@
"Video settings": "Video settings",
"Voice processing": "Voice processing",
"Connection": "Connection",
+ "Allow fallback call assist server (%(server)s)": "Allow fallback call assist server (%(server)s)",
"This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers",
"Warning: upgrading a room will not automatically migrate room members to the new version of the room. We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.": "Warning: upgrading a room will not automatically migrate room members to the new version of the room. We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.",
"Upgrade this space to the recommended room version": "Upgrade this space to the recommended room version",
diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx
index 90cfe7e338d..74afc869264 100644
--- a/src/settings/Settings.tsx
+++ b/src/settings/Settings.tsx
@@ -880,9 +880,8 @@ export const SETTINGS: { [setting: string]: ISetting } = {
},
"fallbackICEServerAllowed": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
- displayName: _td("Allow fallback call assist server (turn.matrix.org)"),
description: _td(
- "Only applies if your homeserver does not offer one. " + "Your IP address would be shared during a call.",
+ "Only applies if your homeserver does not offer one. Your IP address would be shared during a call.",
),
// This is a tri-state value, where `null` means "prompt the user".
default: null,