| 70 | |
| 71 | public: |
| 72 | static void Render() |
| 73 | { |
| 74 | if (ImGui::BeginTabItem("Login")) |
| 75 | { |
| 76 | static std::string result; |
| 77 | static bool once = true; |
| 78 | static char leagueArgs[1024 * 16]; |
| 79 | static std::string sArgs; |
| 80 | |
| 81 | if (once) |
| 82 | { |
| 83 | once = false; |
| 84 | std::ranges::copy(S.loginTab.leagueArgs, leagueArgs); |
| 85 | } |
| 86 | |
| 87 | ImGui::Columns(2, nullptr, false); |
| 88 | |
| 89 | static std::vector<std::pair<std::string, std::string>> langs = { |
| 90 | {"English (US)", "en_US"}, {"Japanese", "ja_JP"}, {"Korean", "ko_KR"}, {"Chinese (China)", "zh_CN"}, |
| 91 | {"German", "de_DE"}, {"Spanish (Spain)", "es_ES"}, {"Polish", "pl_PL"}, {"Russian", "ru_RU"}, |
| 92 | {"French", "fr_FR"}, {"Turkish", "tr_TR"}, {"Portuguese", "pt_BR"}, {"Czech", "cs_CZ"}, {"Greek", "el_GR"}, |
| 93 | {"Romanian", "ro_RO"}, {"Hungarian", "hu_HU"}, {"English (UK)", "en_GB"}, {"Italian", "it_IT"}, |
| 94 | {"Spanish (Mexico)", "es_MX"}, {"Spanish (Argentina)", "es_AR"}, {"English (Australia)", "en_AU"}, |
| 95 | {"Malay", "ms_MY"}, {"English (Philippines)", "en_PH"}, {"English (Singapore)", "en_SG"}, {"Thai", "th_TH"}, |
| 96 | {"Vietnamese", "vi_VN"}, {"Indonesian", "id_ID"}, {"Tagalog", "tl_PH"}, {"Chinese (Malaysia)", "zh_MY"}, {"Chinese (Taiwan)", "zh_TW"} |
| 97 | }; |
| 98 | // find saved lang from cfg file |
| 99 | auto findLang = std::ranges::find_if(langs, [](std::pair<std::string, std::string> k) { |
| 100 | return k.second == S.loginTab.language; |
| 101 | }); |
| 102 | |
| 103 | static std::pair selectedLang = { findLang[0].first, findLang[0].second }; |
| 104 | |
| 105 | if (ImGui::Button("Launch client")) |
| 106 | { |
| 107 | if (!std::filesystem::exists(S.leaguePath)) |
| 108 | { |
| 109 | result = "Invalid path, change it in Settings tab"; |
| 110 | } |
| 111 | else |
| 112 | { |
| 113 | Misc::LaunchClient(sArgs); |
| 114 | result = S.leaguePath + "LeagueClient.exe " + sArgs; |
| 115 | } |
| 116 | } |
| 117 | ImGui::SameLine(); |
| 118 | |
| 119 | if (ImGui::BeginCombo("##language", selectedLang.first.c_str())) |
| 120 | { |
| 121 | for (const auto& [fst, snd] : langs) |
| 122 | { |
| 123 | if (ImGui::Selectable(fst.c_str(), fst == selectedLang.first)) |
| 124 | { |
| 125 | selectedLang = { fst, snd }; |
| 126 | S.loginTab.language = snd; |
| 127 | Config::Save(); |
| 128 | |
| 129 | std::string localeArg = std::format("--locale={} ", selectedLang.second); |
nothing calls this directly
no test coverage detected