Almost all strings for translation. (#32)

* Almost all strings for translation

* Remove nonexistent strings.

---------

Co-authored-by: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com>
This commit is contained in:
Yorunokyujitsu
2024-12-22 01:49:48 +09:00
committed by GitHub
parent 79da00e098
commit c8ae2a7872
24 changed files with 1878 additions and 838 deletions

View File

@@ -251,18 +251,18 @@ void App::Loop() {
switch (arg.type) {
case NxlinkCallbackType_Connected:
log_write("[NxlinkCallbackType_Connected]\n");
App::Notify("Nxlink Connected");
App::Notify("Nxlink Connected"_i18n);
break;
case NxlinkCallbackType_WriteBegin:
log_write("[NxlinkCallbackType_WriteBegin] %s\n", arg.file.filename);
App::Notify("Nxlink Upload");
App::Notify("Nxlink Upload"_i18n);
break;
case NxlinkCallbackType_WriteProgress:
// log_write("[NxlinkCallbackType_WriteProgress]\n");
break;
case NxlinkCallbackType_WriteEnd:
log_write("[NxlinkCallbackType_WriteEnd] %s\n", arg.file.filename);
App::Notify("Nxlink Finished");
App::Notify("Nxlink Finished"_i18n);
break;
}
} else if constexpr(std::is_same_v<T, DownloadEventData>) {
@@ -446,10 +446,10 @@ auto App::Install(OwoConfig& config) -> Result {
if (R_FAILED(rc)) {
App::PlaySoundEffect(SoundEffect_Error);
App::Push(std::make_shared<ui::ErrorBox>(rc, "Failed to install forwarder"));
App::Push(std::make_shared<ui::ErrorBox>(rc, "Failed to install forwarder"_i18n));
} else {
App::PlaySoundEffect(SoundEffect_Install);
App::Notify("Installed!");
App::Notify("Installed!"_i18n);
}
return rc;
@@ -476,10 +476,10 @@ auto App::Install(ui::ProgressBox* pbox, OwoConfig& config) -> Result {
if (R_FAILED(rc)) {
App::PlaySoundEffect(SoundEffect_Error);
App::Push(std::make_shared<ui::ErrorBox>(rc, "Failed to install forwarder"));
App::Push(std::make_shared<ui::ErrorBox>(rc, "Failed to install forwarder"_i18n));
} else {
App::PlaySoundEffect(SoundEffect_Install);
App::Notify("Installed!");
App::Notify("Installed!"_i18n);
}
return rc;

View File

@@ -11,6 +11,7 @@
#include "defines.hpp"
#include "app.hpp"
#include "ui/progress_box.hpp"
#include "i18n.hpp"
namespace sphaira {
namespace {
@@ -1027,7 +1028,7 @@ auto install_forwader_internal(ui::ProgressBox* pbox, OwoConfig& config, NcmStor
R_UNLESS(!config.main.empty(), OwoError_BadArgs);
R_UNLESS(!config.npdm.empty(), OwoError_BadArgs);
pbox->NewTransfer("Creating Program").UpdateTransfer(0, 8);
pbox->NewTransfer("Creating Program"_i18n).UpdateTransfer(0, 8);
FileEntries exefs;
add_file_entry(exefs, "main", config.main);
add_file_entry(exefs, "main.npdm", config.npdm);
@@ -1059,7 +1060,7 @@ auto install_forwader_internal(ui::ProgressBox* pbox, OwoConfig& config, NcmStor
// create control
{
pbox->NewTransfer("Creating Control").UpdateTransfer(1, 8);
pbox->NewTransfer("Creating Control"_i18n).UpdateTransfer(1, 8);
// patch nacp
NcapPatch nacp_patch{};
nacp_patch.tid = tid;
@@ -1082,7 +1083,7 @@ auto install_forwader_internal(ui::ProgressBox* pbox, OwoConfig& config, NcmStor
NcmContentStorageRecord content_storage_record;
NcmContentMetaData content_meta_data;
{
pbox->NewTransfer("Creating Meta").UpdateTransfer(2, 8);
pbox->NewTransfer("Creating Meta"_i18n).UpdateTransfer(2, 8);
const auto meta_entry = create_meta_nca(tid, key, storage_id, nca_entries);
nca_entries.emplace_back(meta_entry.nca_entry);
@@ -1099,7 +1100,7 @@ auto install_forwader_internal(ui::ProgressBox* pbox, OwoConfig& config, NcmStor
ON_SCOPE_EXIT(ncmContentStorageClose(&cs));
for (const auto& nca : nca_entries) {
pbox->NewTransfer("Writing Nca").UpdateTransfer(3, 8);
pbox->NewTransfer("Writing Nca"_i18n).UpdateTransfer(3, 8);
NcmContentId content_id;
NcmPlaceHolderId placeholder_id;
std::memcpy(&content_id, nca.hash, sizeof(content_id));
@@ -1114,7 +1115,7 @@ auto install_forwader_internal(ui::ProgressBox* pbox, OwoConfig& config, NcmStor
// setup database
{
pbox->NewTransfer("Updating ncm databse").UpdateTransfer(4, 8);
pbox->NewTransfer("Updating ncm databse"_i18n).UpdateTransfer(4, 8);
NcmContentMetaDatabase db;
R_TRY(ncmOpenContentMetaDatabase(&db, storage_id));
ON_SCOPE_EXIT(ncmContentMetaDatabaseClose(&db));
@@ -1125,7 +1126,7 @@ auto install_forwader_internal(ui::ProgressBox* pbox, OwoConfig& config, NcmStor
// push record
{
pbox->NewTransfer("Pushing application record").UpdateTransfer(5, 8);
pbox->NewTransfer("Pushing application record"_i18n).UpdateTransfer(5, 8);
Service srv{}, *srv_ptr = &srv;
bool already_installed{};
@@ -1166,7 +1167,7 @@ auto install_forwarder(ui::ProgressBox* pbox, OwoConfig& config, NcmStorageId st
}
auto install_forwarder(OwoConfig& config, NcmStorageId storage_id) -> Result {
App::Push(std::make_shared<ui::ProgressBox>("Installing Forwarder", [config, storage_id](auto pbox) mutable -> bool {
App::Push(std::make_shared<ui::ProgressBox>("Installing Forwarder"_i18n, [config, storage_id](auto pbox) mutable -> bool {
return R_SUCCEEDED(install_forwarder(pbox, config, storage_id));
}));
R_SUCCEED();

View File

@@ -370,7 +370,7 @@ auto UninstallApp(ProgressBox* pbox, const Entry& entry) -> bool {
// remove directory, this will also delete manifest and info
const auto dir = BuildPackageCachePath(entry);
pbox->NewTransfer("Removing " + dir);
pbox->NewTransfer("Removing "_i18n + dir);
if (R_FAILED(fs.DeleteDirectoryRecursively(dir))) {
log_write("failed to delete folder: %s\n", dir);
} else {
@@ -394,7 +394,7 @@ auto InstallApp(ProgressBox* pbox, const Entry& entry) -> bool {
// 1. download the zip
if (!pbox->ShouldExit()) {
pbox->NewTransfer("Downloading " + entry.title);
pbox->NewTransfer("Downloading "_i18n + entry.title);
log_write("starting download\n");
const auto url = BuildZipUrl(entry);
@@ -416,7 +416,7 @@ auto InstallApp(ProgressBox* pbox, const Entry& entry) -> bool {
// 2. md5 check the zip
if (!pbox->ShouldExit()) {
pbox->NewTransfer("Checking MD5");
pbox->NewTransfer("Checking MD5"_i18n);
log_write("starting md5 check\n");
FsFile f;
@@ -792,11 +792,11 @@ void EntryMenu::Draw(NVGcontext* vg, Theme* theme) {
// gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "author: %s", m_entry.author.c_str());
// text_start_y += text_inc_y;
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "version: %s", m_entry.version.c_str());
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "version: %s"_i18n.c_str(), m_entry.version.c_str());
text_start_y += text_inc_y;
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "updated: %s", m_entry.updated.c_str());
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "updated: %s"_i18n.c_str(), m_entry.updated.c_str());
text_start_y += text_inc_y;
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "category: %s", m_entry.category.c_str());
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "category: %s"_i18n.c_str(), m_entry.category.c_str());
text_start_y += text_inc_y;
// gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "license: %s", m_entry.license.c_str());
// text_start_y += text_inc_y;
@@ -804,9 +804,9 @@ void EntryMenu::Draw(NVGcontext* vg, Theme* theme) {
// text_start_y += text_inc_y;
// gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "filesize: %.2f MiB", (double)m_entry.filesize / 1024.0);
// text_start_y += text_inc_y;
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "extracted: %.2f MiB", (double)m_entry.extracted / 1024.0);
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "extracted: %.2f MiB"_i18n.c_str(), (double)m_entry.extracted / 1024.0);
text_start_y += text_inc_y;
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "app_dls: %s", AppDlToStr(m_entry.app_dls).c_str());
gfx::drawTextArgs(vg, text_start_x, text_start_y, font_size, NVG_ALIGN_LEFT | NVG_ALIGN_TOP, theme->elements[ThemeEntryID_TEXT].colour, "app_dls: %s"_i18n.c_str(), AppDlToStr(m_entry.app_dls).c_str());
text_start_y += text_inc_y;
// for (const auto& option : m_options) {
@@ -935,7 +935,7 @@ auto toLower(const std::string& str) -> std::string {
return lower;
}
Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"AppStore"}, m_nro_entries{nro_entries} {
Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"AppStore"_i18n}, m_nro_entries{nro_entries} {
fs::FsNativeSd fs;
fs.CreateDirectoryRecursively("/switch/sphaira/cache/appstore/icons");
fs.CreateDirectoryRecursively("/switch/sphaira/cache/appstore/banners");
@@ -1136,12 +1136,12 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
MenuBase::Draw(vg, theme);
if (m_entries.empty()) {
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Loading...");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Loading..."_i18n.c_str());
return;
}
if (m_entries_current.empty()) {
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Empty!");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Empty!"_i18n.c_str());
return;
}
@@ -1431,7 +1431,7 @@ void Menu::Sort() {
char subheader[128]{};
std::snprintf(subheader, sizeof(subheader), "Sort: %s | Filter: %s | Order: %s", i18n::get(SORT_STR[m_sort]).c_str(), i18n::get(FILTER_STR[m_filter]).c_str(), i18n::get(ORDER_STR[m_order]).c_str());
std::snprintf(subheader, sizeof(subheader), "Filter: %s | Sort: %s | Order: %s"_i18n.c_str(), i18n::get(FILTER_STR[m_filter]).c_str(), i18n::get(SORT_STR[m_sort]).c_str(), i18n::get(ORDER_STR[m_order]).c_str());
SetTitleSubHeading(subheader);
std::sort(m_entries_current.begin(), m_entries_current.end(), sorter);

View File

@@ -1,4 +1,5 @@
#include "ui/menus/file_viewer.hpp"
#include "i18n.hpp"
namespace sphaira::ui::menu::fileview {
namespace {
@@ -6,7 +7,7 @@ namespace {
} // namespace
Menu::Menu(const fs::FsPath& path) : MenuBase{path}, m_path{path} {
SetAction(Button::B, Action{"Back", [this](){
SetAction(Button::B, Action{"Back"_i18n, [this](){
SetPop();
}});

View File

@@ -469,17 +469,17 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"FileBrowser"_i1
options->Add(std::make_shared<SidebarEntryBool>("Show Hidden"_i18n, m_show_hidden.Get(), [this](bool& v_out){
m_show_hidden.Set(v_out);
SortAndFindLastFile();
}, "Yes"_i18n, "No"));
}, "Yes"_i18n, "No"_i18n));
options->Add(std::make_shared<SidebarEntryBool>("Folders First"_i18n, m_folders_first.Get(), [this](bool& v_out){
m_folders_first.Set(v_out);
SortAndFindLastFile();
}, "Yes"_i18n, "No"));
}, "Yes"_i18n, "No"_i18n));
options->Add(std::make_shared<SidebarEntryBool>("Hidden Last"_i18n, m_hidden_last.Get(), [this](bool& v_out){
m_hidden_last.Set(v_out);
SortAndFindLastFile();
}, "Yes"_i18n, "No"));
}, "Yes"_i18n, "No"_i18n));
}));
if (m_entries_current.size()) {
@@ -519,7 +519,7 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"FileBrowser"_i1
if (!m_selected_files.empty() && (m_selected_type == SelectedType::Cut || m_selected_type == SelectedType::Copy)) {
options->Add(std::make_shared<SidebarEntryCallback>("Paste"_i18n, [this](){
const std::string buf = "Paste " + std::to_string(m_selected_files.size()) + " file(s)?";
const std::string buf = "Paste "_i18n + std::to_string(m_selected_files.size()) + " file(s)?"_i18n;
App::Push(std::make_shared<OptionBox>(
buf, "No"_i18n, "Yes"_i18n, 1, [this](auto op_index){
if (op_index && *op_index) {
@@ -535,7 +535,7 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"FileBrowser"_i1
std::string out;
const auto& entry = GetEntry();
const auto name = entry.GetName();
if (R_SUCCEEDED(swkbd::ShowText(out, "Set New File Name", name.c_str())) && !out.empty() && out != name) {
if (R_SUCCEEDED(swkbd::ShowText(out, "Set New File Name"_i18n.c_str(), name.c_str())) && !out.empty() && out != name) {
const auto src_path = GetNewPath(entry);
const auto dst_path = GetNewPath(m_path, out);
@@ -563,7 +563,7 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"FileBrowser"_i1
options->Add(std::make_shared<SidebarEntryCallback>("Create File"_i18n, [this](){
std::string out;
if (R_SUCCEEDED(swkbd::ShowText(out, "Set File Name")) && !out.empty()) {
if (R_SUCCEEDED(swkbd::ShowText(out, "Set File Name"_i18n.c_str())) && !out.empty()) {
fs::FsPath full_path;
if (out[0] == '/') {
full_path = out;
@@ -584,7 +584,7 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"FileBrowser"_i1
options->Add(std::make_shared<SidebarEntryCallback>("Create Folder"_i18n, [this](){
std::string out;
if (R_SUCCEEDED(swkbd::ShowText(out, "Set Folder Name")) && !out.empty()) {
if (R_SUCCEEDED(swkbd::ShowText(out, "Set Folder Name"_i18n.c_str())) && !out.empty()) {
fs::FsPath full_path;
if (out[0] == '/') {
full_path = out;
@@ -687,7 +687,7 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
const auto& text_col = theme->elements[ThemeEntryID_TEXT].colour;
if (m_entries_current.empty()) {
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, text_col, "Empty...");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, text_col, "Empty..."_i18n.c_str());
return;
}
@@ -779,8 +779,8 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
nvgRestore(vg);
if (e.IsDir()) {
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) - 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_BOTTOM, theme->elements[text_id].colour, "%zd files", e.file_count);
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) + 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP, theme->elements[text_id].colour, "%zd dirs", e.dir_count);
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) - 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_BOTTOM, theme->elements[text_id].colour, "%zd files"_i18n.c_str(), e.file_count);
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) + 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP, theme->elements[text_id].colour, "%zd dirs"_i18n.c_str(), e.dir_count);
} else {
if (!e.time_stamp.is_valid) {
fs::FsNativeSd fs;
@@ -877,7 +877,7 @@ void Menu::InstallForwarder() {
if (op_index) {
const auto assoc = assoc_list[*op_index];
log_write("pushing it\n");
App::Push(std::make_shared<ProgressBox>("Installing Forwarder", [assoc, this](auto pbox) -> bool {
App::Push(std::make_shared<ProgressBox>("Installing Forwarder"_i18n, [assoc, this](auto pbox) -> bool {
log_write("inside callback\n");
NroEntry nro{};
@@ -1325,7 +1325,7 @@ void Menu::OnDeleteCallback() {
Scan(m_path);
log_write("did delete\n");
} else {
App::Push(std::make_shared<ProgressBox>("Deleting", [this](auto pbox){
App::Push(std::make_shared<ProgressBox>("Deleting"_i18n, [this](auto pbox){
fs::FsNativeSd fs;
FsDirCollections collections;
@@ -1338,7 +1338,7 @@ void Menu::OnDeleteCallback() {
const auto full_path = GetNewPath(m_selected_path, p.name);
if (p.IsDir()) {
pbox->NewTransfer("Scanning " + full_path);
pbox->NewTransfer("Scanning "_i18n + full_path);
if (R_FAILED(get_collections(full_path, p.name, collections))) {
log_write("failed to get dir collection: %s\n", full_path);
return false;
@@ -1356,7 +1356,7 @@ void Menu::OnDeleteCallback() {
}
const auto full_path = GetNewPath(c.path, p.name);
pbox->NewTransfer("Deleting " + full_path);
pbox->NewTransfer("Deleting "_i18n + full_path);
if (p.type == FsDirEntryType_Dir) {
log_write("deleting dir: %s\n", full_path);
fs.DeleteDirectory(full_path);
@@ -1383,7 +1383,7 @@ void Menu::OnDeleteCallback() {
}
const auto full_path = GetNewPath(m_selected_path, p.name);
pbox->NewTransfer("Deleting " + full_path);
pbox->NewTransfer("Deleting "_i18n + full_path);
if (p.IsDir()) {
log_write("deleting dir: %s\n", full_path);
@@ -1422,7 +1422,7 @@ void Menu::OnPasteCallback() {
Scan(m_path);
log_write("did paste\n");
} else {
App::Push(std::make_shared<ProgressBox>("Pasting", [this](auto pbox){
App::Push(std::make_shared<ProgressBox>("Pasting"_i18n, [this](auto pbox){
fs::FsNativeSd fs;
if (m_selected_type == SelectedType::Cut) {
@@ -1435,7 +1435,7 @@ void Menu::OnPasteCallback() {
const auto src_path = GetNewPath(m_selected_path, p.name);
const auto dst_path = GetNewPath(m_path, p.name);
pbox->NewTransfer("Pasting " + src_path);
pbox->NewTransfer("Pasting "_i18n + src_path);
if (p.IsDir()) {
fs.RenameDirectory(src_path, dst_path);
@@ -1455,7 +1455,7 @@ void Menu::OnPasteCallback() {
const auto full_path = GetNewPath(m_selected_path, p.name);
if (p.IsDir()) {
pbox->NewTransfer("Scanning " + full_path);
pbox->NewTransfer("Scanning "_i18n + full_path);
if (R_FAILED(get_collections(full_path, p.name, collections))) {
log_write("failed to get dir collection: %s\n", full_path);
return false;
@@ -1473,10 +1473,10 @@ void Menu::OnPasteCallback() {
const auto dst_path = GetNewPath(p);
if (p.IsDir()) {
pbox->NewTransfer("Creating " + dst_path);
pbox->NewTransfer("Creating "_i18n + dst_path);
fs.CreateDirectory(dst_path);
} else {
pbox->NewTransfer("Copying " + src_path);
pbox->NewTransfer("Copying "_i18n + src_path);
R_TRY_RESULT(pbox->CopyFile(src_path, dst_path), false);
}
}
@@ -1495,7 +1495,7 @@ void Menu::OnPasteCallback() {
const auto dst_path = GetNewPath(base_dst_path, p.name);
log_write("creating: %s to %s\n", src_path, dst_path);
pbox->NewTransfer("Creating " + dst_path);
pbox->NewTransfer("Creating "_i18n + dst_path);
fs.CreateDirectory(dst_path);
}
@@ -1508,7 +1508,7 @@ void Menu::OnPasteCallback() {
const auto src_path = GetNewPath(c.path, p.name);
const auto dst_path = GetNewPath(base_dst_path, p.name);
pbox->NewTransfer("Copying " + src_path);
pbox->NewTransfer("Copying "_i18n + src_path);
log_write("copying: %s to %s\n", src_path, dst_path);
R_TRY_RESULT(pbox->CopyFile(src_path, dst_path), false);
}

View File

@@ -112,7 +112,7 @@ Menu::Menu() : MenuBase{"Homebrew"_i18n} {
#endif
options->Add(std::make_shared<SidebarEntryCallback>("Delete"_i18n, [this](){
const auto buf = "Are you sure you want to delete "_i18n + m_entries[m_index].path.toString() + "?";
const auto buf = "Are you sure you want to delete " + m_entries[m_index].path.toString();
App::Push(std::make_shared<OptionBox>(
buf,
"Back"_i18n, "Delete"_i18n, 1, [this](auto op_index){

View File

@@ -242,7 +242,7 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
const auto rc = irsGetImageTransferProcessorState(m_entries[m_index].m_handle, m_irs_buffer.data(), m_irs_buffer.size(), &state);
if (R_SUCCEEDED(rc) && state.sampling_number != m_prev_state.sampling_number) {
m_prev_state = state;
SetSubHeading("Ambient Noise Level: " + std::to_string(m_prev_state.ambient_noise_level));
SetSubHeading("Ambient Noise Level: "_i18n + std::to_string(m_prev_state.ambient_noise_level));
updateColourArray();
}

View File

@@ -204,18 +204,19 @@ MainMenu::MainMenu() {
SidebarEntryArray::Items language_items;
language_items.push_back("Auto"_i18n);
language_items.push_back("English");
language_items.push_back("Japanese");
language_items.push_back("French");
language_items.push_back("German");
language_items.push_back("Italian");
language_items.push_back("Spanish");
language_items.push_back("Chinese");
language_items.push_back("Korean");
language_items.push_back("Dutch");
language_items.push_back("Portuguese");
language_items.push_back("Russian");
language_items.push_back("Swedish");
language_items.push_back("English"_i18n);
language_items.push_back("Japanese"_i18n);
language_items.push_back("French"_i18n);
language_items.push_back("German"_i18n);
language_items.push_back("Italian"_i18n);
language_items.push_back("Spanish"_i18n);
language_items.push_back("Chinese"_i18n);
language_items.push_back("Korean"_i18n);
language_items.push_back("Dutch"_i18n);
language_items.push_back("Portuguese"_i18n);
language_items.push_back("Russian"_i18n);
language_items.push_back("Swedish"_i18n);
options->AddHeader("Header"_i18n);
options->AddSpacer();
@@ -258,7 +259,7 @@ MainMenu::MainMenu() {
if (success) {
m_update_state = UpdateState::None;
} else {
App::Push(std::make_shared<ui::ErrorBox>(MAKERESULT(351, 1), "Failed to download update"));
App::Push(std::make_shared<ui::ErrorBox>(MAKERESULT(351, 1), "Failed to download update"_i18n));
}
}, 2));
}));

View File

@@ -508,7 +508,7 @@ Menu::Menu() : MenuBase{"Themezer"_i18n} {
options->Add(std::make_shared<SidebarEntryCallback>("Page"_i18n, [this](){
s64 out;
if (R_SUCCEEDED(swkbd::ShowNumPad(out, "Enter Page Number", nullptr, -1, 3))) {
if (R_SUCCEEDED(swkbd::ShowNumPad(out, "Enter Page Number"_i18n.c_str(), nullptr, -1, 3))) {
if (out < m_page_index_max) {
m_page_index = out;
PackListDownload();
@@ -569,7 +569,7 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
MenuBase::Draw(vg, theme);
if (m_pages.empty()) {
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Empty!");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Empty!"_i18n.c_str());
return;
}
@@ -577,15 +577,15 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
switch (page.m_ready) {
case PageLoadState::None:
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Not Ready...");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Not Ready..."_i18n.c_str());
return;
case PageLoadState::Loading:
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Loading");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Loading"_i18n.c_str());
return;
case PageLoadState::Done:
break;
case PageLoadState::Error:
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Error loading page!");
gfx::drawTextArgs(vg, SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 36.f, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE, gfx::Colour::YELLOW, "Error loading page!"_i18n.c_str());
return;
}
@@ -687,7 +687,7 @@ void Menu::InvalidateAllPages() {
void Menu::PackListDownload() {
const auto page_index = m_page_index + 1;
char subheading[128];
std::snprintf(subheading, sizeof(subheading), "Page %zu / %zu", m_page_index+1, m_page_index_max);
std::snprintf(subheading, sizeof(subheading), "Page %zu / %zu"_i18n.c_str(), m_page_index+1, m_page_index_max);
SetSubHeading(subheading);
m_index = 0;
@@ -733,7 +733,7 @@ void Menu::PackListDownload() {
m_page_index_max = a.pagination.page_count;
char subheading[128];
std::snprintf(subheading, sizeof(subheading), "Page %zu / %zu", m_page_index+1, m_page_index_max);
std::snprintf(subheading, sizeof(subheading), "Page %zu / %zu"_i18n.c_str(), m_page_index+1, m_page_index_max);
SetSubHeading(subheading);
log_write("a.pagination.page: %u\n", a.pagination.page);

View File

@@ -1,18 +1,19 @@
#include "ui/option_list.hpp"
#include "app.hpp"
#include "ui/nvg_util.hpp"
#include "i18n.hpp"
namespace sphaira::ui {
OptionList::OptionList(Options options)
: m_options{std::move(options)} {
SetAction(Button::A, Action{"Select", [this](){
SetAction(Button::A, Action{"Select"_i18n, [this](){
const auto& [_, func] = m_options[m_index];
func();
SetPop();
}});
SetAction(Button::B, Action{"Back", [this](){
SetAction(Button::B, Action{"Back"_i18n, [this](){
SetPop();
}});
}

View File

@@ -1,6 +1,7 @@
#include "ui/popup_list.hpp"
#include "ui/nvg_util.hpp"
#include "app.hpp"
#include "i18n.hpp"
namespace sphaira::ui {
@@ -68,13 +69,13 @@ PopupList::PopupList(std::string title, Items items, Callback cb, std::size_t in
m_scrollbar.Setup(Vec4{1220.f, m_line_top, 1.f, m_line_bottom - m_line_top}, m_block.h, m_items.size());
SetActions(
std::make_pair(Button::A, Action{"Select", [this](){
std::make_pair(Button::A, Action{"Select"_i18n, [this](){
if (m_callback) {
m_callback(m_index);
}
SetPop();
}}),
std::make_pair(Button::B, Action{"Back", [this](){
std::make_pair(Button::B, Action{"Back"_i18n, [this](){
if (m_callback) {
m_callback(std::nullopt);
}

View File

@@ -4,6 +4,7 @@
#include "app.hpp"
#include "defines.hpp"
#include "log.hpp"
#include "i18n.hpp"
namespace sphaira::ui {
namespace {
@@ -17,8 +18,8 @@ void threadFunc(void* arg) {
} // namespace
ProgressBox::ProgressBox(const std::string& title, ProgressBoxCallback callback, ProgressBoxDoneCallback done, int cpuid, int prio, int stack_size) {
SetAction(Button::B, Action{"Back", [this](){
App::Push(std::make_shared<OptionBox>("Are you sure you wish to cancel?", "No", "Yes", 1, [this](auto op_index){
SetAction(Button::B, Action{"Back"_i18n, [this](){
App::Push(std::make_shared<OptionBox>("Are you sure you wish to cancel?"_i18n, "No"_i18n, "Yes"_i18n, 1, [this](auto op_index){
if (op_index && *op_index) {
RequestExit();
SetPop();

View File

@@ -2,6 +2,7 @@
#include "app.hpp"
#include "ui/popup_list.hpp"
#include "ui/nvg_util.hpp"
#include "i18n.hpp"
namespace sphaira::ui {
namespace {
@@ -42,7 +43,7 @@ SidebarEntryBool::SidebarEntryBool(std::string title, bool option, Callback cb,
, m_true_str{std::move(true_str)}
, m_false_str{std::move(false_str)} {
SetAction(Button::A, Action{"OK", [this](){
SetAction(Button::A, Action{"OK"_i18n, [this](){
m_option ^= 1;
m_callback(m_option);
}
@@ -77,7 +78,7 @@ SidebarEntryCallback::SidebarEntryCallback(std::string title, Callback cb, bool
: SidebarEntryBase{std::move(title)}
, m_callback{cb}
, m_pop_on_click{pop_on_click} {
SetAction(Button::A, Action{"OK", [this](){
SetAction(Button::A, Action{"OK"_i18n, [this](){
m_callback();
if (m_pop_on_click) {
SetPop();
@@ -143,7 +144,7 @@ SidebarEntryArray::SidebarEntryArray(std::string title, Items items, Callback cb
));
};
SetAction(Button::A, Action{"OK", [this](){
SetAction(Button::A, Action{"OK"_i18n, [this](){
// m_callback(m_index);
m_list_callback();
}
@@ -191,7 +192,7 @@ Sidebar::Sidebar(std::string title, std::string sub, Side side, Items&& items)
m_base_pos = Vec4{GetX() + 30.f, GetY() + 170.f, m_pos.w - (30.f * 2.f), 70.f};
// each item has it's own Action, but we take over B
SetAction(Button::B, Action{"Back", [this](){
SetAction(Button::B, Action{"Back"_i18n, [this](){
SetPop();
}});