aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-25 01:44:47 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-25 01:44:47 +0000
commit4a6f2ba41424e9d11c3ae802138a594aac23304e (patch)
treed3258e969afc950b01fe35fc216efb7b15f31693 /apps/app_voicemail.c
parent889753379e80c7ab4a257be214a1ac6a6b9d06bf (diff)
Backport Hebrew language to voicemail.
(closes issue #13155) Reported by: greenfieldtech Patches: voicemail-hebrew-patch-1.4-SVN.c.patch uploaded by greenfieldtech (license 369) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@144356 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c137
1 files changed, 133 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index ae8f13d25..c02902018 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -249,6 +249,7 @@ static int load_config(void);
\arg \b no - Norwegian
\arg \b se - Swedish
\arg \b ua - Ukrainian
+ \arg \b he - Hebrew
German requires the following additional soundfile:
\arg \b 1F einE (feminine)
@@ -306,6 +307,12 @@ For vm_intro_it:
\arg \b vm-vecchio old
\arg \b vm-vecchi old plural
+Hebrew also uses:
+\arg \b vm-INBOX1 '1 new message'
+\arg \b vm-OLD1 '1 old message'
+\arg \b vm-shtei 'shtei'
+\arg \b vm-nomessages 'you have no new messages'
+
\note Don't use vm-INBOX or vm-Old, because they are the name of the INBOX and Old folders,
spelled among others when you have to change folder. For the above reasons, vm-INBOX
and vm-Old are spelled plural, to make them sound more as folder name than an adjective.
@@ -5169,6 +5176,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, chan->language, "'vm-received' q H 'digits/kai' M ", NULL);
else if (!strcasecmp(chan->language,"pt_BR"))
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL);
+ else if (!strcasecmp(chan->language,"he"))
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'at2' kM", NULL);
else
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
#if 0
@@ -5307,10 +5316,33 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
vms->starting = 0;
make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg);
adsi_message(chan, vms);
- if (!vms->curmsg)
- res = wait_file2(chan, vms, "vm-first"); /* "First" */
- else if (vms->curmsg == vms->lastmsg)
- res = wait_file2(chan, vms, "vm-last"); /* "last" */
+ if (!strcasecmp(chan->language, "he")) { /* HEBREW FORMAT */
+ /*
+ * The syntax in hebrew for counting the number of message is up side down
+ * in comparison to english.
+ */
+ if (!vms->curmsg) {
+ res = wait_file2(chan, vms, "vm-message");
+ res = wait_file2(chan, vms, "vm-first"); /* "First" */
+ } else if (vms->curmsg == vms->lastmsg) {
+ res = wait_file2(chan, vms, "vm-message");
+ res = wait_file2(chan, vms, "vm-last"); /* "last" */
+ } else {
+ res = wait_file2(chan, vms, "vm-message"); /* "message" */
+ if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+ ast_log(LOG_DEBUG, "curmsg: %d\n", vms->curmsg);
+ ast_log(LOG_DEBUG, "lagmsg: %d\n", vms->lastmsg);
+ if (!res) {
+ res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, "f");
+ }
+ }
+ }
+ } else {
+ if (!vms->curmsg)
+ res = wait_file2(chan, vms, "vm-first"); /* "First" */
+ else if (vms->curmsg == vms->lastmsg)
+ res = wait_file2(chan, vms, "vm-last"); /* "last" */
+ }
if (!res) {
/* POLISH syntax */
if (!strcasecmp(chan->language, "pl")) {
@@ -5576,6 +5608,9 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
return vm_play_folder_name_pl(chan, mbox);
} else if (!strcasecmp(chan->language, "ua")){ /* Ukrainian syntax */
return vm_play_folder_name_ua(chan, mbox);
+ } else if (!strcasecmp(chan->language, "he")){ /* Hebrew syntax */
+ cmd = ast_play_and_wait(chan, mbox);
+ return cmd;
} else { /* Default English */
cmd = ast_play_and_wait(chan, mbox);
return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages */
@@ -5675,6 +5710,74 @@ static int vm_intro_en(struct ast_channel *chan, struct vm_state *vms)
return res;
}
+/* Default Hebrew syntax */
+static int vm_intro_he(struct ast_channel *chan, struct vm_state *vms)
+{
+ int res=0;
+
+ /* Introduce messages they have */
+ if (!res) {
+ if ((vms->newmessages) || (vms->oldmessages)) {
+ res = ast_play_and_wait(chan, "vm-youhave");
+ }
+ /*
+ * The word "shtei" refers to the number 2 in hebrew when performing a count
+ * of elements. In Hebrew, there are 6 forms of enumerating the number 2 for
+ * an element, this is one of them.
+ */
+ if (vms->newmessages) {
+ if (!res) {
+ if (vms->newmessages == 1) {
+ res = ast_play_and_wait(chan, "vm-INBOX1");
+ } else {
+ if (vms->newmessages == 2) {
+ res = ast_play_and_wait(chan, "vm-shtei");
+ } else {
+ res = ast_say_number(chan, vms->newmessages, AST_DIGIT_ANY, chan->language, "f");
+ }
+ res = ast_play_and_wait(chan, "vm-INBOX");
+ }
+ }
+ if (vms->oldmessages && !res) {
+ res = ast_play_and_wait(chan, "vm-and");
+ if (vms->oldmessages == 1) {
+ res = ast_play_and_wait(chan, "vm-Old1");
+ } else {
+ if (vms->oldmessages == 2) {
+ res = ast_play_and_wait(chan, "vm-shtei");
+ } else {
+ res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f");
+ }
+ res = ast_play_and_wait(chan, "vm-Old");
+ }
+ }
+ }
+ if (!res && vms->oldmessages && !vms->newmessages) {
+ if (!res) {
+ if (vms->oldmessages == 1) {
+ res = ast_play_and_wait(chan, "vm-Old1");
+ } else {
+ if (vms->oldmessages == 2) {
+ res = ast_play_and_wait(chan, "vm-shtei");
+ } else {
+ res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f");
+ }
+ res = ast_play_and_wait(chan, "vm-Old");
+ }
+ }
+ }
+ if (!res) {
+ if (!vms->oldmessages && !vms->newmessages) {
+ if (!res) {
+ res = ast_play_and_wait(chan, "vm-nomessages");
+ }
+ }
+ }
+ }
+ return res;
+}
+
+
/* ITALIAN syntax */
static int vm_intro_it(struct ast_channel *chan, struct vm_state *vms)
{
@@ -6422,6 +6525,8 @@ static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm
return vm_intro_ru(chan, vms);
} else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */
return vm_intro_ua(chan, vms);
+ } else if (!strcasecmp(chan->language, "he")) { /* HEBREW syntax */
+ return vm_intro_he(chan, vms);
} else { /* Default to ENGLISH */
return vm_intro_en(chan, vms);
}
@@ -6435,6 +6540,8 @@ static int vm_instructions(struct ast_channel *chan, struct vm_state *vms, int s
if (vms->starting) {
if (vms->lastmsg > -1) {
res = ast_play_and_wait(chan, "vm-onefor");
+ if (!strcasecmp(chan->language, "he"))
+ res = ast_play_and_wait(chan, "vm-for");
if (!res)
res = vm_play_folder_name(chan, vms->vmbox);
}
@@ -6777,6 +6884,24 @@ static int vm_browse_messages_en(struct ast_channel *chan, struct vm_state *vms,
return cmd;
}
+/* Hebrew Syntax */
+static int vm_browse_messages_he(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
+{
+ int cmd = 0;
+
+ if (vms->lastmsg > -1) {
+ cmd = play_message(chan, vmu, vms);
+ } else {
+ if (!strcasecmp(vms->fn, "INBOX")) {
+ cmd = ast_play_and_wait(chan, "vm-nonewmessages");
+ } else {
+ cmd = ast_play_and_wait(chan, "vm-nomessages");
+ }
+ }
+ return cmd;
+}
+
+
/* ITALIAN syntax */
static int vm_browse_messages_it(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
{
@@ -6844,6 +6969,8 @@ static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, st
return vm_browse_messages_pt(chan, vms, vmu);
} else if (!strcasecmp(chan->language, "gr")){
return vm_browse_messages_gr(chan, vms, vmu); /* GREEK */
+ } else if (!strcasecmp(chan->language, "he")) {
+ return vm_browse_messages_he(chan, vms, vmu); /* HEBREW */
} else { /* Default to English syntax */
return vm_browse_messages_en(chan, vms, vmu);
}
@@ -7439,6 +7566,8 @@ static int vm_execmain(struct ast_channel *chan, void *data)
case '*':
if (!vms.starting) {
cmd = ast_play_and_wait(chan, "vm-onefor");
+ if (!strcasecmp(chan->language, "he"))
+ cmd = ast_play_and_wait(chan, "vm-for");
if (!cmd)
cmd = vm_play_folder_name(chan, vms.vmbox);
if (!cmd)