mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
WRaster: Add initialisation for locale support
Because the library does not have an initialisation function, we need to rely on an automatic called-on-load mechanism, which is provided through a compiler attribute 'constructor'. However, as the project aims to still compile on old hard/software, we include a check in 'configure' to ensure it works, and if not use the legacy solution. Note: Because we introduce a new DEFINE, the 'config.h.in' needs to be regenerated, otherwise you may get a compilation error in wrlib. This is done by re-running './autogen.sh' Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
19202fd2db
commit
70f89fd9c5
21
wrlib/misc.c
21
wrlib/misc.c
@@ -245,6 +245,27 @@ const char *RMessageForError(int errorCode)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef I18N
|
||||
/*
|
||||
* Setup internationalization on startup
|
||||
*
|
||||
* For historical reason, the WRaster library does not have a function that
|
||||
* user is supposed to call to initialise the library. Because we need to do
|
||||
* some stuff now, we rely on the compiler attribute to tell this function
|
||||
* has to be called automatically when library is loaded.
|
||||
*/
|
||||
void WLIB_CONSTRUCTOR(RStartup) (void)
|
||||
{
|
||||
const char *locale_path;
|
||||
|
||||
locale_path = getenv("NLSPATH");
|
||||
if (locale_path == NULL)
|
||||
locale_path = LOCALEDIR;
|
||||
|
||||
bindtextdomain("WRaster", locale_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* cleaning third-party libs at shutdown
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user