diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-05-20 13:49:35 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-05-20 13:49:35 +0200 |
commit | 67d58da771ed543874154cdb9e049c0e05459a87 (patch) | |
tree | a61d1687981315438b11a8574648c3cc6f6df0dc /app | |
parent | f47c908c88875c32fd4c624aeecefbf660c17e85 (diff) |
localization setup
Diffstat (limited to 'app')
-rw-r--r-- | app/java/res/values-de/strings.xml | 66 | ||||
-rw-r--r-- | app/java/res/values-ja/strings.xml | 66 | ||||
-rw-r--r-- | app/java/res/values/strings.xml | 56 | ||||
-rw-r--r-- | app/java/res/xml/settings.xml | 16 | ||||
-rw-r--r-- | app/java/src/DNSProxyService.java | 6 | ||||
-rw-r--r-- | app/java/src/MainActivity.java | 16 | ||||
-rw-r--r-- | app/java/src/WifiListenerService.java | 8 |
7 files changed, 196 insertions, 38 deletions
diff --git a/app/java/res/values-de/strings.xml b/app/java/res/values-de/strings.xml new file mode 100644 index 0000000..1b4ebc6 --- /dev/null +++ b/app/java/res/values-de/strings.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_label"> + Pihole DNS Proxy + </string> + + <string name="button_start"> + Start + </string> + <string name="button_stop"> + Stop + </string> + + <!-- DNSProxyService --> + <string name="dns_proxy_service__notification__text" formatted="false"> + %s wird verwendet + </string> + <string name="dns_proxy_service__notification__action__stop"> + Stop + </string> + + <!-- WifiListenerService --> + <string name="wifi_listener_service__notification__text"> + Wartet auf Verbindungsänderungen + </string> + <string name="wifi_listener_service__notification__action__stop_listener"> + Listener stoppen + </string> + <string name="wifi_listener_service__notification__action__start_proxy"> + Proxy starten + </string> + + <!-- Settings --> + <string name="menu_settings"> + Einstellungen + </string> + + <string name="settings__use_automatic_dns_server_discovery__title"> + DNS Server / Pihole automatisch erkennen + </string> + <string name="settings__use_automatic_dns_server_discovery__summary"> + Ob der automatische Erkennungsmechanismus verwendet werden soll, um den DNS Server zu setzen + </string> + + <string name="settings__dns_server_address__title"> + Pihole IP Adresse + </string> + + <string name="settings__use_wifi_listener__title"> + WiFi Listener verwenden + </string> + <string name="settings__use_wifi_listener__summary"> + Deaktiviert den Proxy wenn die WiFi Verbindung verloren geht + </string> + + <string name="settings__use_wifi_listener_for_activation__title"> + WiFi Listener für Aktivierung verwenden + </string> + <string name="settings__use_wifi_listener_for_activation__summary"> + Aktiviert den Proxy wenn mit bestimmtem WLAN verbunden wird. Braucht Standortdienste um zu funktionieren! + </string> + + <string name="settings__wifi_listener_ssid__title"> + WLAN SSID + </string> +</resources> diff --git a/app/java/res/values-ja/strings.xml b/app/java/res/values-ja/strings.xml new file mode 100644 index 0000000..cdd2d3c --- /dev/null +++ b/app/java/res/values-ja/strings.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_label"> + Pihole DNS Proxy + </string> + + <string name="button_start"> + 開始 + </string> + <string name="button_stop"> + 止まる + </string> + + <!-- DNSProxyService --> + <string name="dns_proxy_service__notification__text"> + Running with %s + </string> + <string name="dns_proxy_service__notification__action__stop"> + 止まる + </string> + + <!-- WifiListenerService --> + <string name="wifi_listener_service__notification__text"> + Listening for WiFi connection change + </string> + <string name="wifi_listener_service__notification__action__stop_listener"> + Stop Listener + </string> + <string name="wifi_listener_service__notification__action__start_proxy"> + プロキシ開始 + </string> + + <!-- Settings --> + <string name="menu_settings"> + 設定 + </string> + + <string name="settings__use_automatic_dns_server_discovery__title"> + Use automatic DNS Server / Pihole discovery + </string> + <string name="settings__use_automatic_dns_server_discovery__summary"> + Whether to use the automatic discovery mechanism to set the DNS server + </string> + + <string name="settings__dns_server_address__title"> + Pihole IP アドレス + </string> + + <string name="settings__use_wifi_listener__title"> + Use WiFi listener + </string> + <string name="settings__use_wifi_listener__summary"> + Automatically deactivates the proxy on WiFi disconnect + </string> + + <string name="settings__use_wifi_listener_for_activation__title"> + Use WiFi listener for activation + </string> + <string name="settings__use_wifi_listener_for_activation__summary"> + Automatically activates the proxy on WiFi connect when connecting to specific WLAN. Needs location services to function! + </string> + + <string name="settings__wifi_listener_ssid__title"> + WLAN SSID + </string> +</resources> diff --git a/app/java/res/values/strings.xml b/app/java/res/values/strings.xml index 7848d3e..3662cf5 100644 --- a/app/java/res/values/strings.xml +++ b/app/java/res/values/strings.xml @@ -4,13 +4,6 @@ Pihole DNS Proxy </string> - <string name="service_starting"> - starting - </string> - <string name="service_stopping"> - stopping - </string> - <string name="button_start"> Start </string> @@ -18,7 +11,56 @@ Stop </string> + <!-- DNSProxyService --> + <string name="dns_proxy_service__notification__text" formatted="false"> + Running with %s + </string> + <string name="dns_proxy_service__notification__action__stop"> + Stop + </string> + + <!-- WifiListenerService --> + <string name="wifi_listener_service__notification__text"> + Listening for WiFi connection change + </string> + <string name="wifi_listener_service__notification__action__stop_listener"> + Stop Listener + </string> + <string name="wifi_listener_service__notification__action__start_proxy"> + Start Proxy + </string> + + <!-- Settings --> <string name="menu_settings"> Settings </string> + + <string name="settings__use_automatic_dns_server_discovery__title"> + Use automatic DNS Server / Pihole discovery + </string> + <string name="settings__use_automatic_dns_server_discovery__summary"> + Whether to use the automatic discovery mechanism to set the DNS server + </string> + + <string name="settings__dns_server_address__title"> + Pihole IP address + </string> + + <string name="settings__use_wifi_listener__title"> + Use WiFi listener + </string> + <string name="settings__use_wifi_listener__summary"> + Automatically deactivates the proxy on WiFi disconnect + </string> + + <string name="settings__use_wifi_listener_for_activation__title"> + Use WiFi listener for activation + </string> + <string name="settings__use_wifi_listener_for_activation__summary"> + Automatically activates the proxy on WiFi connect when connecting to specific WLAN. Needs location services to function! + </string> + + <string name="settings__wifi_listener_ssid__title"> + WLAN SSID + </string> </resources> diff --git a/app/java/res/xml/settings.xml b/app/java/res/xml/settings.xml index 0cd7034..31cc8f0 100644 --- a/app/java/res/xml/settings.xml +++ b/app/java/res/xml/settings.xml @@ -5,34 +5,34 @@ <SwitchPreference android:key="use_automatic_dns_server_discovery" android:defaultValue="true" - android:title="Use automatic DNS Server / Pihole discovery" - android:summary="Whether to use the automatic discovery mechanism to set the DNS server" + android:title="@string/settings__use_automatic_dns_server_discovery__title" + android:summary="@string/settings__use_automatic_dns_server_discovery__summary" /> <EditTextPreference android:key="dns_server_address" - android:title="Pihole IP address" + android:title="@string/settings__dns_server_address__title" /> <SwitchPreference android:key="use_wifi_listener" android:defaultValue="false" - android:title="Use WiFi listener" - android:summary="Automatically deactivates the proxy on WiFi disconnect" + android:title="@string/settings__use_wifi_listener__title" + android:summary="@string/settings__use_wifi_listener__summary" /> <SwitchPreference android:key="use_wifi_listener_for_activation" android:dependency="use_wifi_listener" android:defaultValue="false" - android:title="Use WiFi listener for activation" - android:summary="Automatically activates the proxy on WiFi connect when connecting to specific WLAN. Needs location services to function!" + android:title="@string/settings__use_wifi_listener_for_activation__title" + android:summary="@string/settings__use_wifi_listener_for_activation__summary" /> <EditTextPreference android:key="wifi_listener_ssid" android:dependency="use_wifi_listener_for_activation" - android:title="WLAN SSID" + android:title="@string/settings__wifi_listener_ssid__title" /> <!-- SELECT_FROM_KNOWN_SSIDS --> diff --git a/app/java/src/DNSProxyService.java b/app/java/src/DNSProxyService.java index 5a3d70f..10e127b 100644 --- a/app/java/src/DNSProxyService.java +++ b/app/java/src/DNSProxyService.java @@ -153,12 +153,12 @@ public class DNSProxyService extends VpnService { Notification notification = new Notification.Builder(this, DNSProxyService.NOTIFICATION_CHANNEL_ID) .setSmallIcon(R.drawable.logo) - .setContentTitle("Pihole DNS Proxy") - .setContentText("Running with " + DNSProxyService.PIHOLE_ADDRESS) + .setContentTitle(getString(R.string.app_label)) + .setContentText(String.format(getString(R.string.dns_proxy_service__notification__text), DNSProxyService.PIHOLE_ADDRESS)) .setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), Intent.FLAG_ACTIVITY_NEW_TASK)) .addAction( R.drawable.logo, - "Stop", + getString(R.string.dns_proxy_service__notification__action__stop), PendingIntent.getService(this, 0, (new Intent(this, DNSProxyService.class)).setAction(DNSProxyService.ACTION_STOP), PendingIntent.FLAG_IMMUTABLE diff --git a/app/java/src/MainActivity.java b/app/java/src/MainActivity.java index 3d2c197..7b0f375 100644 --- a/app/java/src/MainActivity.java +++ b/app/java/src/MainActivity.java @@ -157,14 +157,6 @@ public class MainActivity extends Activity { */ private void startDNSProxyService() { DNSProxyService.start(this); - - Toast - .makeText( - this, - getString(R.string.service_starting), - Toast.LENGTH_SHORT - ) - .show(); } /** @@ -172,13 +164,5 @@ public class MainActivity extends Activity { */ private void stopDNSProxyService() { DNSProxyService.stop(this); - - Toast - .makeText( - this, - getString(R.string.service_stopping), - Toast.LENGTH_SHORT - ) - .show(); } } diff --git a/app/java/src/WifiListenerService.java b/app/java/src/WifiListenerService.java index da4c337..0920677 100644 --- a/app/java/src/WifiListenerService.java +++ b/app/java/src/WifiListenerService.java @@ -160,12 +160,12 @@ public class WifiListenerService extends Service Notification notification = new Notification.Builder(this, WifiListenerService.NOTIFICATION_CHANNEL_ID) .setSmallIcon(R.drawable.logo) - .setContentTitle("Pihole DNS Proxy - WiFi Listener") - .setContentText("Listening for WiFi connection change") + .setContentTitle(getString(R.string.app_label) + " - WiFi Listener") + .setContentText(getString(R.string.wifi_listener_service__notification__text)) .setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, SettingsActivity.class), Intent.FLAG_ACTIVITY_NEW_TASK)) .addAction( R.drawable.logo, - "Stop Listener", + getString(R.string.wifi_listener_service__notification__action__stop_listener), PendingIntent.getService(this, 0, (new Intent(this, WifiListenerService.class)).setAction(WifiListenerService.ACTION_STOP_SET_PREFERENCE), PendingIntent.FLAG_IMMUTABLE @@ -173,7 +173,7 @@ public class WifiListenerService extends Service ) .addAction( R.drawable.logo, - "Start Proxy", + getString(R.string.wifi_listener_service__notification__action__start_proxy), PendingIntent.getService(this, 0, (new Intent(this, DNSProxyService.class)).setAction(DNSProxyService.ACTION_START), PendingIntent.FLAG_IMMUTABLE |