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=Базальт
|
||||
blue_lamp=Синяя Лампа
|
||||
brick=Кирпич
|
||||
dirt=Земля
|
||||
flower=Цветок
|
||||
glass=Стекло
|
||||
grass_block=Дёрн
|
||||
grass=Высокая Трава
|
||||
green_lamp=Зелёная Лампа
|
||||
lamp=Лампа
|
||||
leaves=Листва
|
||||
lightbulb=Лампочка
|
||||
metal=Металл
|
||||
pane=Панель
|
||||
pipe=Труба
|
||||
planks=Доски
|
||||
red_lamp=Красная Лампа
|
||||
rust=Ржавчина
|
||||
sand=Песок
|
||||
stone=Камень
|
||||
water=Вода
|
||||
wood=Бревно
|
||||
bazalt=базальт
|
||||
blue lamp=синяя лампа
|
||||
brick=кирпич
|
||||
dirt=земля
|
||||
flower=цветок
|
||||
glass=стекло
|
||||
grass block=дёрн
|
||||
tall grass=высокая трава
|
||||
green lamp=зелёная лампа
|
||||
lamp=лампа
|
||||
leaves=листва
|
||||
light bulb=лампочка
|
||||
metal=металл
|
||||
pane=панель
|
||||
pipe=труба
|
||||
planks=доски
|
||||
red lamp=красная лампа
|
||||
rust=ржавчина
|
||||
sand=песок
|
||||
stone=камень
|
||||
water=вода
|
||||
wood=бревно
|
||||
|
||||
@ -243,6 +243,8 @@ void Engine::loadContent() {
|
||||
|
||||
Shader::preprocessor->setPaths(resPaths.get());
|
||||
|
||||
langs::setup(resdir, langs::current->getId(), contentPacks);
|
||||
|
||||
std::unique_ptr<Assets> new_assets(new Assets());
|
||||
std::cout << "-- loading assets" << std::endl;
|
||||
AssetsLoader loader(new_assets.get(), resPaths.get());
|
||||
|
||||
@ -128,7 +128,7 @@ void langs::load(const fs::path& resdir,
|
||||
if (fs::is_regular_file(file)) {
|
||||
std::string text = files::read_string(file);
|
||||
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/controls.h"
|
||||
#include "../../../frontend/UiDocument.h"
|
||||
#include "../../../frontend/locale/langs.h"
|
||||
#include "../../../util/stringutil.h"
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 [] = {
|
||||
{"get_viewport", lua_wrap_errors<l_gui_getviewport>},
|
||||
{"getattr", lua_wrap_errors<l_gui_getattr>},
|
||||
{"setattr", lua_wrap_errors<l_gui_setattr>},
|
||||
{"get_env", lua_wrap_errors<l_gui_get_env>},
|
||||
{"str", lua_wrap_errors<l_gui_str>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user