Skip to content

Commit

Permalink
bump chesto version, more i18n string changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vgmoose committed Mar 23, 2024
1 parent b22b249 commit a7814e3
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 43 deletions.
2 changes: 1 addition & 1 deletion gui/AboutScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ AboutScreen::~AboutScreen()
}
}

void AboutScreen::credHead(std::string& header, std::string& blurb)
void AboutScreen::credHead(const std::string& header, const std::string& blurb)
{
auto head = creditHeads.emplace(creditHeads.end());

Expand Down
2 changes: 1 addition & 1 deletion gui/AboutScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AboutScreen : public ListElement
void removeEmptyFolders();
void wipeCache();
void launchFeedback();
void credHead(std::string& header, std::string& blurb);
void credHead(const std::string& header, const std::string& blurb);
void credit(const char* username,
const char* githubId,
const char* twitter = NULL,
Expand Down
8 changes: 4 additions & 4 deletions gui/AppDetails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ AppDetails::AppDetails(Package& package, AppList* appList, AppCard* appCard)
download.position(SCREEN_WIDTH - 310, SCREEN_HEIGHT - 250);
cancel.position(SCREEN_WIDTH - 310, SCREEN_HEIGHT - 90);

const char* buttonLabel = "Launch";
std::string buttonLabel = i18n("details.launch");
bool injectorPresent = false;

if (isTheme) // should only happen on switch
{
auto installer = get->lookup("NXthemes_Installer");
injectorPresent = installer ? true : false; // whether or not the currently hardcoded installer package exists, in the future becomes something functionality-based like "theme_installer"
buttonLabel = (injectorPresent && installer->getStatus() == GET) ? "Injector" : "Inject";
buttonLabel = (injectorPresent && installer->getStatus() == GET) ? i18n("details.injector") : i18n("details.inject");
}

// show the third button if a binary is present, or a theme injector is available (installed or not)
Expand Down Expand Up @@ -233,8 +233,8 @@ void AppDetails::launch()

if (!successLaunch)
{
printf("Failed to launch.");
errorText = new TextElement("Couldn't launch app", 24, &red, false, 300);
// printf("Failed to launch.");
errorText = new TextElement(i18n("errors.applaunch"), 24, &red, false, 300);
errorText->position(970, 430);
super::append(errorText);
this->canLaunch = false;
Expand Down
38 changes: 21 additions & 17 deletions gui/AppDetailsContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ std::string getTrimmedDetails(AppDetailsContent* content, std::string details)
}

AppDetailsContent::AppDetailsContent(Package *package, bool useBannerIcons)
: reportIssue("Report Issue", L_BUTTON)
, moreByAuthor("More by Author", R_BUTTON)
: reportIssue(i18n("contents.report"), L_BUTTON)
, moreByAuthor(i18n("more"), R_BUTTON)
, title(package->getTitle().c_str(), 35, &HBAS::ThemeManager::textPrimary)
, title2(package->getAuthor().c_str(), 27, &HBAS::ThemeManager::textSecondary)
, details("Package long description", 20 / SCALER, &HBAS::ThemeManager::textPrimary, false, PANE_WIDTH + 20 / SCALER)
, changelog("If you're reading this text, something is wrong", 20 / SCALER, &HBAS::ThemeManager::textPrimary, false, PANE_WIDTH + 20 / SCALER)
, showFiles("Show Installed Files List", ZL_BUTTON, false, 15)
, showChangelog("Show Changelog", ZR_BUTTON, false, 15)
, details(i18n("contents.placeholder1"), 20 / SCALER, &HBAS::ThemeManager::textPrimary, false, PANE_WIDTH + 20 / SCALER)
, changelog(i18n("contents.placeholder2"), 20 / SCALER, &HBAS::ThemeManager::textPrimary, false, PANE_WIDTH + 20 / SCALER)
, showFiles(i18n("contents.showinstalled"), ZL_BUTTON, false, 15)
, showChangelog(i18n("contents.showchangelog"), ZR_BUTTON, false, 15)
, banner(useBannerIcons ? package->getBannerUrl().c_str() : package->getIconUrl().c_str(), [package]{
// If the banner fails to load, use an icon banner
NetImageElement* icon = new NetImageElement(package->getIconUrl().c_str(), []{
Expand All @@ -64,7 +64,7 @@ AppDetailsContent::AppDetailsContent(Package *package, bool useBannerIcons)
return icon;
})
, screenshotsContainer(COL_LAYOUT, 20)
, viewSSButton("Read More...", Y_BUTTON, false, 15)
, viewSSButton(i18n("contents.readmore"), Y_BUTTON, false, 15)
{
title.position(MARGIN, 30);
super::append(&title);
Expand Down Expand Up @@ -163,7 +163,7 @@ AppDetailsContent::AppDetailsContent(Package *package, bool useBannerIcons)
screenshot->position(0, 0);
subParent->child(screenshot);

Button* dismiss = new Button("Back", B_BUTTON, false, 15);
Button* dismiss = new Button(i18n("details.back"), B_BUTTON, false, 15);
auto appDetails = RootDisplay::subscreen;
dismiss->action = [this, appDetails, subParent] {
appDetails->remove(subParent);
Expand Down Expand Up @@ -253,17 +253,19 @@ bool AppDetailsContent::process(InputEvents* event)
if (expandedReadMore) {
viewSSButton.hidden = true;
} else {
auto readMoreText = i18n("contents.readmore");
// no screenshot is on screen, so get our button out of there
viewSSButton.position((banner.x + banner.width)/2 - viewSSButton.width/4, (details.y + details.height + 20));
if (viewSSButton.getText() != "Read More...") {
viewSSButton.updateText("Read More...");
if (viewSSButton.getText() != readMoreText) {
viewSSButton.updateText(readMoreText.c_str());
}
curScreenIdx = 0;
}
} else {
// if we have a screenshot on screen, let's update the View button's position
if (viewSSButton.getText() != "View") {
viewSSButton.updateText("View");
auto viewText = i18n("contents.view");
if (viewSSButton.getText() != viewText) {
viewSSButton.updateText(viewText.c_str());
}
viewSSButton.position(
screenshotsContainer.x + curScreenshot->x + curScreenshot->width - viewSSButton.width - 5,
Expand Down Expand Up @@ -293,8 +295,10 @@ bool AppDetailsContent::process(InputEvents* event)
void AppDetailsContent::switchExtraInfo(Package* package, int newState) {

// update button text
showFiles.updateText((std::string(newState == SHOW_LIST_OF_FILES ? "Hide" : "Show") + " Installed Files List").c_str());
showChangelog.updateText((std::string(newState == SHOW_CHANGELOG ? "Hide" : "Show") + " Changelog").c_str());
auto hideText = i18n("contents.hide");
auto showText = i18n("contents.show");
showFiles.updateText((std::string(newState == SHOW_LIST_OF_FILES ? hideText : showText) + " " + i18n("contents.showinstalled ")).c_str());
showChangelog.updateText((std::string(newState == SHOW_CHANGELOG ? hideText : showText) + " " + i18n("contents.changelog")).c_str());

// hide/show changelog text based on if neither is true
changelog.hidden = newState == SHOW_NEITHER;
Expand All @@ -303,7 +307,7 @@ void AppDetailsContent::switchExtraInfo(Package* package, int newState) {
// update the "changelog" text depending on which action we're doing
if (newState == SHOW_CHANGELOG)
{
changelog.setText(std::string("Changelog:\n") + package->getChangelog().c_str());
changelog.setText(std::string(i18n("contents.changelog") + ":\n") + package->getChangelog().c_str());
changelog.setFont(NORMAL);
changelog.update();
}
Expand All @@ -315,7 +319,7 @@ void AppDetailsContent::switchExtraInfo(Package* package, int newState) {
// (LOCAL -> UPDATE packages won't have a manifest)
auto status = package->getStatus();
if ((status == INSTALLED || status == UPDATE) && package->manifest .isValid()) {
allEntries << "Currently Installed Files:\n";
allEntries << i18n("contents.files.current") + "\n";
for (auto &entry : package->manifest.getEntries()) {
allEntries << entry.raw << "\n";
}
Expand All @@ -326,7 +330,7 @@ void AppDetailsContent::switchExtraInfo(Package* package, int newState) {
// manifest is either non-local, or we need to display both, download it from the server
std::string data("");
downloadFileToMemory(package->getManifestUrl().c_str(), &data);
allEntries << "Manifest of Remote Files:\n" << data;
allEntries << i18n("contents.files.remote") + "\n" << data;
}

changelog.setText(std::string("") + allEntries.str().c_str());
Expand Down
2 changes: 1 addition & 1 deletion gui/AppList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ void AppList::update()

// category text
category.position(20, 90);
category.setText(std::string("Search: \"") + sidebar->searchQuery + "\"");
category.setText(std::string(i18n("listing.search") + " \"") + sidebar->searchQuery + "\"");
category.update();
super::append(&category);

Expand Down
2 changes: 1 addition & 1 deletion gui/FeedbackCenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ FeedbackCenter::FeedbackCenter(AppList* appList)
child(header);

// back button
child((new Button("Back", B_BUTTON, true))->setPosition(35, 15)->setAction([]{
child((new Button(i18n("details.back"), B_BUTTON, true))->setPosition(35, 15)->setAction([]{
RootDisplay::switchSubscreen(nullptr);
}));

Expand Down
25 changes: 13 additions & 12 deletions gui/MainDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using namespace std::string_literals; // for ""s

MainDisplay::MainDisplay()
: appList(NULL, &sidebar)
: RootDisplay(), appList(NULL, &sidebar)
{
// add in the sidebar, footer, and main app listing
sidebar.appList = &appList;
Expand Down Expand Up @@ -224,13 +224,14 @@ bool MainDisplay::process(InputEvents* event)

if (!isOnline)
{
RootDisplay::switchSubscreen(new ErrorScreen("Couldn't connect to the Internet!", "Perform a connection test in the " PLATFORM " System Settings\nEnsure DNS isn't blocking: "s + META_REPO));
std::string connTestMsg = replaceAll(i18n("errors.conntest"), "PLATFORM", PLATFORM);
RootDisplay::switchSubscreen(new ErrorScreen(i18n("errors.nowifi"), connTestMsg + "\n" + i18n("errors.dnsmsg") + " " + META_REPO));
return true;
}

if (!atLeastOneEnabled)
{
RootDisplay::switchSubscreen(new ErrorScreen("Couldn't connect to a server!", "No enabled repos found, check ./get/repos.json\nMake sure repo has at least one package"));
RootDisplay::switchSubscreen(new ErrorScreen(i18n("errors.noserver"), i18n("errors.norepos") + "\n" + i18n("errors.onepkg")));
return true;
}

Expand Down Expand Up @@ -264,15 +265,15 @@ bool MainDisplay::process(InputEvents* event)
}
else writeFailed = true;

if (writeFailed) {
std::string cardText = "Ensure "s + tmp_file + " is writable";
if (writeFailed || true) {
std::string cardText = replaceAll(i18n("errors.writetestfail"), "PATH", tmp_file) + "\n";
#if defined(__WIIU__)
cardText = "Check the physical SD write lock slider\n"s + cardText;
cardText = i18n("errors.sdlock") + "\n"s + cardText;
#elif defined (SWITCH)
cardText = "Check for EXFAT FS corruption (no issues on FAT32)\n"s + cardText;
cardText = i18n("errors.exfat") + "\n"s + cardText;
#endif

RootDisplay::switchSubscreen(new ErrorScreen("Cannot access SD card!"s, cardText));
RootDisplay::switchSubscreen(new ErrorScreen(i18n("errors.sdaccess"), cardText));
return true;
}

Expand Down Expand Up @@ -316,10 +317,10 @@ int MainDisplay::updateLoader(void* clientp, double dltotal, double dlnow, doubl

ErrorScreen::ErrorScreen(std::string mainErrorText, std::string troubleshootingText)
: icon(RAMFS "res/icon.png")
, title("Homebrew App Store", 50 - 25)
, title(i18n("credits.title"), 50 - 25)
, errorMessage(mainErrorText.c_str(), 40)
, troubleshooting((std::string("Troubleshooting:\n") + troubleshootingText).c_str(), 20, NULL, false, 600)
, btnQuit("Quit", SELECT_BUTTON, false, 15)
, troubleshooting((std::string(i18n("errors.troubleshooting") + "\n") + troubleshootingText).c_str(), 20, NULL, false, 600)
, btnQuit(i18n("listing.quit"), SELECT_BUTTON, false, 15)
{
Container* logoCon = new Container(ROW_LAYOUT, 10);
icon.resize(35, 35);
Expand All @@ -332,7 +333,7 @@ ErrorScreen::ErrorScreen(std::string mainErrorText, std::string troubleshootingT
troubleshooting.constrain(ALIGN_BOTTOM | ALIGN_CENTER_HORIZONTAL, 40);
btnQuit.constrain(ALIGN_LEFT | ALIGN_BOTTOM, 100);

super::append((new Button("Ignore This", X_BUTTON, false, 15))
super::append((new Button(i18n("errors.ignorethis"), X_BUTTON, false, 15))
->constrain(ALIGN_RIGHT | ALIGN_BOTTOM, 100)
->setAction([]() {
auto mainDisplay = (MainDisplay*)RootDisplay::mainDisplay;
Expand Down
4 changes: 2 additions & 2 deletions gui/Sidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Sidebar::Sidebar()

if (isEarthDay()) {
// easter egg for earth day https://www.earthday.org
title.setText("Happy Earth Day!");
title.setText(i18n("listing.earthday").c_str());
title.update();

// draw a an icon over the logo
Expand Down Expand Up @@ -94,7 +94,7 @@ void Sidebar::addHints()
hider->position(270, SCREEN_HEIGHT - 35);
super::append(hider);

hint = new TextElement("Hide", 15);
hint = new TextElement(i18n("contents.hide"), 15);
hint->position(hider->x + hider->width + 5, hider->y);
super::append(hint);

Expand Down
2 changes: 1 addition & 1 deletion libs/chesto
19 changes: 16 additions & 3 deletions resin/res/i18n/en-us.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ details.reloading = Reloading Metadata
details.syncing = Syncing Packages
details.analyzing = Analyzing Files
; Action buttons
details.launch = Launch
details.inject = Inject
details.injector = Injector
; App Details Contents
contents.report = Report Issue
contents.more = More by Author
Expand Down Expand Up @@ -72,13 +77,14 @@ listing.sort.size = by size (descending)
listing.sort.random = randomly
listing.quit = Quit
listing.credits = Credits
listing.delete = Del
listing.delete = Del
listing.adjustsort = Adjust Sort
listing.togglekeyboard = Toggle Keyboard
listing.search = Search:
listing.by = by
listing.appletwarning = NOTICE: You are in Applet mode! Google "Switch Applet Mode" for more info.
listing.debugwarning = NOTICE: You are using a dev build! Update to a stable release if this is unintended.
listing.earthday = Happy Earth Day!

; Feedback page
feedback.leaving = Leaving feedback for:
Expand All @@ -89,12 +95,19 @@ feedback.caps = Caps
feedback.help = If you need to send more detailed feedback, please email us at fight@fortheusers.org

; Error Messages
errors.conntest = Perform a connection test in the Generic System Settings
errors.dnsmsg = Ensure DNS isn't blocking:
errors.conntest = Perform a connection test in the PLATFORM System Settings
errors.dnsmsg = Ensure DNS isn't blocking:
errors.norepos = No enabled repos found, check ./get/repos.json
errors.onepkg = Make sure repo has at least one package
errors.nowifi = Couldn't connect to the Internet!
errors.noserver = Couldn't connect to a server!
errors.troubleshooting = Troubleshooting:
errors.ignorethis = Ignore This
errors.writetestfail = Ensure "PATH" is writable
errors.sdaccess = Cannot access SD card!
errors.sdlock = Check the physical SD write lock slider
errors.exfat = Check for EXFAT FS corruption (no issues on FAT32)
errors.applaunch = Couldn't launch app

; Sidebar Categories
sidebar.search = Search
Expand Down

0 comments on commit a7814e3

Please sign in to comment.