Skip to content

Commit

Permalink
Remove hardcoded servers from internationalisation (#11026)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Jun 5, 2023
1 parent 89c814d commit df4bc1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/LegacyCallHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -825,7 +826,6 @@ export default class LegacyCallHandler extends EventEmitter {

private showICEFallbackPrompt(): void {
const cli = MatrixClientPeg.get();
const code = (sub: string): JSX.Element => <code>{sub}</code>;
Modal.createDialog(
QuestionDialog,
{
Expand All @@ -838,22 +838,24 @@ export default class LegacyCallHandler extends EventEmitter {
"(<code>%(homeserverDomain)s</code>) to configure a TURN server in " +
"order for calls to work reliably.",
{ homeserverDomain: cli.getDomain() },
{ code },
{ code: (sub: string) => <code>{sub}</code> },
)}
</p>
<p>
{_t(
"Alternatively, you can try to use the public server at " +
"<code>turn.matrix.org</code>, but this will not be as reliable, and " +
"<server/>, 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: () => <code>{new URL(FALLBACK_ICE_SERVER).pathname}</code> },
)}
</p>
</div>
),
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -225,6 +226,9 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
/>
<SettingsFlag
name="fallbackICEServerAllowed"
label={_t("Allow fallback call assist server (%(server)s)", {
server: new URL(FALLBACK_ICE_SERVER).pathname,
})}
level={SettingLevel.DEVICE}
onChange={this.changeFallbackICEServerAllowed}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<code>%(homeserverDomain)s</code>) to configure a TURN server in order for calls to work reliably.": "Please ask the administrator of your homeserver (<code>%(homeserverDomain)s</code>) to configure a TURN server in order for calls to work reliably.",
"Alternatively, you can try to use the public server at <code>turn.matrix.org</code>, 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 <code>turn.matrix.org</code>, 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 <server/>, 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 <server/>, 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.",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
"<b>Warning</b>: upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> 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.": "<b>Warning</b>: upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> 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",
Expand Down
3 changes: 1 addition & 2 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit df4bc1e

Please sign in to comment.