Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

Commit

Permalink
Updated AppGlance text
Browse files Browse the repository at this point in the history
The AppGlance text now takes into account whether minutes should be singular or plural. Little things matter!
  • Loading branch information
aaronhktan committed Nov 18, 2016
1 parent 076354f commit b5cd3d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
27 changes: 19 additions & 8 deletions src/c/localize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!";
}
}
}

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/c/localize.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b5cd3d2

Please sign in to comment.