diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-25 19:26:50 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-25 19:26:50 +0000 |
commit | a5dfafd95a5527a0b4d23c19c21ba98a0439a236 (patch) | |
tree | 68fd793f8aefe85a9fd29b9595fa7854b16c43a8 | |
parent | 8c3baac9863349beeb25d3d854da64c41330975c (diff) |
Fix pronunciation of German dates.
(closes issue #15273)
Reported by: Benjamin Kluck
Patches:
say_c.patch uploaded by Benjamin Kluck (license 803)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@214068 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | main/say.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/main/say.c b/main/say.c index d1ec35cfb..b3c315e4d 100644 --- a/main/say.c +++ b/main/say.c @@ -3570,14 +3570,14 @@ int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const cha /* FALLTRHU */ case 'k': /* 24-Hour */ - res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL); + res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL); break; case 'M': /* Minute */ - if (tm.tm_min > 0 || format[offset+ 1 ] == 'S' ) { /* zero 'digits/0' only if seconds follow (kind of a hack) */ - res = ast_say_number(chan, tm.tm_min, ints, lang, "f"); + if (tm.tm_min > 0 || next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */ + res = ast_say_number(chan, tm.tm_min, ints, lang, "f"); } - if ( !res && format[offset + 1] == 'S' ) { /* minutes only if seconds follow (kind of a hack) */ + if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */ if (tm.tm_min == 1) { res = wait_file(chan,ints,"digits/minute",lang); } else { @@ -3682,6 +3682,12 @@ int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const cha return res; } +char next_item(const char *format) +{ + const char *next = ast_skip_blanks(format); + return *next; +} + /* German syntax */ int ast_say_date_with_format_de(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone) { @@ -3777,10 +3783,13 @@ int ast_say_date_with_format_de(struct ast_channel *chan, time_t time, const cha break; case 'M': /* Minute */ - if (tm.tm_min > 0 || format[offset+ 1 ] == 'S' ) { /* zero 'digits/0' only if seconds follow (kind of a hack) */ - res = ast_say_number(chan, tm.tm_min, ints, lang, "f"); + if (next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */ + res = ast_say_number(chan, tm.tm_min, ints, lang, "f"); /* female only if we say digits/minutes */ + } else if (tm.tm_min > 0) { + res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL); } - if ( !res && format[offset + 1] == 'S' ) { /* minutes only if seconds follow (kind of a hack) */ + + if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */ if (tm.tm_min == 1) { res = wait_file(chan,ints,"digits/minute",lang); } else { @@ -3862,7 +3871,7 @@ int ast_say_date_with_format_de(struct ast_channel *chan, time_t time, const cha if (!res) { res = ast_say_number(chan, tm.tm_sec, ints, lang, "f"); if (!res) { - res = wait_file(chan,ints, "digits/seconds",lang); + res = wait_file(chan, ints, tm.tm_sec == 1 ? "digits/second" : "digits/seconds", lang); } } break; |