[asterisk-commits] tilghman: branch 1.6.0 r204581 - in /branches/1.6.0: ./ UPGRADE.txt main/say.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 30 16:21:48 CDT 2009


Author: tilghman
Date: Tue Jun 30 16:21:43 2009
New Revision: 204581

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204581
Log:
Merged revisions 204563 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r204563 | tilghman | 2009-06-30 15:41:04 -0500 (Tue, 30 Jun 2009) | 13 lines
  
  Merged revisions 204556 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r204556 | tilghman | 2009-06-30 15:23:51 -0500 (Tue, 30 Jun 2009) | 6 lines
    
    More incorrect language codes, plus ensuring that regionalizations use the specified language, and not English for grammar.
    (closes issue #15022)
     Reported by: greenfieldtech
     Patches: 
           20090519__issue15022.diff.txt uploaded by tilghman (license 14)
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/UPGRADE.txt
    branches/1.6.0/main/say.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/UPGRADE.txt
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/UPGRADE.txt?view=diff&rev=204581&r1=204580&r2=204581
==============================================================================
--- branches/1.6.0/UPGRADE.txt (original)
+++ branches/1.6.0/UPGRADE.txt Tue Jun 30 16:21:43 2009
@@ -24,7 +24,9 @@
   In reality, the "tw" language code is reserved for the Twi language, native
   to Ghana.  If you were previously using the "tw" language code, you should
   switch to using either "zh" (for Mandarin Chinese) or "zh_TW" for Taiwan
-  specific localizations.
+  specific localizations.  Additionally, "mx" should be changed to "es_MX",
+  Georgian was incorrectly specified as "ge" but should be "ka", and Czech is
+  "cs", not "cz".
 
 From 1.6.0.1 to 1.6.0.2:
 

Modified: branches/1.6.0/main/say.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/main/say.c?view=diff&rev=204581&r1=204580&r2=204581
==============================================================================
--- branches/1.6.0/main/say.c (original)
+++ branches/1.6.0/main/say.c Tue Jun 30 16:21:43 2009
@@ -288,9 +288,9 @@
       \arg \b pt    - Portuguese
       \arg \b pt_BR - Portuguese (Brazil)
       \arg \b se    - Swedish
-      \arg \b tw    - Taiwanese / Chinese
+      \arg \b zh    - Taiwanese / Chinese
       \arg \b ru    - Russian
-      \arg \b ge    - Georgian
+      \arg \b ka    - Georgian
       \arg \b hu    - Hungarian
 
  \par Gender:
@@ -330,7 +330,7 @@
 
 /* Forward declarations of language specific variants of ast_say_number_full */
 static int ast_say_number_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
-static int ast_say_number_full_cz(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
+static int ast_say_number_full_cs(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
 static int ast_say_number_full_da(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
 static int ast_say_number_full_de(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
 static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
@@ -346,7 +346,7 @@
 static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
 static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
 static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
-static int ast_say_number_full_ge(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
+static int ast_say_number_full_ka(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
 static int ast_say_number_full_hu(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
 static int ast_say_number_full_th(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
 
@@ -364,7 +364,7 @@
 static int ast_say_date_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
-static int ast_say_date_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_date_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
@@ -391,7 +391,7 @@
 static int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
-static int ast_say_time_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_time_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
@@ -404,7 +404,7 @@
 static int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
-static int ast_say_datetime_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_datetime_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
@@ -412,7 +412,7 @@
 static int ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_from_now_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
-static int ast_say_datetime_from_now_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_datetime_from_now_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_from_now_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
 static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang) 
@@ -429,50 +429,48 @@
 /* Called from AGI */
 static int say_number_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 {
-	if (!strcasecmp(language, "en") ) {	/* English syntax */
-	   return(ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "cz") ) {	/* Czech syntax */
-	   return(ast_say_number_full_cz(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "da") ) {	/* Danish syntax */
-	   return(ast_say_number_full_da(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "de") ) {	/* German syntax */
-	   return(ast_say_number_full_de(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "en_GB") ) {	/* British syntax */
-	   return(ast_say_number_full_en_GB(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "no") ) {	/* Norwegian syntax */
-	   return(ast_say_number_full_no(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "es") || !strcasecmp(language, "mx")) {	/* Spanish syntax */
-	   return(ast_say_number_full_es(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "fr") ) {	/* French syntax */
-	   return(ast_say_number_full_fr(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "he") ) {	/* Hebrew syntax */
-	   return(ast_say_number_full_he(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "hu") ) {	/* Hungarian syntax */
-	   return(ast_say_number_full_hu(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "it") ) {	/* Italian syntax */
-	   return(ast_say_number_full_it(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "nl") ) {	/* Dutch syntax */
-	   return(ast_say_number_full_nl(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "pl") ) {	/* Polish syntax */
-	   return(ast_say_number_full_pl(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "pt") || !strcasecmp(language, "pt_BR")) {	/* Portuguese syntax */
-	   return(ast_say_number_full_pt(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "se") ) {	/* Swedish syntax */
-	   return(ast_say_number_full_se(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strncasecmp(language, "zh", 2) ) {	/* Taiwanese / Chinese syntax */
-	   return(ast_say_number_full_zh(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "gr") ) {	/* Greek syntax */
-	   return(ast_say_number_full_gr(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "ru") ) {	/* Russian syntax */
-	   return(ast_say_number_full_ru(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "th") ) {	/* Thai syntax */
-	   return(ast_say_number_full_th(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "ge") ) {	/* Georgian syntax */
-	   return(ast_say_number_full_ge(chan, num, ints, language, options, audiofd, ctrlfd));
+	if (!strncasecmp(language, "en_GB", 5)) {     /* British syntax */
+	   return ast_say_number_full_en_GB(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "en", 2)) { /* English syntax */
+	   return ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "cs", 2)) { /* Czech syntax */
+	   return ast_say_number_full_cs(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "da", 2)) { /* Danish syntax */
+	   return ast_say_number_full_da(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "de", 2)) { /* German syntax */
+	   return ast_say_number_full_de(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "es", 2)) { /* Spanish syntax */
+	   return ast_say_number_full_es(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "fr", 2)) { /* French syntax */
+	   return ast_say_number_full_fr(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "gr", 2)) { /* Greek syntax */
+	   return ast_say_number_full_gr(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "he", 2)) { /* Hebrew syntax */
+	   return ast_say_number_full_he(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "it", 2)) { /* Italian syntax */
+	   return ast_say_number_full_it(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "ka", 2)) { /* Georgian syntax */
+	   return ast_say_number_full_ka(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "nl", 2)) { /* Dutch syntax */
+	   return ast_say_number_full_nl(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "no", 2)) { /* Norwegian syntax */
+	   return ast_say_number_full_no(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "pl", 2)) { /* Polish syntax */
+	   return ast_say_number_full_pl(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "pt", 2)) { /* Portuguese syntax */
+	   return ast_say_number_full_pt(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "ru", 2)) { /* Russian syntax */
+	   return ast_say_number_full_ru(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "se", 2)) { /* Swedish syntax */
+	   return ast_say_number_full_se(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "th", 2)) { /* Thai syntax */
+		return ast_say_number_full_th(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "zh", 2)) { /* Taiwanese / Chinese syntax */
+	   return ast_say_number_full_zh(chan, num, ints, language, audiofd, ctrlfd);
 	}
 
 	/* Default to english */
-	return(ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd));
+	return ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd);
 }
 
 /*! \brief  ast_say_number_full_en: English syntax */
@@ -549,7 +547,7 @@
 	return res;
 }
 
-/*! \brief  ast_say_number_full_cz: Czech syntax */
+/*! \brief  ast_say_number_full_cs: Czech syntax */
 /* files needed:
  * 1m,2m - gender male
  * 1w,2w - gender female
@@ -570,7 +568,7 @@
  * tousand, milion are  gender male, so 1 and 2 is 1m 2m
  * miliard is gender female, so 1 and 2 is 1w 2w
  */
-static int ast_say_number_full_cz(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
+static int ast_say_number_full_cs(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 {
 	int res = 0;
 	int playh = 0;
@@ -613,7 +611,7 @@
 			} else if ( hundered == 2 ) {
 				ast_copy_string(fn, "digits/2ste", sizeof(fn));
 			} else {
-					res = ast_say_number_full_cz(chan, hundered, ints, language, options, audiofd, ctrlfd);
+				res = ast_say_number_full_cs(chan, hundered, ints, language, options, audiofd, ctrlfd);
 				if (res)
 					return res;
 				if (hundered == 3 || hundered == 4) {	
@@ -637,7 +635,7 @@
 				}
 			}
 			if ( left > 1 )	{ /* we dont say "one thousand" but only thousand */
-				res = ast_say_number_full_cz(chan, left, ints, language, options, audiofd, ctrlfd);
+				res = ast_say_number_full_cs(chan, left, ints, language, options, audiofd, ctrlfd);
 				if (res) 
 					return res;
 			}
@@ -2277,10 +2275,7 @@
 					playz++;
 					continue;
 				}
-				if (strcasecmp(language,"twz") == 0)
-					snprintf(fn, sizeof(fn), "digits/%d", num);
-				else
-					snprintf(fn, sizeof(fn), "digits/%d", num);
+				snprintf(fn, sizeof(fn), "digits/%d", num);
 				num = 0;
 			} else	if (num < 100) {
 				snprintf(buf, 10, "%d", num);
@@ -2531,18 +2526,18 @@
 /* Called from AGI */
 static int say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 {
-	if (!strcasecmp(language, "en") ) {	/* English syntax */
-	   return(ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "da") ) {	/* Danish syntax */
-	   return(ast_say_enumeration_full_da(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "de") ) {	/* German syntax */
-	   return(ast_say_enumeration_full_de(chan, num, ints, language, options, audiofd, ctrlfd));
-	} else if (!strcasecmp(language, "he")) {	/* Hebrew syntax */
-		return (ast_say_enumeration_full_he(chan, num, ints, language, options, audiofd, ctrlfd));
-	} 
-	
+	if (!strncasecmp(language, "en", 2)) {        /* English syntax */
+	   return ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "da", 2)) { /* Danish syntax */
+	   return ast_say_enumeration_full_da(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "de", 2)) { /* German syntax */
+	   return ast_say_enumeration_full_de(chan, num, ints, language, options, audiofd, ctrlfd);
+	} else if (!strncasecmp(language, "he", 2)) { /* Hebrew syntax */
+		return ast_say_enumeration_full_he(chan, num, ints, language, options, audiofd, ctrlfd);
+	}
+
 	/* Default to english */
-	return(ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd));
+	return ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd);
 }
 
 /*! \brief  ast_say_enumeration_full_en: English syntax */
@@ -3060,32 +3055,32 @@
 
 static int say_date(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
-	if (!strcasecmp(lang, "en") ) {	/* English syntax */
-		return(ast_say_date_en(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "da") ) {	/* Danish syntax */
-		return(ast_say_date_da(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "de") ) {	/* German syntax */
-		return(ast_say_date_de(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "fr") ) {	/* French syntax */
-		return(ast_say_date_fr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "hu") ) {	/* Hungarian syntax */
-		return(ast_say_date_hu(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "nl") ) {	/* Dutch syntax */
-		return(ast_say_date_nl(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {	/* Portuguese syntax */
-		return(ast_say_date_pt(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "gr") ) {  			/* Greek syntax */
-		return(ast_say_date_gr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "th") ) {	/* Thai syntax */
-		return(ast_say_date_th(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "ge") ) {  /* Georgian syntax */
-		return(ast_say_date_ge(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "he")) {	/* Hebrew syntax */
-		return (ast_say_date_he(chan, t, ints, lang));
+	if (!strncasecmp(lang, "en", 2)) {        /* English syntax */
+		return ast_say_date_en(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "da", 2)) { /* Danish syntax */
+		return ast_say_date_da(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
+		return ast_say_date_de(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
+		return ast_say_date_fr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
+		return ast_say_date_gr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
+		return ast_say_date_he(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "hu", 2)) { /* Hungarian syntax */
+		return ast_say_date_hu(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
+		return ast_say_date_ka(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
+		return ast_say_date_nl(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
+		return ast_say_date_pt(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
+		return ast_say_date_th(chan, t, ints, lang);
 	}
 
 	/* Default to English */
-	return(ast_say_date_en(chan, t, ints, lang));
+	return ast_say_date_en(chan, t, ints, lang);
 }
 
 /* English syntax */
@@ -3403,38 +3398,38 @@
 	return res;
 }
 
-static int say_date_with_format(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone)
-{
-	if (!strcasecmp(lang, "en") ) {	/* English syntax */
-		return(ast_say_date_with_format_en(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "da") ) {	/* Danish syntax */
-		return(ast_say_date_with_format_da(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "de") ) {	/* German syntax */
-		return(ast_say_date_with_format_de(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "es") || !strcasecmp(lang, "mx")) {	/* Spanish syntax */
-		return (ast_say_date_with_format_es(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "he")) {	/* Hebrew syntax */
-		return (ast_say_date_with_format_he(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "fr")) {	/* French syntax */
-		return (ast_say_date_with_format_fr(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "it")) {	/* Italian syntax */
-		return (ast_say_date_with_format_it(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "nl")) {	/* Dutch syntax */
-		return (ast_say_date_with_format_nl(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "pl")) {	/* Polish syntax */
-		return (ast_say_date_with_format_pl(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {	/* Portuguese syntax */
-		return(ast_say_date_with_format_pt(chan, time, ints, lang, format, timezone));
-	} else if (!strncasecmp(lang, "zh", 2) ) {	/* Taiwanese / Chinese syntax */
-		return(ast_say_date_with_format_zh(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "th") ) {	/* Thai syntax */
-		return(ast_say_date_with_format_th(chan, time, ints, lang, format, timezone));
-	} else if (!strcasecmp(lang, "gr") ) {	/* Greek syntax */
-		return(ast_say_date_with_format_gr(chan, time, ints, lang, format, timezone));
+static int say_date_with_format(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
+{
+	if (!strncasecmp(lang, "en", 2)) {      /* English syntax */
+		return ast_say_date_with_format_en(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "da", 2)) { /* Danish syntax */
+		return ast_say_date_with_format_da(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
+		return ast_say_date_with_format_de(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "es", 2)) { /* Spanish syntax */
+		return ast_say_date_with_format_es(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
+		return ast_say_date_with_format_he(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
+		return ast_say_date_with_format_fr(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
+		return ast_say_date_with_format_gr(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "it", 2)) { /* Italian syntax */
+		return ast_say_date_with_format_it(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
+		return ast_say_date_with_format_nl(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "pl", 2)) { /* Polish syntax */
+		return ast_say_date_with_format_pl(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
+		return ast_say_date_with_format_pt(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
+		return ast_say_date_with_format_th(chan, t, ints, lang, format, tzone);
+	} else if (!strncasecmp(lang, "zh", 2)) { /* Taiwanese / Chinese syntax */
+		return ast_say_date_with_format_zh(chan, t, ints, lang, format, tzone);
 	}
 
 	/* Default to English */
-	return(ast_say_date_with_format_en(chan, time, ints, lang, format, timezone));
+	return ast_say_date_with_format_en(chan, t, ints, lang, format, tzone);
 }
 
 /* English syntax */
@@ -6010,34 +6005,34 @@
 
 static int say_time(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
-	if (!strcasecmp(lang, "en") ) {	/* English syntax */
-		return(ast_say_time_en(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "de") ) {	/* German syntax */
-		return(ast_say_time_de(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "fr") ) {	/* French syntax */
-		return(ast_say_time_fr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "hu") ) {	/* Hungarian syntax */
+	if (!strncasecmp(lang, "en", 2)) {	/* English syntax */
+		return ast_say_time_en(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
+		return ast_say_time_de(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
+		return ast_say_time_fr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
+		return ast_say_time_gr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
+		return ast_say_time_he(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "hu", 2)) { /* Hungarian syntax */
 		return(ast_say_time_hu(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "nl") ) {	/* Dutch syntax */
-		return(ast_say_time_nl(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "pt") ) {	/* Portuguese syntax */
-		return(ast_say_time_pt(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "pt_BR") ) {	/* Brazilian Portuguese syntax */
-		return(ast_say_time_pt_BR(chan, t, ints, lang));
-	} else if (!strncasecmp(lang, "zh", 2) ) {	/* Taiwanese / Chinese syntax */
-		return(ast_say_time_zh(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "gr") ) {  			/* Greek syntax */
-		return(ast_say_time_gr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "th") ) {
+	} else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
+		return ast_say_time_ka(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
+		return ast_say_time_nl(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "pt_BR", 5)) { /* Brazilian Portuguese syntax */
+		return ast_say_time_pt_BR(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
+		return ast_say_time_pt(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
 		return(ast_say_time_th(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "ge") ) {  /* Georgian syntax */
-		return(ast_say_time_ge(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "he")) {	/* Hebrew syntax */
-		return (ast_say_time_he(chan, t, ints, lang));
+	} else if (!strncasecmp(lang, "zh", 2)) { /* Taiwanese / Chinese syntax */
+		return ast_say_time_zh(chan, t, ints, lang);
 	}
 
 	/* Default to English */
-	return(ast_say_time_en(chan, t, ints, lang));
+	return ast_say_time_en(chan, t, ints, lang);
 }
 
 /* English syntax */
@@ -6327,34 +6322,34 @@
 }
 static int say_datetime(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
-	if (!strcasecmp(lang, "en") ) {	/* English syntax */
-		return(ast_say_datetime_en(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "de") ) {	/* German syntax */
-		return(ast_say_datetime_de(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "fr") ) {	/* French syntax */
-		return(ast_say_datetime_fr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "nl") ) {	/* Dutch syntax */
-		return(ast_say_datetime_nl(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "hu") ) {	/* Hungarian syntax */
-		return(ast_say_datetime_hu(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "pt") ) {	/* Portuguese syntax */
-		return(ast_say_datetime_pt(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "pt_BR") ) {	/* Brazilian Portuguese syntax */
-		return(ast_say_datetime_pt_BR(chan, t, ints, lang));
-	} else if (!strncasecmp(lang, "zh", 2) ) {	/* Taiwanese / Chinese syntax */
-		return(ast_say_datetime_zh(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "gr") ) {  			/* Greek syntax */
-		return(ast_say_datetime_gr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "th") ) {	/* Thai syntax */
-		return(ast_say_datetime_th(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "ge") ) {  /* Georgian syntax */
-		return(ast_say_datetime_ge(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "he")) {	/* Hebrew syntax */
-		return (ast_say_datetime_he(chan, t, ints, lang));
+	if (!strncasecmp(lang, "en", 2)) {        /* English syntax */
+		return ast_say_datetime_en(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
+		return ast_say_datetime_de(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
+		return ast_say_datetime_fr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
+		return ast_say_datetime_gr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
+		return ast_say_datetime_he(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "hu", 2)) { /* Hungarian syntax */
+		return ast_say_datetime_hu(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
+		return ast_say_datetime_ka(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
+		return ast_say_datetime_nl(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "pt_BR", 5)) { /* Brazilian Portuguese syntax */
+		return ast_say_datetime_pt_BR(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
+		return ast_say_datetime_pt(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
+		return ast_say_datetime_th(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "zh", 2)) { /* Taiwanese / Chinese syntax */
+		return ast_say_datetime_zh(chan, t, ints, lang);
 	}
 
 	/* Default to English */
-	return(ast_say_datetime_en(chan, t, ints, lang));
+	return ast_say_datetime_en(chan, t, ints, lang);
 }
 
 /* English syntax */
@@ -6764,20 +6759,20 @@
 }
 static int say_datetime_from_now(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
-	if (!strcasecmp(lang, "en") ) {	/* English syntax */
-		return(ast_say_datetime_from_now_en(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "fr") ) {	/* French syntax */
-		return(ast_say_datetime_from_now_fr(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {	/* Portuguese syntax */
-		return(ast_say_datetime_from_now_pt(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "ge") ) {	/* Georgian syntax */
-		return(ast_say_datetime_from_now_ge(chan, t, ints, lang));
-	} else if (!strcasecmp(lang, "he")) {	/* Georgian syntax */
-		return (ast_say_datetime_from_now_he(chan, t, ints, lang));
+	if (!strncasecmp(lang, "en", 2)) {        /* English syntax */
+		return ast_say_datetime_from_now_en(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
+		return ast_say_datetime_from_now_fr(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
+		return ast_say_datetime_from_now_he(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
+		return ast_say_datetime_from_now_ka(chan, t, ints, lang);
+	} else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
+		return ast_say_datetime_from_now_pt(chan, t, ints, lang);
 	}
 
 	/* Default to English */
-	return(ast_say_datetime_from_now_en(chan, t, ints, lang));
+	return ast_say_datetime_from_now_en(chan, t, ints, lang);
 }
 
 /* English syntax */
@@ -7399,7 +7394,7 @@
 	To be able to play the sounds, each of the above tokens needs
 	a corresponding sound file. (e.g. 200_.gsm).
 */
-static char* ast_translate_number_ge(int num, char* res, int res_len)
+static char* ast_translate_number_ka(int num, char* res, int res_len)
 {
 	char buf[256];
 	int digit = 0;
@@ -7426,22 +7421,22 @@
 
 	if (num < 40) {  /* ocda... */
 		strncat(res, "20_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(num - 20, res, res_len);
+		return ast_translate_number_ka(num - 20, res, res_len);
 	}
 
 	if (num < 60) {  /* ormocda... */
 		strncat(res, "40_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(num - 40, res, res_len);
+		return ast_translate_number_ka(num - 40, res, res_len);
 	}
 
 	if (num < 80) {  /* samocda... */
 		strncat(res, "60_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(num - 60, res, res_len);
+		return ast_translate_number_ka(num - 60, res, res_len);
 	}
 
 	if (num < 100) {  /* otxmocda... */
 		strncat(res, "80_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(num - 80, res, res_len);
+		return ast_translate_number_ka(num - 80, res, res_len);
 	}
 
 
@@ -7456,7 +7451,7 @@
 		} else {
 			snprintf(buf, sizeof(buf), "%d_ ", digit*100);
 			strncat(res, buf, res_len - strlen(res) - 1);
-			return ast_translate_number_ge(remainder, res, res_len);
+			return ast_translate_number_ka(remainder, res, res_len);
 		}
 	}
 
@@ -7472,20 +7467,19 @@
 		digit = (num - remainder) / 1000;
 
 		if (remainder == 0) {
-			ast_translate_number_ge(digit, res, res_len);
+			ast_translate_number_ka(digit, res, res_len);
 			strncat(res, " 1000", res_len - strlen(res) - 1);
 			return res;
 		}
 
 		if (digit == 1) {
 			strncat(res, "1000_ ", res_len - strlen(res) - 1);
-			return ast_translate_number_ge(remainder, res, res_len);
-		}
-
-		ast_translate_number_ge(digit, res, res_len);
+			return ast_translate_number_ka(remainder, res, res_len);
+		}
+
+		ast_translate_number_ka(digit, res, res_len);
 		strncat(res, " 1000_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(remainder, res, res_len);
-
+		return ast_translate_number_ka(remainder, res, res_len);
 	}
 
 
@@ -7500,15 +7494,14 @@
 		digit = (num - remainder) / 1000000;
 
 		if (remainder == 0) {
-			ast_translate_number_ge(digit, res, res_len);
+			ast_translate_number_ka(digit, res, res_len);
 			strncat(res, " 1000000", res_len - strlen(res) - 1);
 			return res;
 		}
 
-		ast_translate_number_ge(digit, res, res_len);
+		ast_translate_number_ka(digit, res, res_len);
 		strncat(res, " 1000000_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(remainder, res, res_len);
-
+		return ast_translate_number_ka(remainder, res, res_len);
 	}
 
 
@@ -7523,25 +7516,24 @@
 		digit = (num - remainder) / 1000000000;
 
 		if (remainder == 0) {
-			ast_translate_number_ge(digit, res, res_len);
+			ast_translate_number_ka(digit, res, res_len);
 			strncat(res, " 1000000000", res_len - strlen(res) - 1);
 			return res;
 		}
 
-		ast_translate_number_ge(digit, res, res_len);
+		ast_translate_number_ka(digit, res, res_len);
 		strncat(res, " 1000000000_ ", res_len - strlen(res) - 1);
-		return ast_translate_number_ge(remainder, res, res_len);
-
-	}
-
-	return res;
-
-}
-
-
-
-/*! \brief  ast_say_number_full_ge: Georgian syntax */
-static int ast_say_number_full_ge(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
+		return ast_translate_number_ka(remainder, res, res_len);
+	}
+
+	return res;
+
+}
+
+
+
+/*! \brief  ast_say_number_full_ka: Georgian syntax */
+static int ast_say_number_full_ka(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 {
 	int res = 0;
 	char fn[512] = "";
@@ -7552,7 +7544,7 @@
 		return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
 
 
-	ast_translate_number_ge(num, fn, 512);
+	ast_translate_number_ka(num, fn, 512);
 
 
 
@@ -7618,7 +7610,7 @@
 
 
 /* Georgian syntax. e.g. "oriatas xuti tslis 5 noemberi". */
-static int ast_say_date_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
+static int ast_say_date_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
 	struct timeval tv = { t, 0 };
 	struct ast_tm tm;
@@ -7658,7 +7650,7 @@
 
 
 /* Georgian syntax. e.g. "otxi saati da eqvsi tsuti" */
-static int ast_say_time_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
+static int ast_say_time_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
 	struct timeval tv = { t, 0 };
 	struct ast_tm tm;
@@ -7690,7 +7682,7 @@
 
 
 /* Georgian syntax. Say date, then say time. */
-static int ast_say_datetime_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
+static int ast_say_datetime_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
 	struct timeval tv = { t, 0 };
 	struct ast_tm tm;
@@ -7708,7 +7700,7 @@
 
 
 /* Georgian syntax */
-static int ast_say_datetime_from_now_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
+static int ast_say_datetime_from_now_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
 	int res=0;
 	int daydiff;
@@ -7798,13 +7790,13 @@
 	char *temp;
 	int temp_len;
 	const char *ending;
-	if (!strcasecmp(chan->language, "ru")) {		/* Russian */
+	if (!strncasecmp(chan->language, "ru", 2)) {        /* Russian */
 		ending = counted_noun_ending_slavic(num);
-	} else if(!strcasecmp(chan->language, "ua")) {		/* Ukrainian */
+	} else if (!strncasecmp(chan->language, "ua", 2)) { /* Ukrainian */
 		ending = counted_noun_ending_slavic(num);
-	} else if(!strcasecmp(chan->language, "pl")) {		/* Polish */
+	} else if (!strncasecmp(chan->language, "pl", 2)) { /* Polish */
 		ending = counted_noun_ending_slavic(num);
-	} else {						/* English and default */
+	} else {                                            /* English and default */
 		ending = counted_noun_ending_en(num);
 	}
 	temp = alloca((temp_len = (strlen(noun) + strlen(ending) + 1)));
@@ -7821,7 +7813,7 @@
  */
 static const char *counted_adjective_ending_ru(int num, const char gender[])
 {
-    	if (num < 0) {
+	if (num < 0) {
 	    num *= -1;
 	}
 	num %= 100;		/* never pay attention to more than two digits */
@@ -7840,13 +7832,13 @@
 	char *temp;
 	int temp_len;
 	const char *ending;
-	if (!strcasecmp(chan->language, "ru")) {			/* Russian */
+	if (!strncasecmp(chan->language, "ru", 2)) {           /* Russian */
 		ending = counted_adjective_ending_ru(num, gender);
-	} else if (!strcasecmp(chan->language, "ua")) {			/* Ukrainian */
+	} else if (!strncasecmp(chan->language, "ua", 2)) {    /* Ukrainian */
 		ending = counted_adjective_ending_ru(num, gender);
-	} else if (!strcasecmp(chan->language, "pl")) {			/* Polish */
+	} else if (!strncasecmp(chan->language, "pl", 2)) {    /* Polish */
 		ending = counted_adjective_ending_ru(num, gender);
-	} else {							/* English and default */
+	} else {                                               /* English and default */
 		ending = "";
 	}
 	temp = alloca((temp_len = (strlen(adjective) + strlen(ending) + 1)));




More information about the asterisk-commits mailing list