Browse Source

Localization of strings in PLAP dialog

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/560/head
Selva Nair 2 years ago
parent
commit
fa0f55e5a3
  1. 4
      openvpn-gui-res.h
  2. 15
      plap/plap_connection.c
  3. 4
      plap/ui_glue.c
  4. 6
      res/openvpn-gui-res-en.rc

4
openvpn-gui-res.h

@ -254,6 +254,10 @@
#define IDS_NFO_BYTECOUNT 1258 #define IDS_NFO_BYTECOUNT 1258
#define IDS_NFO_STATE_ONHOLD 1259 #define IDS_NFO_STATE_ONHOLD 1259
#define IDS_ERR_PARSE_MGMT_OPTION 1260 #define IDS_ERR_PARSE_MGMT_OPTION 1260
#define IDS_NFO_STATE_CANCELLING 1261
#define IDS_NFO_STATE_RETRYING 1262
#define IDS_NFO_STATE_DISCONNECTING 1263
#define IDS_NFO_CONN_CANCELLED 1264
/* Program Startup Related */ /* Program Startup Related */
#define IDS_ERR_OPEN_DEBUG_FILE 1301 #define IDS_ERR_OPEN_DEBUG_FILE 1301

15
plap/plap_connection.c

@ -29,6 +29,7 @@
#include <assert.h> #include <assert.h>
#include "resource.h" #include "resource.h"
#include "localization.h" #include "localization.h"
#include "openvpn-gui-res.h"
/* A "class" that implements IConnectableCredentialProviderCredential */ /* A "class" that implements IConnectableCredentialProviderCredential */
@ -487,9 +488,9 @@ GetSerialization(ICCPC *this, CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE *re
if (text && icon) if (text && icon)
{ {
if (oc->connect_cancelled) if (oc->connect_cancelled)
hr = SHStrDupW(L"Connection cancelled by user", text); hr = SHStrDupW(LoadLocalizedString(IDS_NFO_CONN_CANCELLED), text);
else if (text) else
hr = SHStrDupW(L"Connection failed to complete", text); hr = SHStrDupW(LoadLocalizedString(IDS_NFO_CONN_FAILED, oc->display_name), text);
*icon = CPSI_ERROR; *icon = CPSI_ERROR;
} }
@ -501,7 +502,7 @@ GetSerialization(ICCPC *this, CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE *re
/* return CPGSR_RETURN_NO_CREDENTIAL_FINISHED leads to a loop! */ /* return CPGSR_RETURN_NO_CREDENTIAL_FINISHED leads to a loop! */
if (text && icon) if (text && icon)
{ {
hr = SHStrDupW(L"Connected..", text); hr = SHStrDupW(LoadLocalizedString(IDS_NFO_OVPN_STATE_CONNECTED), text);
*icon = CPSI_SUCCESS; *icon = CPSI_SUCCESS;
} }
} }
@ -620,7 +621,7 @@ again:
if (res == IDRETRY && !ISCONNECTED(oc->c)) if (res == IDRETRY && !ISCONNECTED(oc->c))
{ {
wcsncpy_s(status, _countof(status), L"Current State: Retrying", _TRUNCATE); LoadLocalizedStringBuf(status, _countof(status), IDS_NFO_STATE_RETRYING);
NotifyEvents(oc, status); NotifyEvents(oc, status);
DisconnectHelper(oc->c); DisconnectHelper(oc->c);
@ -628,7 +629,7 @@ again:
} }
else if (res == IDCANCEL && !ISCONNECTED(oc->c) && !ISDISCONNECTED(oc->c)) else if (res == IDCANCEL && !ISCONNECTED(oc->c) && !ISDISCONNECTED(oc->c))
{ {
wcsncpy_s(status, _countof(status), L"Current State: Cancelling", _TRUNCATE); LoadLocalizedStringBuf(status, _countof(status), IDS_NFO_STATE_CANCELLING);
NotifyEvents(oc, status); NotifyEvents(oc, status);
DisconnectHelper(oc->c); DisconnectHelper(oc->c);
@ -654,7 +655,7 @@ Disconnect(ICCPC *this)
OpenVPNConnection *oc = (OpenVPNConnection *) this; OpenVPNConnection *oc = (OpenVPNConnection *) this;
dmsg (L"profile <%ls>", oc->display_name); dmsg (L"profile <%ls>", oc->display_name);
NotifyEvents(oc, L"Disconnecting"); NotifyEvents(oc, LoadLocalizedString(IDS_NFO_STATE_DISCONNECTING));
DisconnectHelper(oc->c); DisconnectHelper(oc->c);

4
plap/ui_glue.c

@ -510,7 +510,7 @@ RunProgressDialog(connection_t *c, PFTASKDIALOGCALLBACK cb_fn, LONG_PTR cb_data)
flags |= TDF_RTL_LAYOUT; flags |= TDF_RTL_LAYOUT;
} }
_sntprintf_0(main_text, L"%ls %ls", LoadLocalizedString(IDS_MENU_CONNECT), c->config_name); _sntprintf_0(main_text, L"%ls %ls", LoadLocalizedString(IDS_MENU_CONNECT), c->config_name);
LoadLocalizedStringBuf(details_btn_text, _countof(main_text), IDS_MENU_STATUS); LoadLocalizedStringBuf(details_btn_text, _countof(details_btn_text), IDS_MENU_STATUS);
const TASKDIALOG_BUTTON extra_buttons[] = { const TASKDIALOG_BUTTON extra_buttons[] = {
{status_menu_id, details_btn_text}, {status_menu_id, details_btn_text},
@ -527,7 +527,7 @@ RunProgressDialog(connection_t *c, PFTASKDIALOGCALLBACK cb_fn, LONG_PTR cb_data)
.dwCommonButtons = TDCBF_CANCEL_BUTTON|TDCBF_RETRY_BUTTON, .dwCommonButtons = TDCBF_CANCEL_BUTTON|TDCBF_RETRY_BUTTON,
.pszWindowTitle = L""PACKAGE_NAME" PLAP", .pszWindowTitle = L""PACKAGE_NAME" PLAP",
.pszMainInstruction = main_text, .pszMainInstruction = main_text,
.pszContent = L"Starting", /* replaced on create */ .pszContent = L"Starting", /* updated in progress callback */
.pfCallback = cb_fn, .pfCallback = cb_fn,
.lpCallbackData = cb_data, .lpCallbackData = cb_data,
}; };

6
res/openvpn-gui-res-en.rc

@ -583,6 +583,12 @@ once as Administrator to update the registry."
IDS_CERT_ISSUER "Issued by" IDS_CERT_ISSUER "Issued by"
IDS_CERT_NOTAFTER "Valid until" IDS_CERT_NOTAFTER "Valid until"
/* PLAP related */
IDS_NFO_STATE_RETRYING "Retrying"
IDS_NFO_STATE_CANCELLING "Cancelling"
IDS_NFO_STATE_DISCONNECTING "Disconnecting"
IDS_NFO_CONN_CANCELLED "Connection cancelled by user"
/* openvpn daemon state names -- these are shown on progress dialog in PLAP */ /* openvpn daemon state names -- these are shown on progress dialog in PLAP */
IDS_NFO_OVPN_STATE_INITIAL "Initializing" IDS_NFO_OVPN_STATE_INITIAL "Initializing"
IDS_NFO_OVPN_STATE_CONNECTING "Connecting" IDS_NFO_OVPN_STATE_CONNECTING "Connecting"

Loading…
Cancel
Save