From fead32cb8dd6e980a4521758cb47701c97b9c8c3 Mon Sep 17 00:00:00 2001 From: Markus Braun Date: Mon, 14 Oct 2002 14:59:24 +0000 Subject: i18n of time/date setting menu git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2626 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++ apps/settings.c | 50 +++++++++++++++++++------- 2 files changed, 132 insertions(+), 13 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 846edde24a..a50b7c0b64 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -915,3 +915,98 @@ id: LANG_24_HOUR_CLOCK desc: option for 24 hour clock eng: "24 hour clock" new: + +id: LANG_WEEKDAY_SUNDAY +desc: abbreviation for weekday +eng: "Sun" +new: + +id: LANG_WEEKDAY_MONDAY +desc: abbreviation for weekday +eng: "Mon" +new: + +id: LANG_WEEKDAY_TUESDAY +desc: abbreviation for weekday +eng: "Tue" +new: + +id: LANG_WEEKDAY_WEDNESDAY +desc: abbreviation for weekday +eng: "Wed" +new: + +id: LANF_WEEKDAY_THURSDAY +desc: abbreviation for weekday +eng: "Thu" +new: + +id: LANG_WEEKDAY_FRIDAY +desc: abbreviation for weekday +eng: "Fri" +new: + +id: LANG_WEEKDAY_SATURDAY +desc: abbreviation for weekday +eng: "Sat" +new: + +id: LANG_MONTH_JANUARY +desc: abbreviation for monthname +eng: "Jan" +new: + +id: LANG_MONTH_FEBRUARY +desc: abbreviation for monthname +eng: "Feb" +new: + +id: LANG_MONTH_MARCH +desc: abbreviation for monthname +eng: "Mar" +new: + +id: LANG_MONTH_APRIL +desc: abbreviation for monthname +eng: "Apr" +new: + +id: LANG_MONTH_MAY +desc: abbreviation for monthname +eng: "May" +new: + +id: LANG_MONTH_JUNE +desc: abbreviation for monthname +eng: "Jun" +new: + +id: LANG_MONTH_JULY +desc: abbreviation for monthname +eng: "Jul" +new: + +id: LANG_MONTH_AUGUST +desc: abbreviation for monthname +eng: "Aug" +new: + +id: LANG_MONTH_SEPTEMBER +desc: abbreviation for monthname +eng: "Sep" +new: + +id: LANG_MONTH_OCTOBER +desc: abbreviation for monthname +eng: "Oct" +new: + +id: LANG_MONTH_NOVEMBER +desc: abbreviation for monthname +eng: "Nov" +new: + +id: LANG_MONTH_DECEMBER +desc: abbreviation for monthname +eng: "Dec" +new: diff --git a/apps/settings.c b/apps/settings.c index 3dafebc368..6c0b21d088 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -881,13 +881,6 @@ bool set_option(char* string, int* variable, char* options[], #define INDEX_X 0 #define INDEX_Y 1 #define INDEX_WIDTH 2 -char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; -char *monthname[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; -char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, - {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; -char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - bool set_time(char* string, int timedate[]) { bool done = false; @@ -903,6 +896,29 @@ bool set_time(char* string, int timedate[]) unsigned int width, height; unsigned int separator_width, weekday_width; unsigned int line_height, prev_line_height; + char *dayname[] = {str(LANG_WEEKDAY_SUNDAY), + str(LANG_WEEKDAY_MONDAY), + str(LANG_WEEKDAY_TUESDAY), + str(LANG_WEEKDAY_WEDNESDAY), + str(LANF_WEEKDAY_THURSDAY), + str(LANG_WEEKDAY_FRIDAY), + str(LANG_WEEKDAY_SATURDAY)}; + char *monthname[] = {str(LANG_MONTH_JANUARY), + str(LANG_MONTH_FEBRUARY), + str(LANG_MONTH_MARCH), + str(LANG_MONTH_APRIL), + str(LANG_MONTH_MAY), + str(LANG_MONTH_JUNE), + str(LANG_MONTH_JULY), + str(LANG_MONTH_AUGUST), + str(LANG_MONTH_SEPTEMBER), + str(LANG_MONTH_OCTOBER), + str(LANG_MONTH_NOVEMBER), + str(LANG_MONTH_DECEMBER)}; + char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, + {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; + char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + #ifdef HAVE_LCD_BITMAP if(global_settings.statusbar) @@ -945,6 +961,7 @@ bool set_time(char* string, int timedate[]) lcd_getstringsize(buffer, &width, &line_height); lcd_getstringsize(":", &separator_width, &height); + /* hour */ strncpy(reffub, buffer, 2); reffub[2] = '\0'; lcd_getstringsize(reffub, &width, &height); @@ -952,6 +969,7 @@ bool set_time(char* string, int timedate[]) cursor[0][INDEX_Y] = prev_line_height; cursor[0][INDEX_WIDTH] = width; + /* minute */ strncpy(reffub, buffer + 3, 2); reffub[2] = '\0'; lcd_getstringsize(reffub, &width, &height); @@ -959,6 +977,7 @@ bool set_time(char* string, int timedate[]) cursor[1][INDEX_Y] = prev_line_height; cursor[1][INDEX_WIDTH] = width; + /* second */ strncpy(reffub, buffer + 6, 2); reffub[2] = '\0'; lcd_getstringsize(reffub, &width, &height); @@ -978,27 +997,32 @@ bool set_time(char* string, int timedate[]) /* recalculate the positions and offsets */ lcd_getstringsize(buffer, &width, &line_height); - strncpy(reffub, buffer, 3); - reffub[3] = '\0'; + + /* weekday */ + strncpy(reffub, buffer, strlen(dayname[timedate[6]])); + reffub[strlen(dayname[timedate[6]])] = '\0'; lcd_getstringsize(reffub, &weekday_width, &height); lcd_getstringsize(" ", &separator_width, &height); - strncpy(reffub, buffer + 4, 4); + /* year */ + strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 1, 4); reffub[4] = '\0'; lcd_getstringsize(reffub, &width, &height); cursor[3][INDEX_X] = weekday_width + separator_width; cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; cursor[3][INDEX_WIDTH] = width; - strncpy(reffub, buffer + 9, 3); - reffub[3] = '\0'; + /* month */ + strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 6, strlen(monthname[timedate[4] - 1])); + reffub[strlen(monthname[timedate[4] - 1])] = '\0'; lcd_getstringsize(reffub, &width, &height); cursor[4][INDEX_X] = weekday_width + separator_width + cursor[3][INDEX_WIDTH] + separator_width; cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; cursor[4][INDEX_WIDTH] = width; - strncpy(reffub, buffer + 13, 2); + /* day */ + strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + strlen(monthname[timedate[4] - 1]) + 7, 2); reffub[2] = '\0'; lcd_getstringsize(reffub, &width, &height); cursor[5][INDEX_X] = weekday_width + separator_width + -- cgit v1.2.3