Remove hardcoded servers from internationalisation (#11026)

This commit is contained in:
Michael Telatynski 2023-06-05 14:53:11 +01:00 committed by GitHub
parent 89c814d385
commit df4bc1ed2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 10 deletions

View file

@ -26,6 +26,7 @@ import {
CallParty, CallParty,
CallState, CallState,
CallType, CallType,
FALLBACK_ICE_SERVER,
MatrixCall, MatrixCall,
} from "matrix-js-sdk/src/webrtc/call"; } from "matrix-js-sdk/src/webrtc/call";
import { logger } from "matrix-js-sdk/src/logger"; import { logger } from "matrix-js-sdk/src/logger";
@ -825,7 +826,6 @@ export default class LegacyCallHandler extends EventEmitter {
private showICEFallbackPrompt(): void { private showICEFallbackPrompt(): void {
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
const code = (sub: string): JSX.Element => <code>{sub}</code>;
Modal.createDialog( Modal.createDialog(
QuestionDialog, QuestionDialog,
{ {
@ -838,22 +838,24 @@ export default class LegacyCallHandler extends EventEmitter {
"(<code>%(homeserverDomain)s</code>) to configure a TURN server in " + "(<code>%(homeserverDomain)s</code>) to configure a TURN server in " +
"order for calls to work reliably.", "order for calls to work reliably.",
{ homeserverDomain: cli.getDomain() }, { homeserverDomain: cli.getDomain() },
{ code }, { code: (sub: string) => <code>{sub}</code> },
)} )}
</p> </p>
<p> <p>
{_t( {_t(
"Alternatively, you can try to use the public server at " + "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 " + "it will share your IP address with that server. You can also manage " +
"this in Settings.", "this in Settings.",
undefined, undefined,
{ code }, { server: () => <code>{new URL(FALLBACK_ICE_SERVER).pathname}</code> },
)} )}
</p> </p>
</div> </div>
), ),
button: _t("Try using turn.matrix.org"), button: _t("Try using %(server)s", {
server: new URL(FALLBACK_ICE_SERVER).pathname,
}),
cancelButton: _t("OK"), cancelButton: _t("OK"),
onFinished: (allow) => { onFinished: (allow) => {
SettingsStore.setValue("fallbackICEServerAllowed", null, SettingLevel.DEVICE, allow); SettingsStore.setValue("fallbackICEServerAllowed", null, SettingLevel.DEVICE, allow);

View file

@ -17,6 +17,7 @@ limitations under the License.
import React, { ReactNode } from "react"; import React, { ReactNode } from "react";
import { logger } from "matrix-js-sdk/src/logger"; import { logger } from "matrix-js-sdk/src/logger";
import { FALLBACK_ICE_SERVER } from "matrix-js-sdk/src/webrtc/call";
import { _t } from "../../../../../languageHandler"; import { _t } from "../../../../../languageHandler";
import MediaDeviceHandler, { IMediaDevices, MediaDeviceKindEnum } from "../../../../../MediaDeviceHandler"; import MediaDeviceHandler, { IMediaDevices, MediaDeviceKindEnum } from "../../../../../MediaDeviceHandler";
@ -225,6 +226,9 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
/> />
<SettingsFlag <SettingsFlag
name="fallbackICEServerAllowed" name="fallbackICEServerAllowed"
label={_t("Allow fallback call assist server (%(server)s)", {
server: new URL(FALLBACK_ICE_SERVER).pathname,
})}
level={SettingLevel.DEVICE} level={SettingLevel.DEVICE}
onChange={this.changeFallbackICEServerAllowed} onChange={this.changeFallbackICEServerAllowed}
/> />

View file

@ -75,8 +75,8 @@
"The call was answered on another device.": "The call was answered on another device.", "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", "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.", "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.", "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 turn.matrix.org": "Try using turn.matrix.org", "Try using %(server)s": "Try using %(server)s",
"OK": "OK", "OK": "OK",
"Unable to access microphone": "Unable to access microphone", "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.", "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", "Show hidden events in timeline": "Show hidden events in timeline",
"Low bandwidth mode": "Low bandwidth mode", "Low bandwidth mode": "Low bandwidth mode",
"Requires compatible homeserver.": "Requires compatible homeserver.", "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.", "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", "Show previews/thumbnails for images": "Show previews/thumbnails for images",
"Enable message search in encrypted rooms": "Enable message search in encrypted rooms", "Enable message search in encrypted rooms": "Enable message search in encrypted rooms",
@ -1668,6 +1667,7 @@
"Video settings": "Video settings", "Video settings": "Video settings",
"Voice processing": "Voice processing", "Voice processing": "Voice processing",
"Connection": "Connection", "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", "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.", "<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", "Upgrade this space to the recommended room version": "Upgrade this space to the recommended room version",

View file

@ -880,9 +880,8 @@ export const SETTINGS: { [setting: string]: ISetting } = {
}, },
"fallbackICEServerAllowed": { "fallbackICEServerAllowed": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
displayName: _td("Allow fallback call assist server (turn.matrix.org)"),
description: _td( 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". // This is a tri-state value, where `null` means "prompt the user".
default: null, default: null,