better locale guess for win32
see https://github.com/tumagonx/pygi-mingw-patches/blob/master/gst-plugins-base-1.4.x.patch also https://github.com/tumagonx/pygi-mingw-patches/issues/5
This commit is contained in:
parent
ba129fceb3
commit
689b632702
@ -332,6 +332,7 @@ guint32 vips__random( guint32 seed );
|
||||
guint32 vips__random_add( guint32 seed, int value );
|
||||
|
||||
const char *vips__icc_dir( void );
|
||||
const char *vips__locale_dir( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -267,7 +267,6 @@ vips_init( const char *argv0 )
|
||||
char *prgname;
|
||||
const char *prefix;
|
||||
const char *libdir;
|
||||
char name[256];
|
||||
|
||||
/* Two stage done handling: 'done' means we've completed, 'started'
|
||||
* means we're currently initialising. Use this to prevent recursive
|
||||
@ -342,10 +341,7 @@ vips_init( const char *argv0 )
|
||||
|
||||
/* Get i18n .mo files from $VIPSHOME/share/locale/.
|
||||
*/
|
||||
vips_snprintf( name, 256,
|
||||
"%s" G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S "locale",
|
||||
prefix );
|
||||
bindtextdomain( GETTEXT_PACKAGE, name );
|
||||
bindtextdomain( GETTEXT_PACKAGE, vips__locale_dir() );
|
||||
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
|
||||
|
||||
/* Deprecated, this is just for compat.
|
||||
|
@ -1969,3 +1969,40 @@ vips__icc_dir( void )
|
||||
(GThreadFunc) vips_icc_dir_once, NULL ) );
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
static HMODULE vips_dll = NULL;
|
||||
#ifdef DLL_EXPORT
|
||||
BOOL WINAPI
|
||||
DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
|
||||
{
|
||||
if( fdwReason == DLL_PROCESS_ATTACH )
|
||||
vips_dll = hinstDLL;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void *
|
||||
vips_locale_dir_once( void *null )
|
||||
{
|
||||
char *prefix;
|
||||
|
||||
#ifdef OS_WIN32
|
||||
prefix = g_win32_get_package_installation_directory_of_module(
|
||||
vips_dll ),
|
||||
#else
|
||||
prefix = (char *) g_getenv( "VIPSHOME" );
|
||||
#endif
|
||||
|
||||
return( (void *) g_build_filename( prefix, "share", "locale", NULL ) );
|
||||
}
|
||||
|
||||
const char *
|
||||
vips__locale_dir( void )
|
||||
{
|
||||
static GOnce once = G_ONCE_INIT;
|
||||
|
||||
return( (const char *) g_once( &once,
|
||||
(GThreadFunc) vips_locale_dir_once, NULL ) );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user