Skip to content

Commit 61a3b07

Browse files
authored
Merge pull request #238 from Fs00/more-translations
More l10n improvements and add workflow to generate POT file
2 parents 6cf5dc9 + b47b384 commit 61a3b07

17 files changed

+210
-233
lines changed

.github/workflows/generate_pot.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Generate translation template
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- "*.md"
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
push:
12+
paths-ignore:
13+
- "*.md"
14+
branches:
15+
- main
16+
17+
jobs:
18+
generate-pot:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: "Checkout repo"
22+
uses: actions/checkout@v3
23+
24+
- name: "Install gettext"
25+
run: |
26+
sudo apt update -qq
27+
sudo apt install -y gettext
28+
29+
- name: "Generate POT file using xgettext"
30+
run: >
31+
find src -name *.cpp -o -name *.hpp -o -name *.h |
32+
xargs xgettext --from-code=utf-8
33+
-k_ -kwxTRANSLATE -w 100
34+
--check=space-ellipsis --omit-header
35+
-o cemu.pot
36+
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: POT file
41+
path: ./cemu.pot
42+
if-no-files-found: error

src/gui/components/wxTitleManagerList.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId)
290290
}
291291
}
292292

293-
std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):\n \n"));
293+
std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):"));
294+
msg.append("\n \n");
294295

295296
if (titleInfo_base.IsValid())
296297
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _pathToUtf8(titleInfo_base.GetPath())));

src/gui/debugger/RegisterWindow.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum
2828
};
2929

3030
RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
31-
: wxFrame(&parent, wxID_ANY, _("Register View"), wxDefaultPosition, wxSize(400, 975), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT),
31+
: wxFrame(&parent, wxID_ANY, _("Registers"), wxDefaultPosition, wxSize(400, 975), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT),
3232
m_prev_snapshot({}), m_show_double_values(true), m_context_ctrl(nullptr)
3333
{
3434
SetSizeHints(wxDefaultSize, wxDefaultSize);

src/gui/debugger/SymbolWindow.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ enum ItemColumns
1313
};
1414

1515
SymbolWindow::SymbolWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
16-
: wxFrame(&parent, wxID_ANY, _("Symbol Window"), wxDefaultPosition, wxSize(600, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT)
16+
: wxFrame(&parent, wxID_ANY, _("Symbols"), wxDefaultPosition, wxSize(600, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT)
1717
{
1818
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
1919

src/gui/input/panels/ClassicControllerInputPanel.cpp

+20-41
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
2929
for (const auto& id : g_kFirstColumnItems)
3030
{
3131
row++;
32-
33-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
34-
35-
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
36-
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
37-
text_ctrl->SetMinSize(wxSize(150, -1));
38-
text_ctrl->SetEditable(false);
39-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
40-
bind_hotkey_events(text_ctrl);
41-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
32+
add_button_row(main_sizer, row, column, id);
4233
}
4334

4435
//////////////////////////////////////////////////////////////////
@@ -55,16 +46,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
5546
for (const auto& id : g_kSecondColumnItems)
5647
{
5748
row++;
58-
59-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
60-
61-
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
62-
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
63-
text_ctrl->SetMinSize(wxSize(150, -1));
64-
text_ctrl->SetEditable(false);
65-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
66-
bind_hotkey_events(text_ctrl);
67-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
49+
add_button_row(main_sizer, row, column, id);
6850
}
6951

7052
row++;
@@ -87,16 +69,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
8769
for (const auto& id : g_kThirdColumnItems)
8870
{
8971
row++;
90-
91-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
92-
93-
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
94-
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
95-
text_ctrl->SetMinSize(wxSize(150, -1));
96-
text_ctrl->SetEditable(false);
97-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
98-
bind_hotkey_events(text_ctrl);
99-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
72+
add_button_row(main_sizer, row, column, id);
10073
}
10174

10275
row++;
@@ -119,21 +92,27 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
11992
for (auto id : g_kFourthRowItems)
12093
{
12194
row++;
122-
123-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
124-
125-
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
126-
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
127-
text_ctrl->SetMinSize(wxSize(150, -1));
128-
text_ctrl->SetEditable(false);
129-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
130-
bind_hotkey_events(text_ctrl);
131-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
95+
add_button_row(main_sizer, row, column, id);
13296
}
13397

13498
//////////////////////////////////////////////////////////////////
13599

136-
137100
SetSizer(main_sizer);
138101
Layout();
139102
}
103+
104+
void ClassicControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id) {
105+
sizer->Add(
106+
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ClassicController::get_button_name(button_id)))),
107+
wxGBPosition(row, column),
108+
wxDefaultSpan,
109+
wxALL | wxALIGN_CENTER_VERTICAL, 5);
110+
111+
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
112+
text_ctrl->SetClientData(reinterpret_cast<void*>(button_id));
113+
text_ctrl->SetMinSize(wxSize(150, -1));
114+
text_ctrl->SetEditable(false);
115+
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
116+
bind_hotkey_events(text_ctrl);
117+
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
118+
}

src/gui/input/panels/ClassicControllerInputPanel.h

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <wx/gbsizer.h>
4+
#include "input/emulated/ClassicController.h"
35
#include "gui/input/panels/InputPanel.h"
46

57
class wxInputDraw;
@@ -11,5 +13,7 @@ class ClassicControllerInputPanel : public InputPanel
1113

1214
private:
1315
wxInputDraw* m_left_draw, * m_right_draw;
16+
17+
void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id);
1418
};
1519

src/gui/input/panels/ProControllerInputPanel.cpp

+20-45
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <wx/stattext.h>
55
#include <wx/statline.h>
66
#include <wx/textctrl.h>
7-
#include <wx/slider.h>
87

9-
#include "gui/helpers/wxControlObject.h"
108
#include "input/emulated/ProController.h"
119
#include "gui/helpers/wxHelpers.h"
1210
#include "gui/components/wxInputDraw.h"
@@ -30,16 +28,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
3028
for (auto id : g_kFirstColumnItems)
3129
{
3230
row++;
33-
34-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
35-
36-
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
37-
text_ctrl->SetClientData((void*)id);
38-
text_ctrl->SetMinSize(wxSize(150, -1));
39-
text_ctrl->SetEditable(false);
40-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
41-
bind_hotkey_events(text_ctrl);
42-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
31+
add_button_row(main_sizer, row, column, id);
4332
}
4433

4534
//////////////////////////////////////////////////////////////////
@@ -56,16 +45,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
5645
for (auto id : g_kSecondColumnItems)
5746
{
5847
row++;
59-
60-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
61-
62-
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
63-
text_ctrl->SetClientData((void*)id);
64-
text_ctrl->SetMinSize(wxSize(150, -1));
65-
text_ctrl->SetEditable(false);
66-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
67-
bind_hotkey_events(text_ctrl);
68-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
48+
add_button_row(main_sizer, row, column, id);
6949
}
7050

7151
row++;
@@ -88,16 +68,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
8868
for (auto id : g_kThirdColumnItems)
8969
{
9070
row++;
91-
92-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
93-
94-
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
95-
text_ctrl->SetClientData((void*)id);
96-
text_ctrl->SetMinSize(wxSize(150, -1));
97-
text_ctrl->SetEditable(false);
98-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
99-
bind_hotkey_events(text_ctrl);
100-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
71+
add_button_row(main_sizer, row, column, id);
10172
}
10273

10374
row++;
@@ -120,24 +91,28 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
12091
for (auto id : g_kFourthRowItems)
12192
{
12293
row++;
123-
124-
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
125-
126-
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
127-
text_ctrl->SetClientData((void*)id);
128-
text_ctrl->SetMinSize(wxSize(150, -1));
129-
text_ctrl->SetEditable(false);
130-
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
131-
bind_hotkey_events(text_ctrl);
132-
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
94+
add_button_row(main_sizer, row, column, id);
13395
}
13496

13597
//////////////////////////////////////////////////////////////////
13698

137-
// LoadController(controller);
138-
13999
SetSizerAndFit(main_sizer);
140-
//wxWindow::Show(show);
100+
}
101+
102+
void ProControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id) {
103+
sizer->Add(
104+
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ProController::get_button_name(button_id)))),
105+
wxGBPosition(row, column),
106+
wxDefaultSpan,
107+
wxALL | wxALIGN_CENTER_VERTICAL, 5);
108+
109+
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
110+
text_ctrl->SetClientData((void*)button_id);
111+
text_ctrl->SetMinSize(wxSize(150, -1));
112+
text_ctrl->SetEditable(false);
113+
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
114+
bind_hotkey_events(text_ctrl);
115+
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
141116
}
142117

143118
void ProControllerInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller,

src/gui/input/panels/ProControllerInputPanel.h

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <wx/gbsizer.h>
4+
#include "input/emulated/ProController.h"
35
#include "gui/input/panels/InputPanel.h"
46
#include "gui/components/wxInputDraw.h"
57

@@ -12,4 +14,6 @@ class ProControllerInputPanel : public InputPanel
1214

1315
private:
1416
wxInputDraw* m_left_draw, * m_right_draw;
17+
18+
void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id);
1519
};

0 commit comments

Comments
 (0)