use Nz::LocalizedText instead of std::string for text displayed to users
This commit is contained in:
parent
89671593e1
commit
77d4c747ef
|
|
@ -5,6 +5,7 @@
|
|||
#include <NazaraEditor/Core/Application/Shortcut.hpp>
|
||||
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <NazaraLocalization/LocalizedText.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
|
@ -17,8 +18,8 @@ namespace Nz
|
|||
struct Properties
|
||||
{
|
||||
std::string className;
|
||||
std::string description;
|
||||
std::string path;
|
||||
Nz::LocalizedText description;
|
||||
Nz::LocalizedText path;
|
||||
std::string category;
|
||||
Nz::Shortcut shortcut;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@
|
|||
#include <NazaraEditor/Core/UI/PopupManager.hpp>
|
||||
#include <NazaraEditor/Core/UI/Window.hpp>
|
||||
#include <NazaraImgui/NazaraImgui.hpp>
|
||||
#include <NazaraLocalization/Localization.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARAEDITOR_CORE_API EditorBaseApplication
|
||||
: public Nz::Application<Nz::Graphics, Nz::Imgui, Nz::EditorCore>
|
||||
: public Nz::Application<Nz::Graphics, Nz::Imgui, Nz::Localization, Nz::EditorCore>
|
||||
{
|
||||
public:
|
||||
NazaraSignal(OnLevelChanged, Nz::Level&);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Nz
|
|||
: public EditorWindow
|
||||
{
|
||||
public:
|
||||
EditorMainWindow(EditorBaseApplication* app, const std::string& name = "", const std::vector<std::string>& categories = {});
|
||||
EditorMainWindow(EditorBaseApplication* app, const Nz::LocalizedText& name, const std::vector<std::string>& categories = {});
|
||||
virtual ~EditorMainWindow() = default;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <NazaraEditor/Core/Config.hpp>
|
||||
#include <NazaraImgui/NazaraImgui.hpp>
|
||||
#include <NazaraLocalization/LocalizedText.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -14,7 +15,7 @@ namespace Nz
|
|||
: private Nz::ImguiHandler
|
||||
{
|
||||
public:
|
||||
EditorWindow(EditorBaseApplication* app, const std::string& name = "", const std::vector<std::string>& categories = {});
|
||||
EditorWindow(EditorBaseApplication* app, const Nz::LocalizedText& name, const std::vector<std::string>& categories = {});
|
||||
virtual ~EditorWindow();
|
||||
|
||||
EditorWindow(const EditorWindow&) = delete;
|
||||
|
|
@ -40,7 +41,7 @@ namespace Nz
|
|||
private:
|
||||
|
||||
EditorBaseApplication* m_application;
|
||||
std::string m_windowName;
|
||||
Nz::LocalizedText m_windowName;
|
||||
std::vector<std::string> m_categories;
|
||||
|
||||
struct MenuAction
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Nz
|
||||
{
|
||||
EditorMainWindow::EditorMainWindow(EditorBaseApplication* app, const std::string& name, const std::vector<std::string>& categories)
|
||||
EditorMainWindow::EditorMainWindow(EditorBaseApplication* app, const Nz::LocalizedText& name, const std::vector<std::string>& categories)
|
||||
: EditorWindow(app, name, categories)
|
||||
{ }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace Nz
|
||||
{
|
||||
EditorWindow::EditorWindow(EditorBaseApplication* app, const std::string& name, const std::vector<std::string>& categories)
|
||||
EditorWindow::EditorWindow(EditorBaseApplication* app, const Nz::LocalizedText& name, const std::vector<std::string>& categories)
|
||||
: m_application(app)
|
||||
, m_windowName(name)
|
||||
, m_categories(categories)
|
||||
|
|
@ -18,7 +18,7 @@ namespace Nz
|
|||
return;
|
||||
|
||||
auto name = prop.className;
|
||||
AddMenuAction(prop.path, prop.shortcut.ToString(), [name]() { Nz::EditorBaseApplication::Instance()->GetActionStack().ExecuteAction(name); }, prop.icon);
|
||||
AddMenuAction(prop.path.ToString(), prop.shortcut.ToString(), [name]() { Nz::EditorBaseApplication::Instance()->GetActionStack().ExecuteAction(name); }, prop.icon);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace NzEditor
|
||||
{
|
||||
AssetsWindow::AssetsWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Assets Browser", { "Assets" })
|
||||
: Nz::EditorWindow(app, Nz::LocalizedText("LOC_EDITOR_WINDOW_ASSET_BROWSER_TITLE"), { "Assets" })
|
||||
{
|
||||
BuildMenuBar();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
namespace NzEditor
|
||||
{
|
||||
InspectorWindow::InspectorWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Inspector")
|
||||
: Nz::EditorWindow(app, Nz::LocalizedText("LOC_EDITOR_WINDOW_INSPECTOR_TITLE"))
|
||||
{
|
||||
app->OnEntitySelected.Connect(this, &InspectorWindow::OnEntitySelected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
namespace NzEditor
|
||||
{
|
||||
LevelWindow::LevelWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Level")
|
||||
: Nz::EditorWindow(app, Nz::LocalizedText("LOC_EDITOR_WINDOW_LEVEL_TITLE"))
|
||||
, m_currentLevel(app->GetLevel())
|
||||
, m_dirty(true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace NzEditor
|
||||
{
|
||||
MainWindow::MainWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorMainWindow(app, "MainWindow", { "General", "Plugins" })
|
||||
: Nz::EditorMainWindow(app, Nz::LocalizedText("LOC_EDITOR_WINDOW_MAIN_TITLE"), { "General", "Plugins" })
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
namespace NzEditor
|
||||
{
|
||||
OutputWindow::OutputWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Output", { "Output" })
|
||||
: Nz::EditorWindow(app, Nz::LocalizedText("LOC_EDITOR_WINDOW_OUTPUT_TITLE"), { "Output" })
|
||||
, m_bScrollToBottom(true)
|
||||
, m_bScrollToTop(false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ int WinMain(int argc, char* argv[])
|
|||
app.SetResourceFolder(resourceDir);
|
||||
app.SetLogger(logger);
|
||||
|
||||
Nz::Localization::Instance()->LoadLocalizationFile(resourceDir / "localization.csv");
|
||||
Nz::Localization::Instance()->SetLocale("en-US");
|
||||
|
||||
ImGui::EnsureContextOnThisThread();
|
||||
|
||||
app.RegisterWindow<NzEditor::MainWindow>();
|
||||
|
|
@ -49,25 +52,25 @@ int WinMain(int argc, char* argv[])
|
|||
texParams.loadFormat = Nz::PixelFormat::RGBA8_SRGB;
|
||||
|
||||
app.RegisterAction<Nz::EditorAction_Level_New>({
|
||||
.description = "Create new level",
|
||||
.path = "File|Level|New",
|
||||
.description = Nz::LocalizedText("LOC_EDITOR_ACTION_LEVEL_NEW_DESC"),
|
||||
.path = Nz::LocalizedText("LOC_EDITOR_ACTION_LEVEL_NEW_PATH"),
|
||||
.category = "General",
|
||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::N, true, true),
|
||||
.icon = Nz::Texture::LoadFromFile(app.GetResourceFolder() / "file_new.png", texParams)
|
||||
});
|
||||
app.RegisterAction<Nz::EditorAction_Log_Clear>({
|
||||
.description = "Clears log output",
|
||||
.path = "Clear",
|
||||
.description = Nz::LocalizedText("LOC_EDITOR_ACTION_LOG_CLEAR_DESC"),
|
||||
.path = Nz::LocalizedText("LOC_EDITOR_ACTION_LOG_CLEAR_PATH"),
|
||||
.category = "Output",
|
||||
});
|
||||
app.RegisterAction<Nz::EditorAction_Log_CopyToClipboard>({
|
||||
.description = "Copies log output to clipboard",
|
||||
.path = "Copy to Clipboard",
|
||||
.description = Nz::LocalizedText("LOC_EDITOR_ACTION_LOG_COPY_DESC"),
|
||||
.path = Nz::LocalizedText("LOC_EDITOR_ACTION_LOG_COPY_PATH"),
|
||||
.category = "Output",
|
||||
});
|
||||
app.RegisterAction<Nz::EditorAction_Quit>({
|
||||
.description = "Exits the editor",
|
||||
.path = "File|Exit",
|
||||
.description = Nz::LocalizedText("LOC_EDITOR_ACTION_QUIT_DESC"),
|
||||
.path = Nz::LocalizedText("LOC_EDITOR_ACTION_QUIT_PATH"),
|
||||
.category = "General",
|
||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::F4, false, false, true),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue