From 4d042f4b59f3d99e9894d48a2623fae1835e7c83 Mon Sep 17 00:00:00 2001 From: Graham Jones Date: Thu, 2 Apr 2020 20:44:14 +0100 Subject: [PATCH] Moved more hard coded text into string resources so they can be translated. --- CREDITS.md | 7 + .../uk/org/openseizuredetector/SdServer.java | 32 ++-- app/src/main/res/layout/about_layout.xml | 29 +--- app/src/main/res/layout/startup_activity.xml | 4 +- .../main/res/menu/main_activity_actions.xml | 22 +-- app/src/main/res/values-de/strings.xml | 26 +++ app/src/main/res/values-ru/strings.xml | Bin 18438 -> 24502 bytes app/src/main/res/values-sv/strings.xml | 150 ++++++++++++++++++ app/src/main/res/values/strings.xml | 26 +++ app/src/main/res/xml/preference_headers.xml | 4 +- translations/sv/strings.xml | 124 +++++++++++++++ translations/sv/sv-1.png | Bin 0 -> 48438 bytes translations/sv/sv-2.png | Bin 0 -> 60300 bytes 13 files changed, 366 insertions(+), 58 deletions(-) create mode 100644 CREDITS.md create mode 100644 app/src/main/res/values-sv/strings.xml create mode 100644 translations/sv/strings.xml create mode 100644 translations/sv/sv-1.png create mode 100644 translations/sv/sv-2.png diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 0000000..87d701f --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,7 @@ +CREDITS +------- +Thank you to the following people who have contributed to this app: + +Juergen Huebers - German Translation +Pavel Losevsky - Russian Translation +Andreas Ekstrom - Sweedish Translation diff --git a/app/src/main/java/uk/org/openseizuredetector/SdServer.java b/app/src/main/java/uk/org/openseizuredetector/SdServer.java index cbed35f..164db1e 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdServer.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdServer.java @@ -414,31 +414,31 @@ public class SdServer extends Service implements SdDataReceiver { switch (alarmLevel) { case 0: iconId = R.drawable.star_of_life_24x24; - titleStr = "OK"; + titleStr = getString(R.string.okBtnTxt); soundUri = null; break; case 1: iconId = R.drawable.star_of_life_yellow_24x24; - titleStr = "WARNING"; + titleStr = getString(R.string.Warning); if (mAudibleWarning) soundUri = Uri.parse("android.resource://" + getPackageName() + "/raw/warning"); break; case 2: iconId = R.drawable.star_of_life_red_24x24; - titleStr = "ALARM"; + titleStr = getString(R.string.Alarm); if (mAudibleAlarm) soundUri = Uri.parse("android.resource://" + getPackageName() + "/raw/alarm"); break; case -1: iconId = R.drawable.star_of_life_fault_24x24; - titleStr = "FAULT"; + titleStr = getString(R.string.Fault); if (mAudibleFaultWarning) soundUri = Uri.parse("android.resource://" + getPackageName() + "/raw/fault"); break; default: iconId = R.drawable.star_of_life_24x24; soundUri = null; - titleStr = "OK"; + titleStr = getString(R.string.okBtnTxt); } if (mCancelAudible) { @@ -453,9 +453,9 @@ public class SdServer extends Service implements SdDataReceiver { 0, i, PendingIntent.FLAG_UPDATE_CURRENT); String smsStr; if (mSMSAlarm) { - smsStr = "WARNING: SMS Location Alarm Active"; + smsStr = getString(R.string.sms_location_alarm_active); } else { - smsStr = "SMS Location Alarm Disabled"; + smsStr = getString(R.string.sms_location_alarm_disabled); } if (mNotificationBuilder != null) { mNotification = mNotificationBuilder.setContentIntent(contentIntent) @@ -788,11 +788,11 @@ public class SdServer extends Service implements SdDataReceiver { } } else { Log.i(TAG, "sendSMSAlarm() - Cancel Audible Active - not sending SMS"); - mUtil.showToast("Cancel Audible Active - not sending SMS"); + mUtil.showToast(getString(R.string.cancel_audible_not_sending_sms)); } } else { Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!"); - mUtil.showToast("SMS Alarms Disabled - not doing anything!"); + mUtil.showToast(getString(R.string.sms_alarm_disabled)); } } @@ -996,7 +996,7 @@ public class SdServer extends Service implements SdDataReceiver { if (!isWiFi) { Log.v(TAG, "NetworkBroadcastReceiver - no Wifi Connection"); mUtil.writeToSysLogFile("Network State Changed - no Wifi Connection"); - mUtil.showToast("Network State Changed - no Wifi Connection"); + mUtil.showToast(getString(R.string.no_wifi_connection)); } else { Log.v(TAG, "NetworkBroadcastReceiver - Wifi Connected"); mUtil.writeToSysLogFile("Network State Changed - Wifi Connected"); @@ -1005,7 +1005,7 @@ public class SdServer extends Service implements SdDataReceiver { } else { Log.v(TAG, "NetworkBroadcastReceiver - No Active Network"); mUtil.writeToSysLogFile("Network State Changed - No Active Network"); - mUtil.showToast("Network State Changed - No Active Network"); + mUtil.showToast(getString(R.string.no_active_network)); } } } @@ -1092,7 +1092,7 @@ public class SdServer extends Service implements SdDataReceiver { } catch (Exception ex) { Log.v(TAG, "updatePrefs() - Problem parsing preferences!"); mUtil.writeToSysLogFile("SdServer.updatePrefs() - Error " + ex.toString()); - mUtil.showToast("Problem Parsing Preferences - Something won't work - Please go back to Settings and correct it!"); + mUtil.showToast(getString(R.string.problem_parsing_preferences)); } } @@ -1174,7 +1174,7 @@ public class SdServer extends Service implements SdDataReceiver { mLocationFinder.getLocation(this); Location loc = mLocationFinder.getLastLocation(); if (loc != null) { - mUtil.showToast("Send SMS - last location is " + mUtil.showToast(getString(R.string.send_sms_last_location) + loc.getLongitude() + "," + loc.getLatitude()); } else { @@ -1216,7 +1216,7 @@ public class SdServer extends Service implements SdDataReceiver { Log.e(TAG, "sendSMS - Failed to send SMS Message"); mUtil.writeToSysLogFile("sendSMS - Failed to send SMS Message"); Log.e(TAG, e.toString()); - mUtil.showToast("ERROR: FAILED TO SEND SMS MESSAGE"); + mUtil.showToast(getString(R.string.failed_to_send_sms)); } } @@ -1239,7 +1239,7 @@ public class SdServer extends Service implements SdDataReceiver { @Override public void onSdLocationReceived(Location ll) { if (ll == null) { - mUtil.showToast("onSdLocationReceived() - NULL LOCATION RECEIVED"); + //mUtil.showToast("onSdLocationReceived() - NULL LOCATION RECEIVED"); Log.w(TAG, "onSdLocationReceived() - NULL LOCATION RECEIVED"); } else { //mUtil.showToast("onSdLocationReceived() - found location" + ll.toString()); @@ -1266,7 +1266,7 @@ public class SdServer extends Service implements SdDataReceiver { } } else { Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!"); - mUtil.showToast("SMS Alarms Disabled - not doing anything!"); + mUtil.showToast(getString(R.string.sms_alarms_disabled)); } } diff --git a/app/src/main/res/layout/about_layout.xml b/app/src/main/res/layout/about_layout.xml index 554e8c1..a1c3b06 100644 --- a/app/src/main/res/layout/about_layout.xml +++ b/app/src/main/res/layout/about_layout.xml @@ -18,18 +18,7 @@ android:layout_height="wrap_content" android:textSize="16sp" android:autoLink="web" - android:text="OpenSeizureDetector epileptic\n -(tonic-clonic) seizure detector and \n -alarm system. Uses a Pebble Smart\n -watch to detect the shaking \n -associated with a seizure, \n -then raises audible and text\n -message (SMS) alerts for carers.\n -The system is free and open source - see \n -http://openseizuredetector.org.uk for details. -Please report any issues to graham@openseizuredetector.org.uk\n -or raise an issue on the project github source code \n -repository - https://github.com/OpenSeizureDetector" + android:text="@string/about_text" /> diff --git a/app/src/main/res/layout/startup_activity.xml b/app/src/main/res/layout/startup_activity.xml index 7ad4a3b..931f1fc 100644 --- a/app/src/main/res/layout/startup_activity.xml +++ b/app/src/main/res/layout/startup_activity.xml @@ -40,7 +40,7 @@