src/gedlib/locales.c
/* ENABLE_NLS */
/*==========================================
 * win32_setlocale -- handle MS-Windows goofed up locale names
 *========================================*/
ENABLE_NLS
win32_setlocale -- handle MS-Windows goofed up locale names
ENABLE_NLS win32_setlocale -- handle MS - Windows goofed up locale names
static char *
win32_setlocale (int category, char * locale)
{
	char * rtn = 0;
#if defined(_WIN32) && !defined(__CYGWIN__)
	if (locale) {
		char w32loc[30]="";
		char * ptr;
		int i;
		for (i=0; langs[i]; i += 2) {
			if (eqstrn(locale, langs[i], 2)) {
				llstrapps(w32loc, sizeof(w32loc), uu8, langs[i+1]);
				break;
			}
		}
		if (!langs[i])
			return 0;
		ptr = locale+strlen(langs[i]);
		if (ptr[0]=='_') {
			llstrappc(w32loc, sizeof(w32loc), ptr[0]);
			for (i=0; countries[i]; i += 2) {
				if (eqstrn(ptr+1, countries[i], 2)) {
					llstrapps(w32loc, sizeof(w32loc), uu8, countries[i+1]);
					break;
				}
			}
		}
		rtn = setlocale(category, w32loc);
	}
#else
	category=category; 
	locale=locale; 
#endif 
	return rtn;
}
static char * win32_setlocale ( int category , char * locale ) { char * rtn = 0 ; #if defined ( _WIN32 ) && ! defined ( __CYGWIN__ ) if ( locale ) { char w32loc [ 30 ] = " " ; char * ptr ; int i ; for ( i = 0 ; langs [ i ] ; i += 2 ) { if ( eqstrn ( locale , langs [ i ] , 2 ) ) { llstrapps ( w32loc , sizeof ( w32loc ) , uu8 , langs [ i + 1 ] ) ; break ; } } if ( ! langs [ i ] ) return 0 ; ptr = locale + strlen ( langs [ i ] ) ; if ( ptr [ 0 ] == ' ' ) { llstrappc ( w32loc , sizeof ( w32loc ) , ptr [ 0 ] ) ; for ( i = 0 ; countries [ i ] ; i += 2 ) { if ( eqstrn ( ptr + 1 , countries [ i ] , 2 ) ) { llstrapps ( w32loc , sizeof ( w32loc ) , uu8 , countries [ i + 1 ] ) ; break ; } } } rtn = setlocale ( category , w32loc ) ; } #else category = category ; locale = locale ; #endif return rtn ; }
ENABLE_NLS
 win32_setlocale -- handle MS-Windows goofed up locale names
ENABLE_NLS win32_setlocale -- handle MS - Windows goofed up locale names
/* TODO: Obviously this needs work -- and move to win32 subdir ? */ /* TODO: strip off codeset, because we don't want user's codeset anyway,
		at least unless int_codeset == 0 */ /* unused */ /* unused */ /* _WIN32 */