diff options
author | Örn Arnarson <orn@arnarson.net> | 2016-06-06 16:13:01 +0000 |
---|---|---|
committer | Örn Arnarson <orn@arnarson.net> | 2016-06-07 11:36:48 +0000 |
commit | 60caebc738d96c092ca1f1f51881ed41e4a52192 (patch) | |
tree | de6f837c6b1ffc957c2489e28b72bc27ae47528f /apps | |
parent | 3e8d523d889351c69b21fdc563cb98d18a7bdb66 (diff) |
apps/app_voicemail.c and main/say.c: Add support for Icelandic language
Icelandic has some weird grammar rules when dealing with dates and
numbers. There are different genders used depending on which number
you're dealing with, and only a handful of numbers do change depending
on the gender. There is also an implied gender in several cases.
This patch was originally written for asterisk 1.6, and has been in use
for several years without crashes. I cleaned it up a bit and rewrote
what was necessary for Asterisk 13.
The functions were copied from other similar languages and modified
where appropriate. If i recall correctly, the German and Danish
functions were used as a base.
ASTERISK-26087
Reported by: Örn Arnarson
Tested by: Örn Arnarson
Change-Id: Ib7d8bd7b0fede5767921ed821315b5b508c0e665
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 1d5b2dcb3..586086c55 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -8527,6 +8527,8 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' Q 'digits/at' HM", NULL); } else if (!strncasecmp(ast_channel_language(chan), "gr", 2)) { /* GREEK syntax */ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' q H 'digits/kai' M ", NULL); + } else if (!strncasecmp(ast_channel_language(chan), "is", 2)) { /* ICELANDIC syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' Q 'digits/at' HM", NULL); } else if (!strncasecmp(ast_channel_language(chan), "it", 2)) { /* ITALIAN syntax */ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL); } else if (!strcasecmp(ast_channel_language(chan),"ja")) { /* Japanese syntax */ @@ -8753,6 +8755,12 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc res = wait_file2(chan, vms, "vm-number"); res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, ast_channel_language(chan), "f"); } + /* ICELANDIC syntax */ + } else if (!strncasecmp(ast_channel_language(chan), "is", 2)) { + res = wait_file2(chan, vms, "vm-message"); + if (vms->curmsg && (vms->curmsg != vms->lastmsg)) { + res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, ast_channel_language(chan), "n"); + } /* VIETNAMESE syntax */ } else if (!strncasecmp(ast_channel_language(chan), "vi", 2)) { if (!vms->curmsg) { @@ -9492,6 +9500,75 @@ static int vm_intro_en(struct ast_channel *chan, struct vm_state *vms) return res; } +/* ICELANDIC syntax */ +static int vm_intro_is(struct ast_channel *chan, struct vm_state *vms) +{ + int res; + + /* Introduce messages they have */ + res = ast_play_and_wait(chan, "vm-youhave"); + if (!res) { + if (vms->urgentmessages) { + /* Digits 1-4 are spoken in neutral and plural when talking about messages, + however, feminine is used for 1 as it is the same as the neutral for plural, + and singular neutral is the same after 1. */ + if (vms->urgentmessages < 5) { + char recname[16]; + if (vms->urgentmessages == 1) + snprintf(recname, sizeof(recname), "digits/1kvk"); + else + snprintf(recname, sizeof(recname), "digits/%dhk", vms->urgentmessages); + res = ast_play_and_wait(chan, recname); + } else if (!res) + res = ast_play_and_wait(chan, "vm-Urgent"); + if ((vms->oldmessages || vms->newmessages) && !res) { + res = ast_play_and_wait(chan, "vm-and"); + } else if (!res) + res = ast_play_and_wait(chan, "vm-messages"); + } + if (vms->newmessages) { + if (vms->newmessages < 5) { + char recname[16]; + if (vms->newmessages == 1) + snprintf(recname, sizeof(recname), "digits/1kvk"); + else + snprintf(recname, sizeof(recname), "digits/%dhk", vms->newmessages); + res = ast_play_and_wait(chan, recname); + } else + res = say_and_wait(chan, vms->newmessages, ast_channel_language(chan)); + if (!res) + res = ast_play_and_wait(chan, "vm-INBOX"); + if (vms->oldmessages && !res) + res = ast_play_and_wait(chan, "vm-and"); + else if (!res) + res = ast_play_and_wait(chan, "vm-messages"); + } + if (!res && vms->oldmessages) { + if (vms->oldmessages < 5) { + char recname[16]; + if (vms->oldmessages == 1) + snprintf(recname, sizeof(recname), "digits/1kvk"); + else + snprintf(recname, sizeof(recname), "digits/%dhk", vms->oldmessages); + res = ast_play_and_wait(chan, recname); + } else + res = say_and_wait(chan, vms->oldmessages, ast_channel_language(chan)); + if (!res) + res = ast_play_and_wait(chan, "vm-Old"); + if (!res) + res = ast_play_and_wait(chan, "vm-messages"); + } + if (!res) { + if (!vms->urgentmessages && !vms->oldmessages && !vms->newmessages) { + res = ast_play_and_wait(chan, "vm-no"); + if (!res) + res = ast_play_and_wait(chan, "vm-messages"); + } + } + } + return res; +} + /* ITALIAN syntax */ static int vm_intro_it(struct ast_channel *chan, struct vm_state *vms) { @@ -10156,6 +10233,8 @@ static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm return vm_intro_gr(chan, vms); } else if (!strncasecmp(ast_channel_language(chan), "he", 2)) { /* HEBREW syntax */ return vm_intro_he(chan, vms); + } else if (!strncasecmp(ast_channel_language(chan), "is", 2)) { /* ICELANDIC syntax */ + return vm_intro_is(chan, vms); } else if (!strncasecmp(ast_channel_language(chan), "it", 2)) { /* ITALIAN syntax */ return vm_intro_it(chan, vms); } else if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* JAPANESE syntax */ |