Add minetest.load_translation to the main menu API
This commit is contained in:
parent
62f2f4546a
commit
8f0dd004f1
@ -38,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "client/fontengine.h"
|
#include "client/fontengine.h"
|
||||||
#include "client/guiscalingfilter.h"
|
#include "client/guiscalingfilter.h"
|
||||||
#include "irrlicht_changes/static_text.h"
|
#include "irrlicht_changes/static_text.h"
|
||||||
|
#include "translation.h"
|
||||||
|
|
||||||
#if ENABLE_GLES
|
#if ENABLE_GLES
|
||||||
#include "client/tile.h"
|
#include "client/tile.h"
|
||||||
@ -184,6 +185,7 @@ GUIEngine::GUIEngine(JoystickController *joystick,
|
|||||||
|
|
||||||
infostream << "GUIEngine: Initializing Lua" << std::endl;
|
infostream << "GUIEngine: Initializing Lua" << std::endl;
|
||||||
|
|
||||||
|
g_client_translations->clear();
|
||||||
m_script = new MainMenuScripting(this);
|
m_script = new MainMenuScripting(this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "serverlist.h"
|
#include "serverlist.h"
|
||||||
#include "mapgen/mapgen.h"
|
#include "mapgen/mapgen.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "translation.h"
|
||||||
|
|
||||||
#include <IFileArchive.h>
|
#include <IFileArchive.h>
|
||||||
#include <IFileSystem.h>
|
#include <IFileSystem.h>
|
||||||
@ -946,6 +947,14 @@ int ModApiMainMenu::l_sleep_ms(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
int ModApiMainMenu::l_load_translation(lua_State *L)
|
||||||
|
{
|
||||||
|
const std::string tr_data = luaL_checkstring(L, 1);
|
||||||
|
g_client_translations->loadTranslation(tr_data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void ModApiMainMenu::Initialize(lua_State *L, int top)
|
void ModApiMainMenu::Initialize(lua_State *L, int top)
|
||||||
{
|
{
|
||||||
@ -992,6 +1001,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
|||||||
API_FCT(open_url);
|
API_FCT(open_url);
|
||||||
API_FCT(open_dir);
|
API_FCT(open_dir);
|
||||||
API_FCT(do_async_callback);
|
API_FCT(do_async_callback);
|
||||||
|
API_FCT(load_translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -158,6 +158,9 @@ private:
|
|||||||
// async
|
// async
|
||||||
static int l_do_async_callback(lua_State *L);
|
static int l_do_async_callback(lua_State *L);
|
||||||
|
|
||||||
|
// MultiCraft
|
||||||
|
static int l_load_translation(lua_State *L);
|
||||||
|
|
||||||
static int l_sleep_ms(lua_State *L);
|
static int l_sleep_ms(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user