Browse Source

wpa_gui: Make Status strings visible to linguist

Linguist cannot see the strings coming from wpa_supplicant, so create
a function that translates these to tr() strings inside wpa_gui
source code.
Stefan Oswald 15 years ago
parent
commit
0d76b1ab5f
2 changed files with 27 additions and 1 deletions
  1. 26 1
      wpa_supplicant/wpa_gui-qt4/wpagui.cpp
  2. 1 0
      wpa_supplicant/wpa_gui-qt4/wpagui.h

+ 26 - 1
wpa_supplicant/wpa_gui-qt4/wpagui.cpp

@@ -460,6 +460,31 @@ int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen)
 }
 
 
+QString WpaGui::wpaStateTranslate(char *state)
+{
+	if (!strcmp(state, "DISCONNECTED"))
+		return tr("Disconnected");
+	else if (!strcmp(state, "INACTIVE"))
+		return tr("Inactive");
+	else if (!strcmp(state, "SCANNING"))
+		return tr("Scanning");
+	else if (!strcmp(state, "AUTHENTICATING"))
+		return tr("Authenticating");
+	else if (!strcmp(state, "ASSOCIATING"))
+		return tr("Associating");
+	else if (!strcmp(state, "ASSOCIATED"))
+		return tr("Associated");
+	else if (!strcmp(state, "4WAY_HANDSHAKE"))
+		return tr("4-Way Handshake");
+	else if (!strcmp(state, "GROUP_HANDSHAKE"))
+		return tr("Group Handshake");
+	else if (!strcmp(state, "COMPLETED"))
+		return tr("Completed");
+	else
+		return tr("Unknown");
+}
+
+
 void WpaGui::updateStatus()
 {
 	char buf[2048], *start, *end, *pos;
@@ -528,7 +553,7 @@ void WpaGui::updateStatus()
 				textIpAddress->setText(pos);
 			} else if (strcmp(start, "wpa_state") == 0) {
 				status_updated = true;
-				textStatus->setText(pos);
+				textStatus->setText(wpaStateTranslate(pos));
 			} else if (strcmp(start, "key_mgmt") == 0) {
 				auth_updated = true;
 				textAuthentication->setText(pos);

+ 1 - 0
wpa_supplicant/wpa_gui-qt4/wpagui.h

@@ -118,6 +118,7 @@ private:
 	QAction *quitAction;
 	QMenu *tray_menu;
 	QSystemTrayIcon *tray_icon;
+	QString wpaStateTranslate(char *state);
 	void createTrayIcon(bool);
 	bool ackTrayIcon;
 	bool startInTray;