FreeBASIC  0.91.0
intl_getmonthname.c
Go to the documentation of this file.
1 /* get month name */
2 
3 #include "fb.h"
4 
5 static const char *pszMonthNamesLong[12] = {
6  "January",
7  "February",
8  "March",
9  "April",
10  "May",
11  "June",
12  "July",
13  "August",
14  "September",
15  "October",
16  "November",
17  "December"
18 };
19 
20 static const char *pszMonthNamesShort[12] = {
21  "Jan",
22  "Feb",
23  "Mar",
24  "Apr",
25  "May",
26  "Jun",
27  "Jul",
28  "Aug",
29  "Sep",
30  "Oct",
31  "Nov",
32  "Dec"
33 };
34 
35 /*:::::*/
36 FBSTRING *fb_IntlGetMonthName( int month, int short_names, int disallow_localized )
37 {
38  FBSTRING *res;
39 
40  if( month < 1 || month > 12 )
41  return NULL;
42 
43  if( fb_I18nGet() && !disallow_localized ) {
44  res = fb_DrvIntlGetMonthName( month, short_names );
45  if( res!=NULL )
46  return res;
47  }
48  if( short_names ) {
49  res = fb_StrAllocTempDescZ( pszMonthNamesShort[month-1] );
50  } else {
51  res = fb_StrAllocTempDescZ( pszMonthNamesLong[month-1] );
52  }
53  if( res==&__fb_ctx.null_desc )
54  return NULL;
55  return res;
56 }