context-based translation test
This commit is contained in:
parent
4e6818fb7f
commit
e97eb441d5
@ -1,26 +1,7 @@
|
||||
# Menu
|
||||
menu.new-world=New World
|
||||
menu.quit=Quit
|
||||
menu.create-world=Create World
|
||||
menu.save-and-quit=Save and Quit to Menu
|
||||
menu.missing-content=Missing Content!
|
||||
menu.controls=Controls
|
||||
menu.back-to-menu=Back to Main Menu
|
||||
menu.settings=Settings
|
||||
world.seed=Seed
|
||||
world.name=World Name
|
||||
world.create=Create World
|
||||
world.convert-request=Content indices have changed! Convert world files?
|
||||
|
||||
# Settings
|
||||
chunks.load-distance=Load Distance
|
||||
chunks.load-speed=Load Speed
|
||||
graphics.fog-curve=Fog Curve
|
||||
graphics.backlight=Backlight
|
||||
display.vsync=V-Sync
|
||||
camera.fov=FOV
|
||||
mouse.sensitivity=Mouse Sensitivity
|
||||
|
||||
# Bindings
|
||||
movement.forward=Forward
|
||||
movement.back=Back
|
||||
|
||||
@ -7,27 +7,29 @@ Back=Назад
|
||||
Continue=Продолжить
|
||||
|
||||
# Меню
|
||||
menu.new-world=Новый Мир
|
||||
menu.quit=Выход
|
||||
menu.continue=Продолжить
|
||||
menu.save-and-quit=Сохранить и Выйти в Меню
|
||||
menu.New World=Новый Мир
|
||||
menu.Quit=Выход
|
||||
menu.Continue=Продолжить
|
||||
menu.Save and Quit to Menu=Сохранить и Выйти в Меню
|
||||
menu.missing-content=Отсутствует Контент!
|
||||
menu.controls=Управление
|
||||
menu.back-to-menu=Вернуться в Меню
|
||||
menu.settings=Настройки
|
||||
world.seed=Зерно
|
||||
world.name=Название
|
||||
world.create=Создать Мир
|
||||
menu.Controls=Управление
|
||||
menu.Back to Main Menu=Вернуться в Меню
|
||||
menu.Settings=Настройки
|
||||
world.Seed=Зерно
|
||||
world.Name=Название
|
||||
world.Create World=Создать Мир
|
||||
|
||||
world.convert-request=Есть изменения в индексах! Конвертировать мир?
|
||||
|
||||
# Настройки
|
||||
chunks.load-distance=Дистанция Загрузки
|
||||
chunks.load-speed=Скорость Загрузки
|
||||
graphics.fog-curve=Кривая Тумана
|
||||
graphics.backlight=Подсветка
|
||||
display.vsync=V-Sync
|
||||
camera.fov=Поле Зрения
|
||||
mouse.sensitivity=Чувствительность Мыши
|
||||
settings.Load Distance=Дистанция Загрузки
|
||||
settings.Load Speed=Скорость Загрузки
|
||||
settings.Fog Curve=Кривая Тумана
|
||||
settings.Backlight=Подсветка
|
||||
settings.V-Sync=Вертикальная Синхронизация
|
||||
|
||||
FOV=Поле Зрения
|
||||
settings.Mouse Sensitivity=Чувствительность Мыши
|
||||
|
||||
# Управление
|
||||
movement.forward=Вперёд
|
||||
|
||||
@ -131,3 +131,12 @@ void langs::setup(const path& resdir,
|
||||
const wstring& langs::get(const wstring& key) {
|
||||
return current->get(key);
|
||||
}
|
||||
|
||||
const wstring& langs::get(const wstring& key, const wstring& context) {
|
||||
wstring ctxkey = context + L"." + key;
|
||||
const wstring& text = current->get(ctxkey);
|
||||
if (&ctxkey != &text) {
|
||||
return text;
|
||||
}
|
||||
return current->get(key);
|
||||
}
|
||||
|
||||
@ -56,6 +56,8 @@ namespace langs {
|
||||
std::vector<const ContentPack*>& packs);
|
||||
|
||||
extern const std::wstring& get(const std::wstring& key);
|
||||
extern const std::wstring& get(const std::wstring& key,
|
||||
const std::wstring& context);
|
||||
|
||||
extern void setup(const std::filesystem::path& resdir,
|
||||
const std::string& locale,
|
||||
|
||||
@ -68,7 +68,7 @@ void show_content_missing(GUI* gui, const Content* content, ContentLUT* lut) {
|
||||
subpanel->maxLength(400);
|
||||
panel->add(subpanel);
|
||||
|
||||
panel->add((new Button(langs::get(L"menu.back-to-menu"), vec4(8.0f)))->listenAction([=](GUI*){
|
||||
panel->add((new Button(langs::get(L"Back to Main Menu", L"menu"), vec4(8.0f)))->listenAction([=](GUI*){
|
||||
menu->back();
|
||||
}));
|
||||
panel->refresh();
|
||||
@ -97,7 +97,7 @@ Panel* create_main_menu_panel(Engine* engine, PagesControl* menu) {
|
||||
Panel* panel = new Panel(vec2(400, 200), vec4(5.0f), 1.0f);
|
||||
panel->color(vec4(0.0f));
|
||||
|
||||
panel->add(guiutil::gotoButton(langs::get(L"menu.new-world"), "new-world", menu));
|
||||
panel->add(guiutil::gotoButton(langs::get(L"New World", L"menu"), "new-world", menu));
|
||||
|
||||
Panel* worldsPanel = new Panel(vec2(390, 200), vec4(5.0f));
|
||||
worldsPanel->color(vec4(1.0f, 1.0f, 1.0f, 0.07f));
|
||||
@ -135,8 +135,8 @@ Panel* create_main_menu_panel(Engine* engine, PagesControl* menu) {
|
||||
}
|
||||
}
|
||||
panel->add(worldsPanel);
|
||||
panel->add(guiutil::gotoButton(langs::get(L"menu.settings"), "settings", menu));
|
||||
panel->add((new Button(langs::get(L"menu.quit"), vec4(10.f)))->listenAction([](GUI* gui) {
|
||||
panel->add(guiutil::gotoButton(langs::get(L"Settings", L"menu"), "settings", menu));
|
||||
panel->add((new Button(langs::get(L"Quit", L"menu"), vec4(10.f)))->listenAction([](GUI* gui) {
|
||||
Window::setShouldClose(true);
|
||||
}));
|
||||
panel->refresh();
|
||||
@ -149,7 +149,7 @@ Panel* create_new_world_panel(Engine* engine, PagesControl* menu) {
|
||||
|
||||
TextBox* worldNameInput;
|
||||
{
|
||||
Label* label = new Label(langs::get(L"world.name"));
|
||||
Label* label = new Label(langs::get(L"Name", L"world"));
|
||||
panel->add(label);
|
||||
|
||||
TextBox* input = new TextBox(L"New World", vec4(6.0f));
|
||||
@ -159,7 +159,7 @@ Panel* create_new_world_panel(Engine* engine, PagesControl* menu) {
|
||||
|
||||
TextBox* seedInput;
|
||||
{
|
||||
Label* label = new Label(langs::get(L"world.seed"));
|
||||
Label* label = new Label(langs::get(L"Seed", L"world"));
|
||||
panel->add(shared_ptr<UINode>(label));
|
||||
|
||||
uint64_t randseed = rand() ^ (rand() << 8) ^
|
||||
@ -173,7 +173,7 @@ Panel* create_new_world_panel(Engine* engine, PagesControl* menu) {
|
||||
}
|
||||
|
||||
{
|
||||
Button* button = new Button(langs::get(L"world.create"), vec4(10.0f));
|
||||
Button* button = new Button(langs::get(L"Create World", L"world"), vec4(10.0f));
|
||||
button->margin(vec4(1, 20, 1, 1));
|
||||
vec4 basecolor = worldNameInput->color();
|
||||
button->listenAction([=](GUI*) {
|
||||
@ -239,7 +239,7 @@ Panel* create_controls_panel(Engine* engine, PagesControl* menu) {
|
||||
std::wstringstream ss;
|
||||
ss << std::fixed << std::setprecision(1);
|
||||
ss << engine->getSettings().camera.sensitivity;
|
||||
return langs::get(L"mouse.sensitivity")+L": "+ss.str();
|
||||
return langs::get(L"Mouse Sensitivity", L"settings")+L": "+ss.str();
|
||||
}));
|
||||
|
||||
TrackBar* trackbar = new TrackBar(0.1, 10.0, 2.0, 0.1, 4);
|
||||
@ -282,7 +282,7 @@ Panel* create_settings_panel(Engine* engine, PagesControl* menu) {
|
||||
|
||||
/* Load Distance setting track bar */{
|
||||
panel->add((new Label(L""))->textSupplier([=]() {
|
||||
return langs::get(L"chunks.load-distance")+L": " +
|
||||
return langs::get(L"Load Distance", L"settings")+L": " +
|
||||
std::to_wstring(engine->getSettings().chunks.loadDistance);
|
||||
}));
|
||||
|
||||
@ -298,7 +298,7 @@ Panel* create_settings_panel(Engine* engine, PagesControl* menu) {
|
||||
|
||||
/* Load Speed setting track bar */{
|
||||
panel->add((new Label(L""))->textSupplier([=]() {
|
||||
return langs::get(L"chunks.load-speed")+L": " +
|
||||
return langs::get(L"Load Speed", L"settings")+L": " +
|
||||
std::to_wstring(engine->getSettings().chunks.loadSpeed);
|
||||
}));
|
||||
|
||||
@ -317,7 +317,7 @@ Panel* create_settings_panel(Engine* engine, PagesControl* menu) {
|
||||
std::wstringstream ss;
|
||||
ss << std::fixed << std::setprecision(1);
|
||||
ss << engine->getSettings().graphics.fogCurve;
|
||||
return langs::get(L"graphics.fog-curve")+L": " + ss.str();
|
||||
return langs::get(L"Fog Curve", L"settings")+L": " + ss.str();
|
||||
}));
|
||||
|
||||
TrackBar* trackbar = new TrackBar(1.0, 6.0, 1.0, 0.1, 2);
|
||||
@ -333,7 +333,7 @@ Panel* create_settings_panel(Engine* engine, PagesControl* menu) {
|
||||
/* Fov setting track bar */{
|
||||
panel->add((new Label(L""))->textSupplier([=]() {
|
||||
int fov = (int)engine->getSettings().camera.fov;
|
||||
return langs::get(L"camera.fov")+L": "+std::to_wstring(fov)+L"°";
|
||||
return langs::get(L"FOV", L"settings")+L": "+std::to_wstring(fov)+L"°";
|
||||
}));
|
||||
|
||||
TrackBar* trackbar = new TrackBar(30.0, 120.0, 90, 1, 4);
|
||||
@ -360,7 +360,7 @@ Panel* create_settings_panel(Engine* engine, PagesControl* menu) {
|
||||
engine->getSettings().display.swapInterval = checked;
|
||||
});
|
||||
checkpanel->add(checkbox);
|
||||
checkpanel->add(new Label(langs::get(L"display.vsync")));
|
||||
checkpanel->add(new Label(langs::get(L"V-Sync", L"settings")));
|
||||
|
||||
panel->add(checkpanel);
|
||||
}
|
||||
@ -379,12 +379,12 @@ Panel* create_settings_panel(Engine* engine, PagesControl* menu) {
|
||||
engine->getSettings().graphics.backlight = checked;
|
||||
});
|
||||
checkpanel->add(checkbox);
|
||||
checkpanel->add(new Label(langs::get(L"graphics.backlight")));
|
||||
checkpanel->add(new Label(langs::get(L"Backlight", L"settings")));
|
||||
|
||||
panel->add(checkpanel);
|
||||
}
|
||||
|
||||
panel->add(guiutil::gotoButton(langs::get(L"menu.controls"), "controls", menu));
|
||||
panel->add(guiutil::gotoButton(langs::get(L"Controls", L"menu"), "controls", menu));
|
||||
panel->add(guiutil::backButton(menu));
|
||||
panel->refresh();
|
||||
return panel;
|
||||
@ -394,15 +394,15 @@ Panel* create_pause_panel(Engine* engine, PagesControl* menu) {
|
||||
Panel* panel = new Panel(vec2(400, 200));
|
||||
panel->color(vec4(0.0f));
|
||||
{
|
||||
Button* button = new Button(langs::get(L"Continue"), vec4(10.0f));
|
||||
Button* button = new Button(langs::get(L"Continue", L"menu"), vec4(10.0f));
|
||||
button->listenAction([=](GUI*){
|
||||
menu->reset();
|
||||
});
|
||||
panel->add(shared_ptr<UINode>(button));
|
||||
}
|
||||
panel->add(guiutil::gotoButton(langs::get(L"Settings"), "settings", menu));
|
||||
panel->add(guiutil::gotoButton(langs::get(L"Settings", L"menu"), "settings", menu));
|
||||
{
|
||||
Button* button = new Button(langs::get(L"menu.save-and-quit"), vec4(10.f));
|
||||
Button* button = new Button(langs::get(L"Save and Quit to Menu", L"menu"), vec4(10.f));
|
||||
button->listenAction([engine](GUI*){
|
||||
engine->setScreen(shared_ptr<Screen>(new MenuScreen(engine)));
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user