[asterisk-commits] tilghman: branch 1.4 r144356 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 24 20:44:48 CDT 2008


Author: tilghman
Date: Wed Sep 24 20:44:47 2008
New Revision: 144356

URL: http://svn.digium.com/view/asterisk?view=rev&rev=144356
Log:
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)

Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=144356&r1=144355&r2=144356
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Wed Sep 24 20:44:47 2008
@@ -249,6 +249,7 @@
 	\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)
@@ -305,6 +306,12 @@
 \arg \b vm-nuovi	new plural
 \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
@@ -5169,6 +5176,8 @@
 		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 @@
 	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 @@
 		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 */
@@ -5674,6 +5709,74 @@
 	}
 	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 @@
 		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 @@
 		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 @@
 	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 @@
 		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 @@
 		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)




More information about the asterisk-commits mailing list