Skip to content

Commit 6f7e314

Browse files
zlomzlomarch1t3cht
authored andcommitted
Make more strings translatable
aegisublocale.cpp -- Make dialog window translatable auto4_base.cpp -- Make warning logs translatable auto4_lua.cpp -- Make descriptions used in the Create() function translatable dialog_attachments.cpp -- Make file types translatable --> I also noticed that the file extraction dialog only has one file type ("Font Files"), so I added two new types: "All Supported Formats" and "Graphic Files" dialog_automation.cpp -- Make warning log translatable dialog_dummy_video.cpp -- Make resolution names translatable dialog_export.cpp -- Make message boxes translatable dialog_properties.cpp -- Make "YCbCr Matrix:" string translatable dialog_spellchecker.cpp -- Make message boxes translatable dialog_style_manager.cpp -- Make message boxes translatable main.cpp -- Make message boxes translatable preferences.cpp -- Make FFmpegSource's log levels, search bar and columns' titles of hotkey table translatable project.cpp -- Make message boxes translatable subs_controller.cpp -- Make "Untitled" string filename and messages translatable subs_preview.cpp -- Make message box translatable video_provider_manager.cpp -- Make error strings translatable macro-2-mkfullwitdh.lua -- Make script metadata translatable
1 parent 1ba8934 commit 6f7e314

18 files changed

+72
-68
lines changed

automation/autoload/macro-2-mkfullwitdh.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
local tr = aegisub.gettext
55

6-
script_name = tr("Make text fullwidth")
7-
script_description = tr("Shows how to use the unicode include to iterate over characters and a lookup table to convert those characters to something else.")
6+
script_name = tr"Make text fullwidth"
7+
script_description = tr"Shows how to use the unicode include to iterate over characters and a lookup table to convert those characters to something else."
88
script_author = "Niels Martin Hansen"
99
script_version = "1"
1010

po/make_pot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ maybe_append() {
1616

1717
find ../src ../src/command -name '*.cpp' -o -name '*.h' \
1818
| xgettext --files-from=- -o - --c++ --sort-by-file \
19-
-k_ -kSTR_MENU -kSTR_DISP -kSTR_HELP -kCOMMAND_GROUP:5 \
19+
-k_ -kwxTRANSLATE -kSTR_MENU -kSTR_DISP -kSTR_HELP -kCOMMAND_GROUP:5 \
2020
-kfmt_tl -kfmt_plural:2,3 \
2121
| sed 's/SOME DESCRIPTIVE TITLE./Aegisub 3.2/' \
2222
| sed 's/YEAR/2005-2014/' \

src/aegisublocale.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ std::string AegisubLocale::PickLanguage() {
110110
if (!active_language.empty())
111111
style |= wxCANCEL;
112112

113-
wxSingleChoiceDialog dialog(nullptr, "Please choose a language:", "Language", langNames,
113+
wxSingleChoiceDialog dialog(nullptr, _("Please choose a language:"), _("Language"), langNames,
114114
(void **)nullptr,
115115
style);
116116
if (dialog.ShowModal() == wxID_OK) {

src/auto4_base.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
#include "ass_style.h"
3434
#include "compat.h"
3535
#include "dialog_progress.h"
36+
#include "format.h"
3637
#include "include/aegisub/context.h"
3738
#include "options.h"
3839
#include "string_codec.h"
3940
#include "subs_controller.h"
4041

4142
#include <libaegisub/dispatch.h>
42-
#include <libaegisub/format.h>
4343
#include <libaegisub/fs.h>
4444
#include <libaegisub/path.h>
4545
#include <libaegisub/split.h>
@@ -341,16 +341,16 @@ namespace Automation4 {
341341
}
342342

343343
if (error_count == 1) {
344-
wxLogWarning("A script in the Automation autoload directory failed to load.\nPlease review the errors, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again.");
344+
wxLogWarning(_("A script in the Automation autoload directory failed to load.\nPlease review the errors, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again."));
345345
}
346346
else if (error_count > 1) {
347-
wxLogWarning("Multiple scripts in the Automation autoload directory failed to load.\nPlease review the errors, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again.");
347+
wxLogWarning(_("Multiple scripts in the Automation autoload directory failed to load.\nPlease review the errors, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again."));
348348
}
349349
else if (warning_count == 1) {
350-
wxLogWarning("A script in the Automation autoload directory loaded with warnings.\nPlease review the warnings, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again.");
350+
wxLogWarning(_("A script in the Automation autoload directory loaded with warnings.\nPlease review the warnings, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again."));
351351
}
352352
else if (warning_count > 1) {
353-
wxLogWarning("Multiple scripts in the Automation autoload directory loaded with warnings.\nPlease review the warnings, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again.");
353+
wxLogWarning(_("Multiple scripts in the Automation autoload directory loaded with warnings.\nPlease review the warnings, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again."));
354354
}
355355

356356
ScriptsChanged();
@@ -390,16 +390,16 @@ namespace Automation4 {
390390
basepath = autobasefn;
391391
} else if (first_char == '/') {
392392
} else {
393-
wxLogWarning("Automation Script referenced with unknown location specifier character.\nLocation specifier found: %c\nFilename specified: %s",
394-
first_char, to_wx(trimmed));
393+
wxLogWarning(fmt_tl("Automation Script referenced with unknown location specifier character.\nLocation specifier found: %c\nFilename specified: %s",
394+
first_char, to_wx(trimmed)));
395395
continue;
396396
}
397397
auto sfname = basepath/trimmed;
398398
if (agi::fs::FileExists(sfname))
399399
scripts.emplace_back(Automation4::ScriptFactory::CreateFromFile(sfname, true));
400400
else {
401-
wxLogWarning("Automation Script referenced could not be found.\nFilename specified: %c%s\nSearched relative to: %s\nResolved filename: %s",
402-
first_char, to_wx(trimmed), basepath.wstring(), sfname.wstring());
401+
wxLogWarning(fmt_tl("Automation Script referenced could not be found.\nFilename specified: %c%s\nSearched relative to: %s\nResolved filename: %s",
402+
first_char, to_wx(trimmed), basepath.wstring(), sfname.wstring()));
403403
}
404404
}
405405

src/auto4_lua.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ namespace {
455455
// create lua environment
456456
L = luaL_newstate();
457457
if (!L) {
458-
description = "Could not initialize Lua state";
458+
description = from_wx(_("Could not initialize Lua state"));
459459
return;
460460
}
461461

@@ -538,7 +538,7 @@ namespace {
538538
// this is where features are registered
539539
if (lua_pcall(L, 0, 0, -2)) {
540540
// error occurred, assumed to be on top of Lua stack
541-
description = agi::format("Error initialising Lua script \"%s\":\n\n%s", GetPrettyFilename().string(), get_string_or_default(L, -1));
541+
description = from_wx(fmt_tl("Error initialising Lua script \"%s\":\n\n%s", GetPrettyFilename().string(), get_string_or_default(L, -1)));
542542
lua_pop(L, 2); // error + error handler
543543
return;
544544
}
@@ -548,7 +548,7 @@ namespace {
548548
lua_getglobal(L, "version");
549549
if (lua_isnumber(L, -1) && lua_tointeger(L, -1) == 3) {
550550
lua_pop(L, 1); // just to avoid tripping the stackcheck in debug
551-
description = "Attempted to load an Automation 3 script as an Automation 4 Lua script. Automation 3 is no longer supported.";
551+
description = from_wx(_("Attempted to load an Automation 3 script as an Automation 4 Lua script. Automation 3 is no longer supported."));
552552
stackcheck.check_stack(0);
553553
return;
554554
}

src/dialog_attachments.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void DialogAttachments::AttachFile(wxFileDialog &diag, wxString const& commit_ms
136136
void DialogAttachments::OnAttachFont(wxCommandEvent &) {
137137
wxFileDialog diag(&d,
138138
_("Choose file to be attached"),
139-
to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString()), "", "Font Files (*.ttf)|*.ttf",
139+
to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString()), "", _("Font Files") + " (*.ttf)|*.ttf",
140140
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
141141

142142
AttachFile(diag, _("attach font file"));
@@ -146,7 +146,7 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &) {
146146
wxFileDialog diag(&d,
147147
_("Choose file to be attached"),
148148
"", "",
149-
"Graphic Files (*.bmp, *.gif, *.jpg, *.ico, *.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf",
149+
_("Graphic Files") + " (*.bmp, *.gif, *.jpg, *.ico, *.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf",
150150
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
151151

152152
AttachFile(diag, _("attach graphics file"));
@@ -167,7 +167,7 @@ void DialogAttachments::OnExtract(wxCommandEvent &) {
167167
_("Select the path to save the file to:"),
168168
"Path/Fonts Collector Destination",
169169
ass->Attachments[i].GetFileName(),
170-
".ttf", "Font Files (*.ttf)|*.ttf",
170+
"", from_wx(_("All Supported Formats") + " (*.bmp, *.gif, *.jpg, *.ico, *.ttf, *.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.ttf;*.wmf|" + _("Font Files") + " (*.ttf)|*.ttf|" + _("Graphic Files") + " (*.bmp, *.gif, *.jpg, *.ico, *.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf"),
171171
&d);
172172
fullPath = true;
173173
}

src/dialog_automation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void DialogAutomation::OnAdd(wxCommandEvent &)
237237
OPT_SET("Path/Last/Automation")->SetString(fnpath.parent_path().string());
238238

239239
if (has_file(local_manager->GetScripts(), fnpath) || has_file(global_manager->GetScripts(), fnpath)) {
240-
wxLogError("Script '%s' is already loaded", fname);
240+
wxLogError(fmt_tl("Script '%s' is already loaded", fname));
241241
continue;
242242
}
243243

src/dialog_dummy_video.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ struct ResolutionShortcut {
6868
};
6969

7070
static ResolutionShortcut resolutions[] = {
71-
{L"640\u00D7480 (SD fullscreen)", 640, 480}, // U+00D7 multiplication sign
72-
{L"704\u00D7480 (SD anamorphic)", 704, 480},
73-
{L"640\u00D7360 (SD widescreen)", 640, 360},
74-
{L"704\u00D7396 (SD widescreen)", 704, 396},
75-
{L"640\u00D7352 (SD widescreen MOD16)", 640, 352},
76-
{L"704\u00D7400 (SD widescreen MOD16)", 704, 400},
77-
{L"1024\u00D7576 (SuperPAL widescreen)", 1024, 576},
78-
{L"1280\u00D7720 (HD 720p)", 1280, 720},
79-
{L"1920\u00D71080 (FHD 1080p)", 1920, 1080},
80-
{L"2560\u00D71440 (QHD 1440p)", 2560, 1440},
81-
{L"3840\u00D72160 (4K UHD 2160p)", 3840, 2160},
82-
{L"1080\u00D71920 (FHD vertical)", 1080, 1920},
71+
{wxTRANSLATE(L"640\u00D7480 (SD fullscreen)"), 640, 480}, // U+00D7 multiplication sign
72+
{wxTRANSLATE(L"704\u00D7480 (SD anamorphic)"), 704, 480},
73+
{wxTRANSLATE(L"640\u00D7360 (SD widescreen)"), 640, 360},
74+
{wxTRANSLATE(L"704\u00D7396 (SD widescreen)"), 704, 396},
75+
{wxTRANSLATE(L"640\u00D7352 (SD widescreen MOD16)"), 640, 352},
76+
{wxTRANSLATE(L"704\u00D7400 (SD widescreen MOD16)"), 704, 400},
77+
{wxTRANSLATE(L"1024\u00D7576 (SuperPAL widescreen)"), 1024, 576},
78+
{wxTRANSLATE(L"1280\u00D7720 (HD 720p)"), 1280, 720},
79+
{wxTRANSLATE(L"1920\u00D71080 (FHD 1080p)"), 1920, 1080},
80+
{wxTRANSLATE(L"2560\u00D71440 (QHD 1440p)"), 2560, 1440},
81+
{wxTRANSLATE(L"3840\u00D72160 (4K UHD 2160p)"), 3840, 2160},
82+
{wxTRANSLATE(L"1080\u00D71920 (FHD vertical)"), 1080, 1920},
8383
};
8484

8585
wxSpinCtrl *spin_ctrl(wxWindow *parent, int min, int max, int *value) {
@@ -92,7 +92,7 @@ wxComboBox *resolution_shortcuts(wxWindow *parent, int width, int height) {
9292
wxComboBox *ctrl = new wxComboBox(parent, -1, "", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
9393

9494
for (auto const& res : resolutions) {
95-
ctrl->Append(res.name);
95+
ctrl->Append(wxGetTranslation(res.name));
9696
if (res.width == width && res.height == height)
9797
ctrl->SetSelection(ctrl->GetCount() - 1);
9898
}

src/dialog_export.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ void DialogExport::OnProcess(wxCommandEvent &) {
199199
}
200200
catch (agi::UserCancelException const&) { }
201201
catch (agi::Exception const& err) {
202-
wxMessageBox(to_wx(err.GetMessage()), "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, &d);
202+
wxMessageBox(to_wx(err.GetMessage()), _("Error exporting subtitles"), wxOK | wxICON_ERROR | wxCENTER, &d);
203203
}
204204
catch (std::exception const& err) {
205-
wxMessageBox(to_wx(err.what()), "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, &d);
205+
wxMessageBox(to_wx(err.what()), _("Error exporting subtitles"), wxOK | wxICON_ERROR | wxCENTER, &d);
206206
}
207207
catch (...) {
208-
wxMessageBox("Unknown error", "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, &d);
208+
wxMessageBox(_("Unknown error"), _("Error exporting subtitles"), wxOK | wxICON_ERROR | wxCENTER, &d);
209209
}
210210

211211
d.EndModal(0);

src/dialog_properties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ DialogProperties::DialogProperties(agi::Context *c)
135135
wxDefaultPosition, wxDefaultSize, to_wx(MatrixNames()), wxCB_READONLY);
136136

137137
auto matrix_sizer = new wxBoxSizer(wxHORIZONTAL);
138-
matrix_sizer->Add(new wxStaticText(&d, -1, "YCbCr Matrix:"), wxSizerFlags().Center());
138+
matrix_sizer->Add(new wxStaticText(&d, -1, _("YCbCr Matrix:")), wxSizerFlags().Center());
139139
matrix_sizer->Add(YCbCrMatrix, wxSizerFlags(1).Expand().Border(wxLEFT));
140140

141141
auto res_box = new wxStaticBoxSizer(wxVERTICAL, &d, _("Resolution"));

0 commit comments

Comments
 (0)