danar history translation support

This commit is contained in:
Milos Kozak 2016-07-28 13:40:32 +02:00
parent a9218c20d5
commit e94fe1f647
4 changed files with 72 additions and 26 deletions

View file

@ -160,15 +160,15 @@ public class DanaRHistoryActivity extends Activity {
// Types
ArrayList<TypeList> typeList = new ArrayList<>();
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_ALARM, "Alarms"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, "Basal Hours"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_BOLUS, "Bolus"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_CARBO, "Carbohydrates"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_DAILY, "Daily insulin"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_ERROR, "Errors"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, "Glucose"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_REFILL, "Refill"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_SUSPEND, "Suspend"));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_ALARM, getString(R.string.danar_history_alarm)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, getString(R.string.danar_history_basalhours)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_BOLUS, getString(R.string.danar_history_bolus)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_CARBO, getString(R.string.danar_history_carbohydrates)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_DAILY, getString(R.string.danar_history_dailyinsulin)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_ERROR, getString(R.string.danar_history_errors)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, getString(R.string.danar_history_glucose)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_REFILL, getString(R.string.danar_history_refill)));
typeList.add(new TypeList(RecordTypes.RECORD_TYPE_SUSPEND, getString(R.string.danar_history_syspend)));
ArrayAdapter<TypeList> spinnerAdapter = new ArrayAdapter<TypeList>(this,
android.R.layout.simple_spinner_item, typeList);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
@ -434,13 +434,13 @@ public class DanaRHistoryActivity extends Activity {
@Override
public void run() {
if (c.sStatus == c.CONNECTING) {
statusView.setText("Connecting for " + c.sSecondsElapsed + "s");
statusView.setText(String.format(getString(R.string.danar_history_connectingfor), c.sSecondsElapsed));
log.debug("EventDanaRConnectionStatus: " + "Connecting for " + c.sSecondsElapsed + "s");
} else if (c.sStatus == c.CONNECTED) {
statusView.setText("Connected");
statusView.setText(MainApp.sResources.getString(R.string.connected));
log.debug("EventDanaRConnectionStatus: Connected");
} else {
statusView.setText("Disconnected");
statusView.setText(MainApp.sResources.getString(R.string.disconnected));
log.debug("EventDanaRConnectionStatus: Disconnected");
}
}

View file

@ -61,7 +61,7 @@ public class DanaRNSHistorySync {
if (record.get_id() != null) continue;
//log.debug(record.getBytes());
JSONObject nsrec = new JSONObject();
ev.message = "Uploading " + processing + "/" + records + " "; // TODO: translations
ev.message = MainApp.sResources.getString(R.string.uploading) + " " + processing + "/" + records + " "; // TODO: translations
switch (record.getRecordCode()) {
case RecordTypes.RECORD_TYPE_BOLUS:
if ((what & SYNC_BOLUS) == 0) break;
@ -75,7 +75,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "S bolus";
ev.message += MainApp.sResources.getString(R.string.danar_sbolus);
break;
case "E":
if (record.getRecordDuration() > 0) {
@ -93,7 +93,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "E bolus";
ev.message += MainApp.sResources.getString(R.string.danar_ebolus);
} else {
log.debug("NOT Syncing extended bolus record " + record.getRecordValue() + "U " + DateUtil.toISOString(record.getRecordDate()) + " zero duration");
}
@ -109,7 +109,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "DS bolus";
ev.message += MainApp.sResources.getString(R.string.danar_dsbolus);
break;
case "DE":
log.debug("Syncing dual(E) bolus record " + record.getRecordValue() + "U " + DateUtil.toISOString(record.getRecordDate()));
@ -125,7 +125,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "DE bolus";
ev.message += MainApp.sResources.getString(R.string.danar_debolus);
break;
default:
log.debug("Unknown bolus record");
@ -142,7 +142,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "error";
ev.message += MainApp.sResources.getString(R.string.danar_error);
break;
case RecordTypes.RECORD_TYPE_REFILL:
if ((what & SYNC_REFILL) == 0) break;
@ -154,7 +154,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "refill";
ev.message += MainApp.sResources.getString(R.string.danar_refill);
break;
case RecordTypes.RECORD_TYPE_BASALHOUR:
if ((what & SYNC_BASALHOURS) == 0) break;
@ -167,7 +167,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "basal hour";
ev.message += MainApp.sResources.getString(R.string.danar_basalhour);
break;
case RecordTypes.RECORD_TYPE_TB:
//log.debug("Ignoring TB record " + record.getBytes() + " " + DateUtil.toISOString(record.getRecordDate()));
@ -183,7 +183,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "glucose";
ev.message += MainApp.sResources.getString(R.string.danar_glucose);
break;
case RecordTypes.RECORD_TYPE_CARBO:
if ((what & SYNC_CARBO) == 0) break;
@ -195,7 +195,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "carbo";
ev.message += MainApp.sResources.getString(R.string.danar_carbohydrate);
break;
case RecordTypes.RECORD_TYPE_ALARM:
if ((what & SYNC_ALARM) == 0) break;
@ -207,7 +207,7 @@ public class DanaRNSHistorySync {
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "alarm";
ev.message += MainApp.sResources.getString(R.string.danar_alarm);
break;
case RecordTypes.RECORD_TYPE_SUSPEND: // TODO: this too
case RecordTypes.RECORD_TYPE_DAILY:
@ -220,7 +220,7 @@ public class DanaRNSHistorySync {
}
MainApp.bus().post(ev);
}
ev.message = "Total " + uploaded + " records uploaded";
ev.message = String.format(MainApp.sResources.getString(R.string.danar_totaluploaded), uploaded);
MainApp.bus().post(ev);
} catch (JSONException e) {

View file

@ -234,10 +234,10 @@
<string name="success">Úspěch</string>
<string name="virtualpump_lastconnection_label">Poslední spojení:</string>
<string name="canceltemp">Zrušit dočasný bazál</string>
<string formatted="false" name="bolusdelivered">Bolus %.2fU aplikován úspěšně</string>
<string name="bolusdelivered" formatted="false">Bolus %.2fU aplikován úspěšně</string>
<string name="bolusfailed">Chyba při aplikování bolusu</string>
<string name="remotebolusnotallowed">Vzdálený bolus není momentálně povolen</string>
<string formatted="false" name="replywithcode">K potvzení bolusu %.2fU odpověz SMS s kódem %s</string>
<string name="replywithcode" formatted="false">K potvzení bolusu %.2fU odpověz SMS s kódem %s</string>
<string name="smscommunicator">SMS komunikátor</string>
<string name="smscommunicator_allowednumbers">Povolená tel. čísla</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
@ -252,4 +252,28 @@
<string name="danarprofile_car">Rychlost absorbce sacharidů</string>
<string name="danarprofile_dia">Rychlost inzulínu[h]</string>
<string name="failedupdatebasalprofile">Chyba při nastavení dočasného bazálu</string>
<string name="danar_alarm">alarm</string>
<string name="danar_basalhour">hodinový bazál</string>
<string name="danar_carbohydrate">sacharidy</string>
<string name="danar_debolus">DE bolus</string>
<string name="danar_dsbolus">DS bolus</string>
<string name="danar_ebolus">E bolus</string>
<string name="danar_error">chyba</string>
<string name="danar_glucose">glykémie</string>
<string name="danar_history">Historie</string>
<string name="danar_history_alarm">Alarmy</string>
<string name="danar_history_basalhours">Hodinvé bazály</string>
<string name="danar_history_bolus">Bolusy</string>
<string name="danar_history_carbohydrates">Sacharidy</string>
<string name="danar_history_connectingfor" formatted="false">Připojování %d sec</string>
<string name="danar_history_dailyinsulin">Denní inzulín</string>
<string name="danar_history_errors">Chyby</string>
<string name="danar_history_glucose">Glykémie</string>
<string name="danar_history_refill">Plnění</string>
<string name="danar_history_syspend">Vypnutí</string>
<string name="danar_historyreload">Načíst</string>
<string name="danar_refill">plnění</string>
<string name="danar_sbolus">S bolus</string>
<string name="danar_totaluploaded" formatted="false">Celkem nahráno %d záznamů</string>
<string name="uploading">Nahrávám</string>
</resources>

View file

@ -263,5 +263,27 @@
<string name="failedupdatebasalprofile">Failed to update basal profile</string>
<string name="danar_history">History</string>
<string name="danar_historyreload">Reload</string>
<string name="uploading">Uploading</string>
<string name="danar_ebolus">E bolus</string>
<string name="danar_dsbolus">DS bolus</string>
<string name="danar_debolus">DE bolus</string>
<string name="danar_error">error</string>
<string name="danar_refill">refill</string>
<string name="danar_basalhour">basal hour</string>
<string name="danar_glucose">glucose</string>
<string name="danar_carbohydrate">carbohydrate</string>
<string name="danar_alarm">alarm</string>
<string name="danar_totaluploaded" formatted="false">Total %d records uploaded</string>
<string name="danar_sbolus">S bolus</string>
<string name="danar_history_alarm">Alarms</string>
<string name="danar_history_basalhours">Basal Hours</string>
<string name="danar_history_bolus">Boluses</string>
<string name="danar_history_carbohydrates">Carbohydrates</string>
<string name="danar_history_dailyinsulin">Daily insulin</string>
<string name="danar_history_errors">Errors</string>
<string name="danar_history_glucose">Glucose</string>
<string name="danar_history_refill">Refill</string>
<string name="danar_history_syspend">Suspend</string>
<string name="danar_history_connectingfor" formatted="false">Connecting for %d s</string>
</resources>