add:添加国际化。

This commit is contained in:
taynpg 2025-05-08 23:24:17 +08:00
parent e63b73e722
commit 57f10b86af
4 changed files with 52 additions and 4 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ compile_commands.json
out
.cache
CMakeLists.txt.*
*.mo

View File

@ -18,8 +18,8 @@ void UserInterface::InitUI()
controlMgr_ = std::make_shared<ControlManager>(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();

View File

@ -1,14 +1,25 @@
#include "UserInterface.h"
#include <wx/uilocale.h>
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);

36
translate/internat.po Normal file
View File

@ -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 "文件中转"