mirror of https://github.com/OpenVPN/openvpn-gui
				
				
				
			Enable localization of openvpn daemon state names
These strings are displayed in the PLAP progress window. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/560/head
							parent
							
								
									e5ef5038ce
								
							
						
					
					
						commit
						3427aeb88f
					
				| 
						 | 
				
			
			@ -380,6 +380,22 @@
 | 
			
		|||
#define IDS_CERT_ISSUER                 2163
 | 
			
		||||
#define IDS_CERT_NOTAFTER               2164
 | 
			
		||||
 | 
			
		||||
/* openvpn daemon state descriptions */
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_INITIAL      2200
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_CONNECTING   2201
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_ASSIGN_IP    2202
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_ADD_ROUTES   2203
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_CONNECTED    2204
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_RECONNECTING 2205
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_EXITING      2206
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_WAIT         2207
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_AUTH         2208
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_GET_CONFIG   2209
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_RESOLVE      2210
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_TCP_CONNECT  2211
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_AUTH_PENDING 2212
 | 
			
		||||
#define IDS_NFO_OVPN_STATE_UNKNOWN      2220
 | 
			
		||||
 | 
			
		||||
/* Timer IDs */
 | 
			
		||||
#define IDT_STOP_TIMER                  2500  /* Timer used to trigger force termination */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								openvpn.c
								
								
								
								
							
							
						
						
									
										21
									
								
								openvpn.c
								
								
								
								
							| 
						 | 
				
			
			@ -2789,3 +2789,24 @@ ResetSavePasswords(connection_t *c)
 | 
			
		|||
    c->flags &= ~(FLAG_SAVE_KEY_PASS | FLAG_SAVE_AUTH_PASS);
 | 
			
		||||
    SetMenuStatus(c, c->state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* keep this array in same order as corresponding resource ids -- IDS_NFO_OVPN_STATE_xxxxx */
 | 
			
		||||
static const char *daemon_states[] = {"INITIAL", "CONNECTING", "ASSIGN_IP",
 | 
			
		||||
    "ADD_ROUTES", "CONNECTED", "RECONNECTING", "EXITING", "WAIT",
 | 
			
		||||
    "AUTH", "GET_CONFIG", "RESOLVE", "TCP_CONNECT", "AUTH_PENDING", NULL};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Given an OpenVPN state as reported by the management interface
 | 
			
		||||
 * return the correspnding resource id for translated string.
 | 
			
		||||
 * Returns IDS_NFO_OVPN_STATE_UNKNOWN if no match found.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
daemon_state_resid(const char *state)
 | 
			
		||||
{
 | 
			
		||||
    int i = 0;
 | 
			
		||||
    while (daemon_states[i] && strcmp(daemon_states[i], state))
 | 
			
		||||
    {
 | 
			
		||||
	i++;
 | 
			
		||||
    }
 | 
			
		||||
    return daemon_states[i] ? IDS_NFO_OVPN_STATE_INITIAL + i : IDS_NFO_OVPN_STATE_UNKNOWN;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,4 +89,10 @@ parse_dynamic_cr(const char* str, auth_param_t* param);
 | 
			
		|||
void
 | 
			
		||||
free_auth_param(auth_param_t* param);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Given an OpenVPN state as reported by the management interface
 | 
			
		||||
 * return the correspnding resource id for translation.
 | 
			
		||||
 */
 | 
			
		||||
int daemon_state_resid(const char *name);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -353,7 +353,7 @@ GetConnectionStatusText(connection_t *c, wchar_t *status, DWORD len)
 | 
			
		|||
        }
 | 
			
		||||
        else if (*c->daemon_state) /* this is more fine-grained and thus preferred */
 | 
			
		||||
        {
 | 
			
		||||
            __sntprintf_0(status, len, L"%hs", c->daemon_state);
 | 
			
		||||
            LoadLocalizedStringBuf(status, len, daemon_state_resid(c->daemon_state));
 | 
			
		||||
        }
 | 
			
		||||
        else if (*status_text)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -582,4 +582,21 @@ once as Administrator to update the registry."
 | 
			
		|||
    IDS_CERT_DISPLAYNAME "Issued to"
 | 
			
		||||
    IDS_CERT_ISSUER "Issued by"
 | 
			
		||||
    IDS_CERT_NOTAFTER "Valid until"
 | 
			
		||||
 | 
			
		||||
    /* openvpn daemon state names -- these are shown on progress dialog in PLAP */
 | 
			
		||||
    IDS_NFO_OVPN_STATE_INITIAL      "Initializing"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_CONNECTING   "Connecting"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_ASSIGN_IP    "Assigning IP address"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_ADD_ROUTES   "Adding routes"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_CONNECTED    "Connected"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_RECONNECTING "Reconnecting"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_EXITING      "Exiting"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_WAIT         "Waiting"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_AUTH         "Authenticating"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_GET_CONFIG   "Pulling configuration from server"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_RESOLVE      "Resolving remote host"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_TCP_CONNECT  "Establishing TCP connection"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_AUTH_PENDING "Authentication pending"
 | 
			
		||||
    IDS_NFO_OVPN_STATE_UNKNOWN      "?"
 | 
			
		||||
 | 
			
		||||
END
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue