switchbrew / libnx

Library for Switch Homebrew
https://switchbrew.github.io/libnx/
ISC License
1.26k stars 167 forks source link

Use one other thing than the system Language with nacpGetLanguageEntry #616

Closed PoloNX closed 1 year ago

PoloNX commented 1 year ago

Hi, I have to fetch all titles installed on my switch for my homebrew SimpleModDownloader

But If I do one request with one jap/chinese name it wont works so I want to get the name of one game directly with one specific languages (en-US here)

yellows8 commented 1 year ago

But If I do one request with one jap/chinese name it wont works <- Can you be more specific?

PoloNX commented 1 year ago

Yep no problem. I'm doing one request to get the id of the page of the mod

    nlohmann::json searchGames(std::string gameTitle) {
        gameTitle = replaceSpacesWithPlus(gameTitle);

        const std::string api_url = fmt::format("https://gamebanana.com/apiv11/Util/Game/NameMatch?_sName={}", gameTitle);
        brls::Logger::debug("API URL: {}", api_url);

        nlohmann::json games = net::downloadRequest(api_url);

        return games;
    }

The game on gamebanana is in english example : https://gamebanana.com/games/6507

So if I do this :

https://gamebanana.com/apiv11/Util/Game/NameMatch?_sName=Mario+Kart+8+Deluxe

it will works but if I do

https://gamebanana.com/apiv11/Util/Game/NameMatch?_sName=マリオカート8+Mariokāto+8

it wont works

yellows8 commented 1 year ago

Just use &nacp->lang[2] (en-us) directly from your app instead of this.