Skip to content

Commit

Permalink
Merge pull request #238 from Fs00/more-translations
Browse files Browse the repository at this point in the history
More l10n improvements and add workflow to generate POT file
  • Loading branch information
Exzap committed Sep 14, 2022
2 parents 6cf5dc9 + b47b384 commit 61a3b07
Show file tree
Hide file tree
Showing 17 changed files with 210 additions and 233 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/generate_pot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Generate translation template

on:
pull_request:
paths-ignore:
- "*.md"
types:
- opened
- synchronize
- reopened
push:
paths-ignore:
- "*.md"
branches:
- main

jobs:
generate-pot:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v3

- name: "Install gettext"
run: |
sudo apt update -qq
sudo apt install -y gettext
- name: "Generate POT file using xgettext"
run: >
find src -name *.cpp -o -name *.hpp -o -name *.h |
xargs xgettext --from-code=utf-8
-k_ -kwxTRANSLATE -w 100
--check=space-ellipsis --omit-header
-o cemu.pot
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: POT file
path: ./cemu.pot
if-no-files-found: error
3 changes: 2 additions & 1 deletion src/gui/components/wxTitleManagerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId)
}
}

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

if (titleInfo_base.IsValid())
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _pathToUtf8(titleInfo_base.GetPath())));
Expand Down
2 changes: 1 addition & 1 deletion src/gui/debugger/RegisterWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum
};

RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
: wxFrame(&parent, wxID_ANY, _("Register View"), wxDefaultPosition, wxSize(400, 975), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT),
: wxFrame(&parent, wxID_ANY, _("Registers"), wxDefaultPosition, wxSize(400, 975), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT),
m_prev_snapshot({}), m_show_double_values(true), m_context_ctrl(nullptr)
{
SetSizeHints(wxDefaultSize, wxDefaultSize);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/debugger/SymbolWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum ItemColumns
};

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

Expand Down
61 changes: 20 additions & 41 deletions src/gui/input/panels/ClassicControllerInputPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (const auto& id : g_kFirstColumnItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

//////////////////////////////////////////////////////////////////
Expand All @@ -55,16 +46,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (const auto& id : g_kSecondColumnItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

row++;
Expand All @@ -87,16 +69,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (const auto& id : g_kThirdColumnItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

row++;
Expand All @@ -119,21 +92,27 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (auto id : g_kFourthRowItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

//////////////////////////////////////////////////////////////////


SetSizer(main_sizer);
Layout();
}

void ClassicControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id) {
sizer->Add(
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ClassicController::get_button_name(button_id)))),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(button_id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
}
4 changes: 4 additions & 0 deletions src/gui/input/panels/ClassicControllerInputPanel.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <wx/gbsizer.h>
#include "input/emulated/ClassicController.h"
#include "gui/input/panels/InputPanel.h"

class wxInputDraw;
Expand All @@ -11,5 +13,7 @@ class ClassicControllerInputPanel : public InputPanel

private:
wxInputDraw* m_left_draw, * m_right_draw;

void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id);
};

65 changes: 20 additions & 45 deletions src/gui/input/panels/ProControllerInputPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <wx/stattext.h>
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/slider.h>

#include "gui/helpers/wxControlObject.h"
#include "input/emulated/ProController.h"
#include "gui/helpers/wxHelpers.h"
#include "gui/components/wxInputDraw.h"
Expand All @@ -30,16 +28,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kFirstColumnItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

//////////////////////////////////////////////////////////////////
Expand All @@ -56,16 +45,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kSecondColumnItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

row++;
Expand All @@ -88,16 +68,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kThirdColumnItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

row++;
Expand All @@ -120,24 +91,28 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kFourthRowItems)
{
row++;

main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
add_button_row(main_sizer, row, column, id);
}

//////////////////////////////////////////////////////////////////

// LoadController(controller);

SetSizerAndFit(main_sizer);
//wxWindow::Show(show);
}

void ProControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id) {
sizer->Add(
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ProController::get_button_name(button_id)))),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);

auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)button_id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
}

void ProControllerInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller,
Expand Down
4 changes: 4 additions & 0 deletions src/gui/input/panels/ProControllerInputPanel.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <wx/gbsizer.h>
#include "input/emulated/ProController.h"
#include "gui/input/panels/InputPanel.h"
#include "gui/components/wxInputDraw.h"

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

private:
wxInputDraw* m_left_draw, * m_right_draw;

void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id);
};

0 comments on commit 61a3b07

Please sign in to comment.