content translation + gui.str function
This commit is contained in:
parent
7359b0e10a
commit
0838208fb6
@ -1,22 +0,0 @@
|
|||||||
bazalt=Bazalt
|
|
||||||
blue_lamp=Blue Lamp
|
|
||||||
brick=Brick
|
|
||||||
dirt=Dirt
|
|
||||||
flower=Flower
|
|
||||||
glass=Glass
|
|
||||||
grass_block=Ground
|
|
||||||
grass=Tall Grass
|
|
||||||
green_lamp=Green Lamp
|
|
||||||
lamp=Lamp
|
|
||||||
leaves=Leaves
|
|
||||||
lightbulb=Bulb
|
|
||||||
metal=Metal
|
|
||||||
pane=Pane
|
|
||||||
pipe=Pipe
|
|
||||||
planks=Planks
|
|
||||||
red_lamp=Red Lamp
|
|
||||||
rust=Rust
|
|
||||||
sand=Sand
|
|
||||||
stone=Stone
|
|
||||||
water=Water
|
|
||||||
wood=Wood
|
|
||||||
@ -1,22 +1,22 @@
|
|||||||
bazalt=Базальт
|
bazalt=базальт
|
||||||
blue_lamp=Синяя Лампа
|
blue lamp=синяя лампа
|
||||||
brick=Кирпич
|
brick=кирпич
|
||||||
dirt=Земля
|
dirt=земля
|
||||||
flower=Цветок
|
flower=цветок
|
||||||
glass=Стекло
|
glass=стекло
|
||||||
grass_block=Дёрн
|
grass block=дёрн
|
||||||
grass=Высокая Трава
|
tall grass=высокая трава
|
||||||
green_lamp=Зелёная Лампа
|
green lamp=зелёная лампа
|
||||||
lamp=Лампа
|
lamp=лампа
|
||||||
leaves=Листва
|
leaves=листва
|
||||||
lightbulb=Лампочка
|
light bulb=лампочка
|
||||||
metal=Металл
|
metal=металл
|
||||||
pane=Панель
|
pane=панель
|
||||||
pipe=Труба
|
pipe=труба
|
||||||
planks=Доски
|
planks=доски
|
||||||
red_lamp=Красная Лампа
|
red lamp=красная лампа
|
||||||
rust=Ржавчина
|
rust=ржавчина
|
||||||
sand=Песок
|
sand=песок
|
||||||
stone=Камень
|
stone=камень
|
||||||
water=Вода
|
water=вода
|
||||||
wood=Бревно
|
wood=бревно
|
||||||
|
|||||||
@ -243,6 +243,8 @@ void Engine::loadContent() {
|
|||||||
|
|
||||||
Shader::preprocessor->setPaths(resPaths.get());
|
Shader::preprocessor->setPaths(resPaths.get());
|
||||||
|
|
||||||
|
langs::setup(resdir, langs::current->getId(), contentPacks);
|
||||||
|
|
||||||
std::unique_ptr<Assets> new_assets(new Assets());
|
std::unique_ptr<Assets> new_assets(new Assets());
|
||||||
std::cout << "-- loading assets" << std::endl;
|
std::cout << "-- loading assets" << std::endl;
|
||||||
AssetsLoader loader(new_assets.get(), resPaths.get());
|
AssetsLoader loader(new_assets.get(), resPaths.get());
|
||||||
|
|||||||
@ -128,7 +128,7 @@ void langs::load(const fs::path& resdir,
|
|||||||
if (fs::is_regular_file(file)) {
|
if (fs::is_regular_file(file)) {
|
||||||
std::string text = files::read_string(file);
|
std::string text = files::read_string(file);
|
||||||
Reader reader(file.string(), text);
|
Reader reader(file.string(), text);
|
||||||
reader.read(lang, pack.id+":");
|
reader.read(lang, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#include "../../../graphics/ui/elements/UINode.h"
|
#include "../../../graphics/ui/elements/UINode.h"
|
||||||
#include "../../../graphics/ui/elements/controls.h"
|
#include "../../../graphics/ui/elements/controls.h"
|
||||||
#include "../../../frontend/UiDocument.h"
|
#include "../../../frontend/UiDocument.h"
|
||||||
|
#include "../../../frontend/locale/langs.h"
|
||||||
#include "../../../util/stringutil.h"
|
#include "../../../util/stringutil.h"
|
||||||
|
|
||||||
static gui::UINode* getDocumentNode(lua_State* L, const std::string& name, const std::string& nodeName) {
|
static gui::UINode* getDocumentNode(lua_State* L, const std::string& name, const std::string& nodeName) {
|
||||||
@ -320,10 +321,22 @@ static int l_gui_get_env(lua_State* L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_gui_str(lua_State* L) {
|
||||||
|
auto text = util::str2wstr_utf8(lua_tostring(L, 1));
|
||||||
|
if (!lua_isnoneornil(L, 2)) {
|
||||||
|
auto context = util::str2wstr_utf8(lua_tostring(L, 2));
|
||||||
|
lua_pushstring(L, util::wstr2str_utf8(langs::get(text, context)).c_str());
|
||||||
|
} else {
|
||||||
|
lua_pushstring(L, util::wstr2str_utf8(langs::get(text)).c_str());
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
const luaL_Reg guilib [] = {
|
const luaL_Reg guilib [] = {
|
||||||
{"get_viewport", lua_wrap_errors<l_gui_getviewport>},
|
{"get_viewport", lua_wrap_errors<l_gui_getviewport>},
|
||||||
{"getattr", lua_wrap_errors<l_gui_getattr>},
|
{"getattr", lua_wrap_errors<l_gui_getattr>},
|
||||||
{"setattr", lua_wrap_errors<l_gui_setattr>},
|
{"setattr", lua_wrap_errors<l_gui_setattr>},
|
||||||
{"get_env", lua_wrap_errors<l_gui_get_env>},
|
{"get_env", lua_wrap_errors<l_gui_get_env>},
|
||||||
|
{"str", lua_wrap_errors<l_gui_str>},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user