From b5cd3d23a09784fad9a62d30219827dd1213aa14 Mon Sep 17 00:00:00 2001 From: Aaron Tan Date: Fri, 18 Nov 2016 01:48:05 -0500 Subject: [PATCH] Updated AppGlance text The AppGlance text now takes into account whether minutes should be singular or plural. Little things matter! --- src/c/localize.c | 27 +++++++++++++++++++-------- src/c/localize.h | 2 +- src/c/main.c | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/c/localize.c b/src/c/localize.c index 86f3b1a..cc10a7d 100644 --- a/src/c/localize.c +++ b/src/c/localize.c @@ -5,13 +5,24 @@ const char * localize_get_locale() { return i18n_get_system_locale(); } -char * localize_get_app_glance_text() { - if (strncmp(localize_get_locale(), "fr", 2) == 0) { - return "La journée plus récente: %d minutes. Respirez maintenant!"; - } else if (strncmp(localize_get_locale(), "es", 2) == 0) { - return "El día más reciente: %d minutos. ¡Respira ahora!"; - } else { - return "Most recent day: %d minutes. Breathe now!"; +char * localize_get_app_glance_text(int minutes) { + switch (minutes) { + case 1: + if (strncmp(localize_get_locale(), "fr", 2) == 0) { + return "La journée plus récente: %d minute. Respirez maintenant!"; + } else if (strncmp(localize_get_locale(), "es", 2) == 0) { + return "El día más reciente: %d minuto. ¡Respira ahora!"; + } else { + return "Most recent day: %d minute. Breathe now!"; + } + default: + if (strncmp(localize_get_locale(), "fr", 2) == 0) { + return "La journée plus récente: %d minutes. Respirez maintenant!"; + } else if (strncmp(localize_get_locale(), "es", 2) == 0) { + return "El día más reciente: %d minutos. ¡Respira ahora!"; + } else { + return "Most recent day: %d minutes. Breathe now!"; + } } } @@ -37,7 +48,7 @@ char * localize_get_well_done_text() { char * localize_get_inhale_text() { if (strncmp(localize_get_locale(), "fr", 2) == 0) { - return "INHALEZ"; + return "INHALEZ..."; } else if (strncmp(localize_get_locale(), "es", 2) == 0) { return "AHORA INHALA..."; } else { diff --git a/src/c/localize.h b/src/c/localize.h index 5cad7f7..8dfa776 100644 --- a/src/c/localize.h +++ b/src/c/localize.h @@ -2,7 +2,7 @@ const char * localize_get_locale(); -char * localize_get_app_glance_text(); +char * localize_get_app_glance_text(int minutes); char * localize_get_breathe_text(); char * localize_get_well_done_text(); char * localize_get_inhale_text(); diff --git a/src/c/main.c b/src/c/main.c index 0b4931d..a51d2c5 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -47,7 +47,7 @@ static void deinit() { health_service_set_heart_rate_sample_period(0); // Reset heart rate sample period to default as to not waste too much battery #endif char app_glance_text[79]; - snprintf(app_glance_text, sizeof(app_glance_text), localize_get_app_glance_text(), data_read_breathe_persist_data()); + snprintf(app_glance_text, sizeof(app_glance_text), localize_get_app_glance_text(data_read_breathe_persist_data()), data_read_breathe_persist_data()); app_glance_reload(appglance_update_app_glance, app_glance_text); // Reload app glance }