forked from enlightenment/efl
elua lib: move i18n initialization there
This commit is contained in:
parent
0496762057
commit
8041b042fe
|
@ -163,12 +163,8 @@ elua_main(lua_State *L)
|
|||
luaL_register(L, NULL, cutillib);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
snprintf(modfile, sizeof(modfile), "%s/gettext.lua", coredir);
|
||||
if (elua_report_error(es, elua_state_prog_name_get(es),
|
||||
elua_io_loadfile(es, modfile)))
|
||||
if (!elua_state_setup_i18n(es))
|
||||
goto error;
|
||||
elua_state_setup_i18n(es);
|
||||
lua_call(L, 1, 0);
|
||||
|
||||
elua_io_register(es);
|
||||
lua_gc(L, LUA_GCRESTART, 0);
|
||||
|
|
|
@ -89,7 +89,7 @@ EAPI lua_State *elua_state_lua_state_get(const Elua_State *es);
|
|||
|
||||
EAPI int elua_report_error(const Elua_State *es, const char *pname, int status);
|
||||
|
||||
EAPI void elua_state_setup_i18n(const Elua_State *es);
|
||||
EAPI Eina_Bool elua_state_setup_i18n(const Elua_State *es);
|
||||
|
||||
EAPI int elua_io_loadfile(const Elua_State *es, const char *fname);
|
||||
EAPI void elua_io_register(const Elua_State *es);
|
||||
|
|
|
@ -283,7 +283,7 @@ const luaL_reg gettextlib[] =
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
EAPI void
|
||||
EAPI Eina_Bool
|
||||
elua_state_setup_i18n(const Elua_State *es)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
|
@ -291,6 +291,14 @@ elua_state_setup_i18n(const Elua_State *es)
|
|||
char *(*dngettextp)(const char*, const char*, const char*, unsigned long)
|
||||
= dngettext;
|
||||
#endif
|
||||
char buf[PATH_MAX];
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(es->coredir, EINA_FALSE);
|
||||
snprintf(buf, sizeof(buf), "%s/gettext.lua", es->coredir);
|
||||
if (elua_report_error(es, elua_state_prog_name_get(es),
|
||||
elua_io_loadfile(es, buf)))
|
||||
return EINA_FALSE;
|
||||
lua_createtable(es->luastate, 0, 0);
|
||||
luaL_register(es->luastate, NULL, gettextlib);
|
||||
#ifdef ENABLE_NLS
|
||||
|
@ -299,6 +307,8 @@ elua_state_setup_i18n(const Elua_State *es)
|
|||
lua_pushlightuserdata(es->luastate, *((void**)&dngettextp));
|
||||
lua_setfield(es->luastate, -2, "dngettext");
|
||||
#endif
|
||||
lua_call(es->luastate, 1, 0);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
|
|
Loading…
Reference in New Issue