diff --git a/.gitignore b/.gitignore index 5078fb2..f455367 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ compile_commands.json .vs out .cache -CMakeLists.txt.* \ No newline at end of file +CMakeLists.txt.* +*.mo \ No newline at end of file diff --git a/UserInterface/UserInterface.cxx b/UserInterface/UserInterface.cxx index c799809..d5261b4 100644 --- a/UserInterface/UserInterface.cxx +++ b/UserInterface/UserInterface.cxx @@ -18,8 +18,8 @@ void UserInterface::InitUI() controlMgr_ = std::make_shared(this); mgr_.AddPane(controlMgr_->header_, - wxAuiPaneInfo().Name("header").Caption("header").CloseButton(false).Floatable(false).MinSize(-1, 40)); - mgr_.AddPane(controlMgr_->local_, wxAuiPaneInfo().Name("local").Caption("local").CloseButton(false).BestSize(300, 400)); + wxAuiPaneInfo().Name("header").Caption(_("header")).CloseButton(false).Floatable(false).MinSize(-1, 40)); + mgr_.AddPane(controlMgr_->local_, wxAuiPaneInfo().Name("local").Caption(_("local")).CloseButton(false).BestSize(300, 400)); // update mgr_.Update(); diff --git a/UserInterface/main.cxx b/UserInterface/main.cxx index 8f118dc..d62f52f 100644 --- a/UserInterface/main.cxx +++ b/UserInterface/main.cxx @@ -1,14 +1,25 @@ #include "UserInterface.h" +#include class RelayFileApp : public wxApp { public: bool OnInit() override { - auto* f = new UserInterface(wxT("RelayFile")); + SetProcessDPIAware(); + loadLocale(); + auto* f = new UserInterface(_("RelayFile")); f->Show(); return true; } + +private: + void loadLocale() + { + auto* locale = new wxLocale(wxLANGUAGE_CHINESE_SIMPLIFIED); + locale->AddCatalogLookupPathPrefix(wxT(".")); + locale->AddCatalog(wxT("internat")); + } }; IMPLEMENT_APP(RelayFileApp); diff --git a/translate/internat.po b/translate/internat.po new file mode 100644 index 0000000..8dc9e90 --- /dev/null +++ b/translate/internat.po @@ -0,0 +1,36 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2025-05-08 22:27+0800\n" +"PO-Revision-Date: 2025-05-08 22:44+0800\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.6\n" +"X-Poedit-Basepath: ..\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: _\n" +"X-Poedit-SearchPath-0: .\n" + +#: UserInterface/HeaderControl.cxx:19 +msgid "Connect" +msgstr "连接" + +#: UserInterface/HeaderControl.cxx:20 +msgid "Disconnect" +msgstr "断开连接" + +#: UserInterface/UserInterface.cxx:21 +msgid "header" +msgstr "首要设定" + +#: UserInterface/UserInterface.cxx:22 +msgid "local" +msgstr "本地文件" + +#: UserInterface/main.cxx:9 +msgid "RelayFile" +msgstr "文件中转"