From c66891ee60a915f01a9bb226dd89b89e81339580 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Fri, 28 Feb 2014 20:45:02 +0400 Subject: [PATCH] added translations --- .gitignore | 3 + PKGBUILD | 2 +- create_archive.sh | 2 +- sources/gui/CMakeLists.txt | 2 + sources/gui/resources/resources.qrc | 6 + sources/gui/resources/translations/english.ts | 1430 +++++++++++++++++ sources/gui/resources/translations/russian.ts | 1430 +++++++++++++++++ sources/gui/src/CMakeLists.txt | 18 +- sources/gui/src/main.cpp | 30 +- sources/gui/src/settingswindow.cpp | 6 +- 10 files changed, 2921 insertions(+), 8 deletions(-) create mode 100644 sources/gui/resources/resources.qrc create mode 100644 sources/gui/resources/translations/english.ts create mode 100644 sources/gui/resources/translations/russian.ts diff --git a/.gitignore b/.gitignore index 5c50d19..0e8b34a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ build/ sources/build/ tmp/ +# translations +*.qm + diff --git a/PKGBUILD b/PKGBUILD index 48c2040..212357c 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -17,7 +17,7 @@ optdepends=('kdebase-runtime: sudo support' 'sudo: sudo support') source=("https://github.com/arcan1s/netctlplasmoid/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz") install="${pkgname}.install" -md5sums=('772eb08f63d45b4f1505e3dfc59bbb20') +md5sums=('a8893bf6d745cbcc7e54bab227cc6d5a') # flags _cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release" diff --git a/create_archive.sh b/create_archive.sh index 74d7724..65d4bdf 100755 --- a/create_archive.sh +++ b/create_archive.sh @@ -3,7 +3,7 @@ ARCHIVE="netctl-gui" SRCDIR="sources" FILES="LICENSE README.md" -IGNORELIST="CMakeLists.txt.user" +IGNORELIST="gui/resources/translations/english.qm gui/resources/translations/russian.qm" VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\ $(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\ $(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | cut -c 1) diff --git a/sources/gui/CMakeLists.txt b/sources/gui/CMakeLists.txt index e5fe024..78fb3cc 100644 --- a/sources/gui/CMakeLists.txt +++ b/sources/gui/CMakeLists.txt @@ -5,6 +5,8 @@ message (STATUS "Subproject ${SUBPROJECT}") # set directories set (SUBPROJECT_BINARY_DIR bin) set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) +set (SUBPROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources) +set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations) # executable path set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR}) diff --git a/sources/gui/resources/resources.qrc b/sources/gui/resources/resources.qrc new file mode 100644 index 0000000..e327f49 --- /dev/null +++ b/sources/gui/resources/resources.qrc @@ -0,0 +1,6 @@ + + + translations/english.qm + translations/russian.qm + + diff --git a/sources/gui/resources/translations/english.ts b/sources/gui/resources/translations/english.ts new file mode 100644 index 0000000..4b5b73b --- /dev/null +++ b/sources/gui/resources/translations/english.ts @@ -0,0 +1,1430 @@ + + + + + BridgeWidget + + Form + + + + Bridge settings + + + + Skip (R)STP and immediately activate all bridge members + + + + Skip forwarding delay + + + + + ErrorWindow + + Could not find components + + + + Does not support yet + + + + Profile name is not set + + + + Bind interfaces are not set + + + + Description is not set + + + + Ip settings are not set + + + + Configuration file does not exist + + + + Key is not set + + + + Wireless settings are not set + + + + Configuration file is not set + + + + ESSID is not set + + + + MAC address is incorrect + + + + Session ID is not set + + + + APN is not set + + + + Empty user/group name + + + + Unknown error + + + + Error + + + + Error text + + + + Ok + + + + + EthernetWidget + + Select wpa configuration file + + + + Configuration files (*.conf) + + + + Hide advanced + + + + Show advanced + + + + Form + + + + Ethernet options + + + + <html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html> + + + + Skip no carrier + + + + Set to ‘yes’ to use 802.1x authentication + + + + 802.1x authentication + + + + WPA config file + + + + Path to a wpa_supplicant configuration file + + + + Browse + + + + WPA driver + + + + wired + + + + nl80211 + + + + wext + + + + The wpa_supplicant driver to use for 802.1x authentication + + + + Timeout carrier + + + + Maximum time, in seconds, to wait for a carrier + + + + Timeout WPA + + + + Maximum time, in seconds, to wait for 802.1x authentication to succeed + + + + + GeneralWidget + + Hide advanced + + + + Show advanced + + + + Form + + + + General + + + + Description + + + + <html><head/><body><p>A description of the profile</p></body></html> + + + + Connection + + + + The connection type used by the profile + + + + Interface + + + + The name of the associated network interface + + + + Binds to interfaces + + + + Add + + + + An array of physical network interfaces that this profile needs before it can be started + + + + After + + + + An array of profile names that should be started before this profile is started + + + + Command after starting + + + + A command that is executed after a connection is established + + + + Command before stoping + + + + A command that is executed before a connection is brought down + + + + Set to ‘yes’ to force connecting even if the interface is up + + + + Force connect + + + + Debug mode + + + + + IpWidget + + Hide advanced + + + + Show advanced + + + + Form + + + + IP options + + + + IP + + + + dhcp + + + + static + + + + Address + + + + Add + + + + An array of IP addresses suffixed with ‘/<netmask>’ + + + + Gateway + + + + An IP routing gateway address + + + + IP6 + + + + dhcp-noaddr + + + + stateless + + + + Address6 + + + + An array of IPv6 addresses + + + + Gateway6 + + + + An IPv6 routing gateway address + + + + Routes + + + + An array of custom routes + + + + via + + + + An array of physical network interfaces that this profile needs before it can be started + + + + Routes6 + + + + Custom + + + + An array of argument lines to pass to ip + + + + Hostname + + + + A system hostname + + + + Timeout DAD + + + + Set to ‘yes’ to release the DHCP lease when the profile is stopped + + + + DHCP client + + + + dhcpcd + + + + dhclient + + + + The name of the preferred DHCP client + + + + dhcpcd options + + + + Additional options to be passed to the DHCP client + + + + dhclient options + + + + dhclient options (6) + + + + Timeout DHCP + + + + Maximum time, in seconds, to wait for DHCP to be successful + + + + DHCP release on stop + + + + DNS + + + + An array of DNS nameservers + + + + DNS domain + + + + A ‘domain’ line for /etc/resolv.conf + + + + DNS search + + + + A ‘search’ line for /etc/resolv.conf + + + + DNS options + + + + An array of ‘options’ lines for /etc/resolv.conf + + + + + MainWindow + + Ready + + + + Updated + + + + Error + + + + Done + + + + Stop + + + + Start + + + + Disable + + + + Enable + + + + Save profile as... + + + + Profile (*) + + + + Netctl GUI + + + + + Version : %1 License : GPLv3 + + + + + Evgeniy Alekseev aka arcanis + + + + + E-mail : esalexeev@gmail.com + + + + + + Usage: + + + + + netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help] + + + + + + Parametrs: + + + + + --default - start with default settings + + + + + -t NUM --tab NUM - open a tab with number NUM + + + + + -h --help - show this help and exit + + + + + Netctl GUI + + + + Settings + + + + Ctrl+S + + + + Quit + + + + Ctrl+Q + + + + Name + + + + Description + + + + Status + + + + Refresh + + + + Ctrl+R + + + + Restart + + + + Connect to profile + + + + Profile + + + + Browse + + + + Clear + + + + Load + + + + Save + + + + Create a new profile + + + + Please install 'wpa_supplicant' before using it + + + + Signal + + + + Security + + + + Connect to Wi-Fi + + + + Menu + + + + + MobileWidget + + Select options file + + + + Configuration files (*.conf) + + + + Hide advanced + + + + Show advanced + + + + Form + + + + Mobile PPP settings + + + + Username + + + + The username and password to connect with + + + + Password + + + + Access point name + + + + The access point (apn) to connect on + + + + PIN + + + + If your modem requires a PIN to unlock, use this option + + + + Mode + + + + None + + + + 3Gpref + + + + 3Gonly + + + + GPRSpref + + + + GPRSonly + + + + This option is used to specify the connection mode + + + + Max fail + + + + The number of consecutive failed connection attempts to tolerate + + + + Use the default route provided by the peer + + + + Default route + + + + Use the DNS provided by the peer + + + + Use peer DNS + + + + Options file + + + + A file to read additional pppd options from + + + + Browse + + + + + PasswdWidget + + Form + + + + Password + + + + + PppoeWidget + + Select options file + + + + Configuration files (*.conf) + + + + Hide advanced + + + + Show advanced + + + + Form + + + + PPPoE settings + + + + Username + + + + The username and password to connect with + + + + Password + + + + Connection mode + + + + persist + + + + demand + + + + This option specifies how a connection should be established + + + + Idle timeout + + + + This option specifies the idle time (in seconds) after which ‘pppd’ should disconnect + + + + Max fail + + + + The number of consecutive failed connection attempts to tolerate + + + + Use the default route provided by the peer + + + + Default route + + + + Use the DNS provided by the peer + + + + Use peer DNS + + + + PPP unit + + + + Set the ppp unit number in the interface name (ppp0, ppp1, etc.) + + + + LCP echo interval + + + + These options override default LCP parameters from ‘/etc/ppp/options’ + + + + LCP echo failure + + + + Options file + + + + A file to read additional pppd options from + + + + Browse + + + + PPPoE service + + + + This option specifies the PPPoE service name + + + + PPPoE AC + + + + This option specifies the PPPoE access concentrator name + + + + PPPoE session + + + + This option specifies an existing session to attach to, MAC address + + + + PPPoE MAC + + + + Only connect to specified MAC address + + + + Enable IPv6 support + + + + PPPoE IPv6 + + + + + SettingsWindow + + Select path to directory with interfaces + + + + Select netctl command + + + + All files (*) + + + + Select path to profile directory + + + + Select path to directory with rfkill devices + + + + Select sudo command + + + + Select wpa_cli command + + + + Select wpa_supplicant command + + + + Settings + + + + Language + + + + Select a language + + + + You will need to restart the application + + + + General + + + + netctl path + + + + Path to netctl + + + + Browse + + + + Profile path + + + + Path to profile directory + + + + netctl + + + + sudo path + + + + Path to sudo + + + + sudo + + + + wpa_supplicant path + + + + Path to wpa_supplicant + + + + wpa_cli path + + + + Path to wpa_cli + + + + PID file + + + + wpa_supplicant PID file + + + + wpa_supplicant drivers + + + + wpa_supplicant drivers comma separated + + + + ctrl_interface directory + + + + Path to control directory + + + + ctrl_interface group + + + + Group of control directory + + + + wpa_supplicant + + + + Path to interface list + + + + Path to directory which contains network devices + + + + Path to rfkill device list + + + + Path to directory which contains rfkill devices + + + + Prefered wireless interface + + + + Other + + + + + TunnelWidget + + Form + + + + Tunnel settings + + + + Mode + + + + ipip + + + + gre + + + + sit + + + + isatap + + + + ip6ip6 + + + + ipip6 + + + + ip6gre + + + + any + + + + The tunnel type + + + + Local + + + + The address of the local end of the tunnel + + + + Remote + + + + The address of the remote end of the tunnel + + + + + TuntapWidget + + Form + + + + Tuntap settings + + + + Mode + + + + tun + + + + tap + + + + Either ‘tun’, or ‘tap’ + + + + User + + + + The owning user of the tun/tap interface + + + + Group + + + + The owning group of the tun/tap interface + + + + + VlanWidget + + Form + + + + vlan settings + + + + vlan ID + + + + vlan identifier + + + + + WirelessWidget + + Hide advanced + + + + Show advanced + + + + Form + + + + Wireless options + + + + Security + + + + none + + + + wep + + + + wpa + + + + wpa-configsection + + + + wpa-config + + + + ESSID + + + + The name of the network to connect to + + + + Wpa config section + + + + Add + + + + Array of lines that form a network block for wpa_supplicant + + + + Wpa config file + + + + Path to a wpa_supplicant configuration file + + + + Browse + + + + Key + + + + The secret key to a WEP, or WPA encrypted network + + + + Whether or not the specified network is a hidden network + + + + Hidden + + + + Whether or not to use ad-hoc mode + + + + Ad-hoc + + + + Scan frequencies + + + + A space-separated list of frequencies in MHz to scan when searching for the network + + + + Priority + + + + Priority group for the network + + + + Country + + + + The country for which frequency regulations will be enforced + + + + WPA group + + + + Group that has the authority to configure wpa_supplicant via its control interface + + + + Drivers + + + + west + + + + nl80211 + + + + wired + + + + The wpa_supplicant driver to use + + + + RFkill device + + + + The name of an rfkill device + + + + Timeout WPA + + + + Maximum time, in seconds, to wait for steps in the association and authentication to succeed + + + + Whether or not to exclude this profile from automatic profile selection + + + + Exclude auto + + + + diff --git a/sources/gui/resources/translations/russian.ts b/sources/gui/resources/translations/russian.ts new file mode 100644 index 0000000..4b5b73b --- /dev/null +++ b/sources/gui/resources/translations/russian.ts @@ -0,0 +1,1430 @@ + + + + + BridgeWidget + + Form + + + + Bridge settings + + + + Skip (R)STP and immediately activate all bridge members + + + + Skip forwarding delay + + + + + ErrorWindow + + Could not find components + + + + Does not support yet + + + + Profile name is not set + + + + Bind interfaces are not set + + + + Description is not set + + + + Ip settings are not set + + + + Configuration file does not exist + + + + Key is not set + + + + Wireless settings are not set + + + + Configuration file is not set + + + + ESSID is not set + + + + MAC address is incorrect + + + + Session ID is not set + + + + APN is not set + + + + Empty user/group name + + + + Unknown error + + + + Error + + + + Error text + + + + Ok + + + + + EthernetWidget + + Select wpa configuration file + + + + Configuration files (*.conf) + + + + Hide advanced + + + + Show advanced + + + + Form + + + + Ethernet options + + + + <html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html> + + + + Skip no carrier + + + + Set to ‘yes’ to use 802.1x authentication + + + + 802.1x authentication + + + + WPA config file + + + + Path to a wpa_supplicant configuration file + + + + Browse + + + + WPA driver + + + + wired + + + + nl80211 + + + + wext + + + + The wpa_supplicant driver to use for 802.1x authentication + + + + Timeout carrier + + + + Maximum time, in seconds, to wait for a carrier + + + + Timeout WPA + + + + Maximum time, in seconds, to wait for 802.1x authentication to succeed + + + + + GeneralWidget + + Hide advanced + + + + Show advanced + + + + Form + + + + General + + + + Description + + + + <html><head/><body><p>A description of the profile</p></body></html> + + + + Connection + + + + The connection type used by the profile + + + + Interface + + + + The name of the associated network interface + + + + Binds to interfaces + + + + Add + + + + An array of physical network interfaces that this profile needs before it can be started + + + + After + + + + An array of profile names that should be started before this profile is started + + + + Command after starting + + + + A command that is executed after a connection is established + + + + Command before stoping + + + + A command that is executed before a connection is brought down + + + + Set to ‘yes’ to force connecting even if the interface is up + + + + Force connect + + + + Debug mode + + + + + IpWidget + + Hide advanced + + + + Show advanced + + + + Form + + + + IP options + + + + IP + + + + dhcp + + + + static + + + + Address + + + + Add + + + + An array of IP addresses suffixed with ‘/<netmask>’ + + + + Gateway + + + + An IP routing gateway address + + + + IP6 + + + + dhcp-noaddr + + + + stateless + + + + Address6 + + + + An array of IPv6 addresses + + + + Gateway6 + + + + An IPv6 routing gateway address + + + + Routes + + + + An array of custom routes + + + + via + + + + An array of physical network interfaces that this profile needs before it can be started + + + + Routes6 + + + + Custom + + + + An array of argument lines to pass to ip + + + + Hostname + + + + A system hostname + + + + Timeout DAD + + + + Set to ‘yes’ to release the DHCP lease when the profile is stopped + + + + DHCP client + + + + dhcpcd + + + + dhclient + + + + The name of the preferred DHCP client + + + + dhcpcd options + + + + Additional options to be passed to the DHCP client + + + + dhclient options + + + + dhclient options (6) + + + + Timeout DHCP + + + + Maximum time, in seconds, to wait for DHCP to be successful + + + + DHCP release on stop + + + + DNS + + + + An array of DNS nameservers + + + + DNS domain + + + + A ‘domain’ line for /etc/resolv.conf + + + + DNS search + + + + A ‘search’ line for /etc/resolv.conf + + + + DNS options + + + + An array of ‘options’ lines for /etc/resolv.conf + + + + + MainWindow + + Ready + + + + Updated + + + + Error + + + + Done + + + + Stop + + + + Start + + + + Disable + + + + Enable + + + + Save profile as... + + + + Profile (*) + + + + Netctl GUI + + + + + Version : %1 License : GPLv3 + + + + + Evgeniy Alekseev aka arcanis + + + + + E-mail : esalexeev@gmail.com + + + + + + Usage: + + + + + netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help] + + + + + + Parametrs: + + + + + --default - start with default settings + + + + + -t NUM --tab NUM - open a tab with number NUM + + + + + -h --help - show this help and exit + + + + + Netctl GUI + + + + Settings + + + + Ctrl+S + + + + Quit + + + + Ctrl+Q + + + + Name + + + + Description + + + + Status + + + + Refresh + + + + Ctrl+R + + + + Restart + + + + Connect to profile + + + + Profile + + + + Browse + + + + Clear + + + + Load + + + + Save + + + + Create a new profile + + + + Please install 'wpa_supplicant' before using it + + + + Signal + + + + Security + + + + Connect to Wi-Fi + + + + Menu + + + + + MobileWidget + + Select options file + + + + Configuration files (*.conf) + + + + Hide advanced + + + + Show advanced + + + + Form + + + + Mobile PPP settings + + + + Username + + + + The username and password to connect with + + + + Password + + + + Access point name + + + + The access point (apn) to connect on + + + + PIN + + + + If your modem requires a PIN to unlock, use this option + + + + Mode + + + + None + + + + 3Gpref + + + + 3Gonly + + + + GPRSpref + + + + GPRSonly + + + + This option is used to specify the connection mode + + + + Max fail + + + + The number of consecutive failed connection attempts to tolerate + + + + Use the default route provided by the peer + + + + Default route + + + + Use the DNS provided by the peer + + + + Use peer DNS + + + + Options file + + + + A file to read additional pppd options from + + + + Browse + + + + + PasswdWidget + + Form + + + + Password + + + + + PppoeWidget + + Select options file + + + + Configuration files (*.conf) + + + + Hide advanced + + + + Show advanced + + + + Form + + + + PPPoE settings + + + + Username + + + + The username and password to connect with + + + + Password + + + + Connection mode + + + + persist + + + + demand + + + + This option specifies how a connection should be established + + + + Idle timeout + + + + This option specifies the idle time (in seconds) after which ‘pppd’ should disconnect + + + + Max fail + + + + The number of consecutive failed connection attempts to tolerate + + + + Use the default route provided by the peer + + + + Default route + + + + Use the DNS provided by the peer + + + + Use peer DNS + + + + PPP unit + + + + Set the ppp unit number in the interface name (ppp0, ppp1, etc.) + + + + LCP echo interval + + + + These options override default LCP parameters from ‘/etc/ppp/options’ + + + + LCP echo failure + + + + Options file + + + + A file to read additional pppd options from + + + + Browse + + + + PPPoE service + + + + This option specifies the PPPoE service name + + + + PPPoE AC + + + + This option specifies the PPPoE access concentrator name + + + + PPPoE session + + + + This option specifies an existing session to attach to, MAC address + + + + PPPoE MAC + + + + Only connect to specified MAC address + + + + Enable IPv6 support + + + + PPPoE IPv6 + + + + + SettingsWindow + + Select path to directory with interfaces + + + + Select netctl command + + + + All files (*) + + + + Select path to profile directory + + + + Select path to directory with rfkill devices + + + + Select sudo command + + + + Select wpa_cli command + + + + Select wpa_supplicant command + + + + Settings + + + + Language + + + + Select a language + + + + You will need to restart the application + + + + General + + + + netctl path + + + + Path to netctl + + + + Browse + + + + Profile path + + + + Path to profile directory + + + + netctl + + + + sudo path + + + + Path to sudo + + + + sudo + + + + wpa_supplicant path + + + + Path to wpa_supplicant + + + + wpa_cli path + + + + Path to wpa_cli + + + + PID file + + + + wpa_supplicant PID file + + + + wpa_supplicant drivers + + + + wpa_supplicant drivers comma separated + + + + ctrl_interface directory + + + + Path to control directory + + + + ctrl_interface group + + + + Group of control directory + + + + wpa_supplicant + + + + Path to interface list + + + + Path to directory which contains network devices + + + + Path to rfkill device list + + + + Path to directory which contains rfkill devices + + + + Prefered wireless interface + + + + Other + + + + + TunnelWidget + + Form + + + + Tunnel settings + + + + Mode + + + + ipip + + + + gre + + + + sit + + + + isatap + + + + ip6ip6 + + + + ipip6 + + + + ip6gre + + + + any + + + + The tunnel type + + + + Local + + + + The address of the local end of the tunnel + + + + Remote + + + + The address of the remote end of the tunnel + + + + + TuntapWidget + + Form + + + + Tuntap settings + + + + Mode + + + + tun + + + + tap + + + + Either ‘tun’, or ‘tap’ + + + + User + + + + The owning user of the tun/tap interface + + + + Group + + + + The owning group of the tun/tap interface + + + + + VlanWidget + + Form + + + + vlan settings + + + + vlan ID + + + + vlan identifier + + + + + WirelessWidget + + Hide advanced + + + + Show advanced + + + + Form + + + + Wireless options + + + + Security + + + + none + + + + wep + + + + wpa + + + + wpa-configsection + + + + wpa-config + + + + ESSID + + + + The name of the network to connect to + + + + Wpa config section + + + + Add + + + + Array of lines that form a network block for wpa_supplicant + + + + Wpa config file + + + + Path to a wpa_supplicant configuration file + + + + Browse + + + + Key + + + + The secret key to a WEP, or WPA encrypted network + + + + Whether or not the specified network is a hidden network + + + + Hidden + + + + Whether or not to use ad-hoc mode + + + + Ad-hoc + + + + Scan frequencies + + + + A space-separated list of frequencies in MHz to scan when searching for the network + + + + Priority + + + + Priority group for the network + + + + Country + + + + The country for which frequency regulations will be enforced + + + + WPA group + + + + Group that has the authority to configure wpa_supplicant via its control interface + + + + Drivers + + + + west + + + + nl80211 + + + + wired + + + + The wpa_supplicant driver to use + + + + RFkill device + + + + The name of an rfkill device + + + + Timeout WPA + + + + Maximum time, in seconds, to wait for steps in the association and authentication to succeed + + + + Whether or not to exclude this profile from automatic profile selection + + + + Exclude auto + + + + diff --git a/sources/gui/src/CMakeLists.txt b/sources/gui/src/CMakeLists.txt index 2d7bf02..78b90f1 100644 --- a/sources/gui/src/CMakeLists.txt +++ b/sources/gui/src/CMakeLists.txt @@ -3,6 +3,10 @@ file (GLOB SOURCES *.cpp) file (GLOB HEADERS *.h) file (GLOB FORMS *.ui) +set (LANGUAGES english + russian) +set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc) + message (STATUS "${SUBPROJECT} Sources: ${SOURCES}") message (STATUS "${SUBPROJECT} Headers: ${HEADERS}") message (STATUS "${SUBPROJECT} Forms: ${FORMS}") @@ -14,12 +18,24 @@ find_package (Qt4 REQUIRED) include (${QT_USE_FILE}) qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) qt4_wrap_ui (UI_HEADERS ${FORMS}) +qt4_add_resources (QRC_SOURCES ${RESOURCES}) + +foreach (LANGUAGE ${LANGUAGES}) + set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts) + set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm) + set (TRANSLATIONS ${TRANSLATIONS} ${TS}) + set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM}) + add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS}) +endforeach () +add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS}) +add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS}) +message (STATUS "${SUBPROJECT} Translations: ${TRANSLATIONS_BINARY}") source_group ("Header Files" FILES ${HEADERS}) source_group ("Source Files" FILES ${SOURCES}) source_group ("Generated Files" FILES ${MOC_SOURCES}) -add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES}) +add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS}) target_link_libraries (${SUBPROJECT} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) # install properties diff --git a/sources/gui/src/main.cpp b/sources/gui/src/main.cpp index 7935ce1..3c480e9 100644 --- a/sources/gui/src/main.cpp +++ b/sources/gui/src/main.cpp @@ -18,8 +18,10 @@ #include +#include +#include +#include #include -#include #include "mainwindow.h" #include "version.h" @@ -30,6 +32,31 @@ using namespace std; int main(int argc, char *argv[]) { + QApplication a(argc, argv); + + // translation + QString configPath = QDir::homePath() + QDir::separator() + QString(".config") + + QDir::separator() + QString("netctl-gui.conf"); + QFile configFile(configPath); + QString fileStr; + QString language = QString("english"); + if (configFile.open(QIODevice::ReadOnly)) + while (true) { + fileStr = QString(configFile.readLine()); + if (configFile.atEnd()) + break; + else if (fileStr[0] != '#') { + if (fileStr.contains(QString("LANGUAGE="))) + language = fileStr.split(QString("="))[1] + .remove(QString(" ")) + .trimmed(); + } + } + configFile.close(); + QTranslator translator; + translator.load(QString(":/translations/") + language); + a.installTranslator(&translator); + QString helpMessage = QString(""); helpMessage += QApplication::translate("MainWindow", " Netctl GUI\n"); helpMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n") @@ -73,7 +100,6 @@ int main(int argc, char *argv[]) } } - QApplication a(argc, argv); MainWindow w(0, defaultSettings, tabNumber); w.show(); return a.exec(); diff --git a/sources/gui/src/settingswindow.cpp b/sources/gui/src/settingswindow.cpp index a9e626c..ca3ef86 100644 --- a/sources/gui/src/settingswindow.cpp +++ b/sources/gui/src/settingswindow.cpp @@ -265,9 +265,9 @@ QMap SettingsWindow::getSettings() break; else if (fileStr[0] != '#') { if (fileStr.indexOf(QString("=")) > -1) - settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1] - .remove(QString(" ")) - .trimmed(); + settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1] + .remove(QString(" ")) + .trimmed(); } }