From 67d58da771ed543874154cdb9e049c0e05459a87 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 20 May 2023 13:49:35 +0200 Subject: localization setup --- app/java/res/values-de/strings.xml | 66 +++++++++++++++++++++++++++++++++++ app/java/res/values-ja/strings.xml | 66 +++++++++++++++++++++++++++++++++++ app/java/res/values/strings.xml | 56 +++++++++++++++++++++++++---- app/java/res/xml/settings.xml | 16 ++++----- app/java/src/DNSProxyService.java | 6 ++-- app/java/src/MainActivity.java | 16 --------- app/java/src/WifiListenerService.java | 8 ++--- 7 files changed, 196 insertions(+), 38 deletions(-) create mode 100644 app/java/res/values-de/strings.xml create mode 100644 app/java/res/values-ja/strings.xml 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 @@ + + + + Pihole DNS Proxy + + + + Start + + + Stop + + + + + %s wird verwendet + + + Stop + + + + + Wartet auf Verbindungsänderungen + + + Listener stoppen + + + Proxy starten + + + + + Einstellungen + + + + DNS Server / Pihole automatisch erkennen + + + Ob der automatische Erkennungsmechanismus verwendet werden soll, um den DNS Server zu setzen + + + + Pihole IP Adresse + + + + WiFi Listener verwenden + + + Deaktiviert den Proxy wenn die WiFi Verbindung verloren geht + + + + WiFi Listener für Aktivierung verwenden + + + Aktiviert den Proxy wenn mit bestimmtem WLAN verbunden wird. Braucht Standortdienste um zu funktionieren! + + + + WLAN SSID + + 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 @@ + + + + Pihole DNS Proxy + + + + 開始 + + + 止まる + + + + + Running with %s + + + 止まる + + + + + Listening for WiFi connection change + + + Stop Listener + + + プロキシ開始 + + + + + 設定 + + + + Use automatic DNS Server / Pihole discovery + + + Whether to use the automatic discovery mechanism to set the DNS server + + + + Pihole IP アドレス + + + + Use WiFi listener + + + Automatically deactivates the proxy on WiFi disconnect + + + + Use WiFi listener for activation + + + Automatically activates the proxy on WiFi connect when connecting to specific WLAN. Needs location services to function! + + + + WLAN SSID + + 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 - - starting - - - stopping - - Start @@ -18,7 +11,56 @@ Stop + + + Running with %s + + + Stop + + + + + Listening for WiFi connection change + + + Stop Listener + + + Start Proxy + + + Settings + + + Use automatic DNS Server / Pihole discovery + + + Whether to use the automatic discovery mechanism to set the DNS server + + + + Pihole IP address + + + + Use WiFi listener + + + Automatically deactivates the proxy on WiFi disconnect + + + + Use WiFi listener for activation + + + Automatically activates the proxy on WiFi connect when connecting to specific WLAN. Needs location services to function! + + + + WLAN SSID + 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 @@ 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 -- cgit v1.2.3