diff options
Diffstat (limited to 'gui/src/shared/notifications')
| -rw-r--r-- | gui/src/shared/notifications/block-when-disconnected.ts | 12 | ||||
| -rw-r--r-- | gui/src/shared/notifications/error.ts | 32 |
2 files changed, 32 insertions, 12 deletions
diff --git a/gui/src/shared/notifications/block-when-disconnected.ts b/gui/src/shared/notifications/block-when-disconnected.ts index 6dcc3cc749..4cc30c0de0 100644 --- a/gui/src/shared/notifications/block-when-disconnected.ts +++ b/gui/src/shared/notifications/block-when-disconnected.ts @@ -1,3 +1,6 @@ +import { sprintf } from 'sprintf-js'; + +import { strings } from '../../config.json'; import { messages } from '../../shared/gettext'; import { TunnelState } from '../daemon-rpc-types'; import { InAppNotification, InAppNotificationProvider } from './notification'; @@ -22,9 +25,12 @@ export class BlockWhenDisconnectedNotificationProvider implements InAppNotificat public getInAppNotification(): InAppNotification { let subtitle = messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.'); if (this.context.hasExcludedApps) { - subtitle = `${subtitle} ${messages.pgettext( - 'notifications', - 'The apps excluded with split tunneling might not work properly right now.', + subtitle = `${subtitle} ${sprintf( + messages.pgettext( + 'notifications', + 'The apps excluded with %(splitTunneling)s might not work properly right now.', + ), + { splitTunneling: strings.splitTunneling.toLowerCase() }, )}`; } diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts index fa654b8291..dddac8bed9 100644 --- a/gui/src/shared/notifications/error.ts +++ b/gui/src/shared/notifications/error.ts @@ -1,3 +1,6 @@ +import { sprintf } from 'sprintf-js'; + +import { strings } from '../../config.json'; import { hasExpired } from '../account-expiry'; import { AuthFailureKind, parseAuthFailure } from '../auth-failure'; import { IErrorState, TunnelParameterError, TunnelState } from '../daemon-rpc-types'; @@ -24,9 +27,12 @@ export class ErrorNotificationProvider if (this.context.tunnelState.state === 'error') { let message = getMessage(this.context.tunnelState.details, this.context.accountExpiry); if (!this.context.tunnelState.details.blockFailure && this.context.hasExcludedApps) { - message = `${message} ${messages.pgettext( - 'notifications', - 'The apps excluded with split tunneling might not work properly right now.', + message = `${message} ${sprintf( + messages.pgettext( + 'notifications', + 'The apps excluded with %(splitTunneling)s might not work properly right now.', + ), + { splitTunneling: strings.splitTunneling.toLowerCase() }, )}`; } @@ -43,9 +49,12 @@ export class ErrorNotificationProvider if (this.context.tunnelState.state === 'error') { let subtitle = getMessage(this.context.tunnelState.details, this.context.accountExpiry); if (!this.context.tunnelState.details.blockFailure && this.context.hasExcludedApps) { - subtitle = `${subtitle} ${messages.pgettext( - 'notifications', - 'The apps excluded with split tunneling might not work properly right now.', + subtitle = `${subtitle} ${sprintf( + messages.pgettext( + 'notifications', + 'The apps excluded with %(splitTunneling)s might not work properly right now.', + ), + { splitTunneling: strings.splitTunneling.toLowerCase() }, )}`; } @@ -157,9 +166,14 @@ function getTunnelParameterMessage(err: TunnelParameterError): string { 'No servers in your selected location match your settings.', ); case 'no_wireguard_key': - return messages.pgettext( - 'notifications', - 'Valid WireGuard key is missing. Manage keys under Advanced settings.', + return sprintf( + // TRANSLATORS: Available placeholders: + // TRANSLATORS: %(wireguard)s - will be replaced with "WireGuard" + messages.pgettext( + 'notifications', + 'Valid %(wireguard)s key is missing. Manage keys under Advanced settings.', + ), + { wireguard: strings.wireguard }, ); case 'custom_tunnel_host_resultion_error': return messages.pgettext( |
