]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Backport Hebrew language to voicemail.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 25 Sep 2008 01:44:47 +0000 (01:44 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 25 Sep 2008 01:44:47 +0000 (01:44 +0000)
(closes issue #13155)
 Reported by: greenfieldtech
 Patches:
       voicemail-hebrew-patch-1.4-SVN.c.patch uploaded by greenfieldtech (license 369)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@144356 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index ae8f13d25e5ed869c19bc14e4e67c94dcfd5e44e..c029020182e2d22bd936abb1f1b336983f59e924 100644 (file)
@@ -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)