summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-10 16:58:27 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:20 +0100
commit8041b042fe8e105fd82dee860a8a91b822307915 (patch)
treeba26cafbd7dee0f98e07584dc635b29d053c51d0 /src/lib/elua
parent0496762057e055fd227382cb1be81578240e5577 (diff)
elua lib: move i18n initialization there
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/Elua.h2
-rw-r--r--src/lib/elua/elua.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/elua/Elua.h b/src/lib/elua/Elua.h
index cb1edc13ee..5100f512e4 100644
--- a/src/lib/elua/Elua.h
+++ b/src/lib/elua/Elua.h
@@ -89,7 +89,7 @@ EAPI lua_State *elua_state_lua_state_get(const Elua_State *es);
89 89
90EAPI int elua_report_error(const Elua_State *es, const char *pname, int status); 90EAPI int elua_report_error(const Elua_State *es, const char *pname, int status);
91 91
92EAPI void elua_state_setup_i18n(const Elua_State *es); 92EAPI Eina_Bool elua_state_setup_i18n(const Elua_State *es);
93 93
94EAPI int elua_io_loadfile(const Elua_State *es, const char *fname); 94EAPI int elua_io_loadfile(const Elua_State *es, const char *fname);
95EAPI void elua_io_register(const Elua_State *es); 95EAPI void elua_io_register(const Elua_State *es);
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index 32f203cc6b..3bda98b30f 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -283,7 +283,7 @@ const luaL_reg gettextlib[] =
283 { NULL, NULL } 283 { NULL, NULL }
284}; 284};
285 285
286EAPI void 286EAPI Eina_Bool
287elua_state_setup_i18n(const Elua_State *es) 287elua_state_setup_i18n(const Elua_State *es)
288{ 288{
289#ifdef ENABLE_NLS 289#ifdef ENABLE_NLS
@@ -291,6 +291,14 @@ elua_state_setup_i18n(const Elua_State *es)
291 char *(*dngettextp)(const char*, const char*, const char*, unsigned long) 291 char *(*dngettextp)(const char*, const char*, const char*, unsigned long)
292 = dngettext; 292 = dngettext;
293#endif 293#endif
294 char buf[PATH_MAX];
295 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
296 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
297 EINA_SAFETY_ON_NULL_RETURN_VAL(es->coredir, EINA_FALSE);
298 snprintf(buf, sizeof(buf), "%s/gettext.lua", es->coredir);
299 if (elua_report_error(es, elua_state_prog_name_get(es),
300 elua_io_loadfile(es, buf)))
301 return EINA_FALSE;
294 lua_createtable(es->luastate, 0, 0); 302 lua_createtable(es->luastate, 0, 0);
295 luaL_register(es->luastate, NULL, gettextlib); 303 luaL_register(es->luastate, NULL, gettextlib);
296#ifdef ENABLE_NLS 304#ifdef ENABLE_NLS
@@ -299,6 +307,8 @@ elua_state_setup_i18n(const Elua_State *es)
299 lua_pushlightuserdata(es->luastate, *((void**)&dngettextp)); 307 lua_pushlightuserdata(es->luastate, *((void**)&dngettextp));
300 lua_setfield(es->luastate, -2, "dngettext"); 308 lua_setfield(es->luastate, -2, "dngettext");
301#endif 309#endif
310 lua_call(es->luastate, 1, 0);
311 return EINA_TRUE;
302} 312}
303 313
304EAPI int 314EAPI int