[Asterisk-cvs] asterisk file.c,1.62,1.63
markster at lists.digium.com
markster at lists.digium.com
Mon May 30 09:13:25 CDT 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv12790
Modified Files:
file.c
Log Message:
Fix language handling (bug #4399)
Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- file.c 22 Apr 2005 13:11:34 -0000 1.62
+++ file.c 30 May 2005 13:16:29 -0000 1.63
@@ -729,23 +729,31 @@
*c = '\0';
postfix = c+1;
prefix = tmp;
+ snprintf(filename2, sizeof(filename2), "%s/%s/%s", prefix, preflang, postfix);
} else {
postfix = tmp;
prefix="";
+ snprintf(filename2, sizeof(filename2), "%s/%s", preflang, postfix);
}
- snprintf(filename2, sizeof(filename2), "%s/%s/%s", prefix, preflang, postfix);
res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS);
if (res < 1) {
char *stringp=NULL;
strncpy(lang2, preflang, sizeof(lang2)-1);
stringp=lang2;
strsep(&stringp, "_");
+ /* If language is a specific locality of a language (like es_MX), strip the locality and try again */
if (strcmp(lang2, preflang)) {
- snprintf(filename2, sizeof(filename2), "%s/%s/%s", prefix, lang2, postfix);
+ if (ast_strlen_zero(prefix)) {
+ snprintf(filename2, sizeof(filename2), "%s/%s", lang2, postfix);
+ } else {
+ snprintf(filename2, sizeof(filename2), "%s/%s/%s", prefix, lang2, postfix);
+ }
res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS);
}
}
}
+
+ /* Fallback to no language (usually winds up being American English) */
if (res < 1) {
res = ast_filehelper(filename, NULL, fmt, ACTION_EXISTS);
}
More information about the svn-commits
mailing list