feat: Translation Service (#844)

Co-authored-by: mrwoowoo <github@hiqaq.com>
Co-authored-by: LiamD-Flop <40887493+LiamD-Flop@users.noreply.github.com>
This commit is contained in:
Yimura
2023-02-01 19:46:33 +01:00
committed by GitHub
parent ef3decba53
commit d4f2960c77
79 changed files with 1183 additions and 779 deletions

View File

@ -21,7 +21,7 @@ namespace big
}
ImGui::PushItemWidth(250);
components::sub_title("Saved Jobs");
components::sub_title("CREATOR_SAVED_JOBS"_T);
if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200)))
{
@ -40,14 +40,14 @@ namespace big
if (!selected_creator_file.empty())
{
components::button("Save To File", []
components::button("CREATOR_SAVE_TO_FILE"_T, []
{
creator_storage_service::save_file(selected_creator_file);
});
ImGui::SameLine();
components::button("Load From File", []
components::button("CREATOR_LOAD_FROM_FILE"_T, []
{
creator_storage_service::load_file(selected_creator_file);
});
@ -57,11 +57,11 @@ namespace big
ImGui::PushItemWidth(250);
components::input_text_with_hint(
"Job Name",
"Ex: My Cool Job",
"CREATOR_JOB_FILENAME"_T,
"CREATOR_JOB_FILENAME_HINT"_T,
job_file_name_input, IM_ARRAYSIZE(job_file_name_input));
components::button("Create Job File", []
components::button("CREATOR_JOB_CREATE_FILE"_T, []
{
cached_creator_files = false;
creator_storage_service::create_file(std::string(job_file_name_input) + ".json");
@ -69,7 +69,7 @@ namespace big
ImGui::SameLine();
components::button("Refresh", []
components::button("REFRESH"_T, []
{
cached_creator_files = false;
});
@ -77,9 +77,9 @@ namespace big
ImGui::Separator();
static char job_link[69]{};
components::input_text("SocialClub Job Link", job_link, sizeof(job_link));
components::input_text("CREATOR_JOB_LINK"_T, job_link, sizeof(job_link));
components::button("Import", []
components::button("CREATOR_JOB_IMPORT"_T, []
{
g_thread_pool->push([]
{
@ -100,14 +100,14 @@ namespace big
if (g_api_service->download_job_metadata(content_id, f1 < 0 ? 0 : f1, f0 < 0 ? 0 : f0, NETWORK::UGC_GET_CONTENT_LANGUAGE(0)))
{
cached_creator_files = false;
g_notification_service->push("Job Import", "Job Import successfully done");
g_notification_service->push("CREATOR_JOB_IMPORT_NOTIFICATION"_T.data(), "CREATOR_JOB_IMPORT_SUCCESS"_T.data());
}
else {
g_notification_service->push_error("Job Import", "Could download job metadata");
g_notification_service->push_error("CREATOR_JOB_IMPORT_NOTIFICATION"_T.data(), "CREATOR_JOB_FAILED_METADATA_FETCH"_T.data());
}
}
else {
g_notification_service->push_error("Job Import", "UGC QueryContent failed");
g_notification_service->push_error("CREATOR_JOB_IMPORT_NOTIFICATION"_T.data(), "CREATOR_JOB_UGC_QUERY_FAILED"_T.data());
}
});
});
@ -115,19 +115,19 @@ namespace big
ImGui::EndGroup();
components::sub_title("Launch Creator");
components::sub_title("CREATOR_LAUNCH"_T);
ImGui::BeginGroup();
components::button("Race", [] { scripts::start_creator_script(RAGE_JOAAT("fm_race_creator")); }); ImGui::SameLine();
components::button("Capture", [] { scripts::start_creator_script(RAGE_JOAAT("fm_capture_creator")); }); ImGui::SameLine();
components::button("Deathmatch", [] { scripts::start_creator_script(RAGE_JOAAT("fm_deathmatch_creator")); }); ImGui::SameLine();
components::button("LTS", [] { scripts::start_creator_script(RAGE_JOAAT("fm_lts_creator")); });
components::button("RACE"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_race_creator")); }); ImGui::SameLine();
components::button("CAPTURE"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_capture_creator")); }); ImGui::SameLine();
components::button("DEATHMATCH"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_deathmatch_creator")); }); ImGui::SameLine();
components::button("LTS"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_lts_creator")); });
ImGui::EndGroup();
components::sub_title("Creator Options");
components::sub_title("CREATOR_OPTIONS"_T);
ImGui::BeginGroup();
ImGui::Checkbox("Infinite Model Memory", &g.ugc.infinite_model_memory);
ImGui::Checkbox("CREATOR_INFINITE_MEMORY"_T.data(), &g.ugc.infinite_model_memory);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Infinite Model Memory is only useful if dev mode is not activated");
ImGui::SetTooltip("CREATOR_INFINITE_MEMORY_DESCRIPTION"_T.data());
ImGui::EndGroup();
}

View File

@ -77,7 +77,7 @@ namespace big
auto plyr = g_player_service->get_by_id(selected_ped_player_id);
if (plyr == nullptr || !plyr->is_valid() || !plyr->get_ped() || !plyr->get_ped()->m_navigation)
{
g_notification_service->push_error("Ped", "Invalid Online Player.");
g_notification_service->push_error("PED"_T.data(), "INVALID_ONLINE_PED"_T.data());
return 0;
}
@ -102,7 +102,7 @@ namespace big
auto plyr = g_player_service->get_by_id(selected_ped_for_player_id);
if (plyr == nullptr || !plyr->is_valid() || !plyr->get_ped() || !plyr->get_ped()->m_navigation)
{
g_notification_service->push_error("Ped", "Invalid Online Player.");
g_notification_service->push_error("PED"_T.data(), "INVALID_ONLINE_PED"_T.data());
return 0;
}
@ -121,7 +121,7 @@ namespace big
if (ped == 0)
{
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model ? ");
g_notification_service->push_error("PED"_T.data(), "SPAWN_MODEL_FAILED"_T.data());
return 0;
}
@ -234,26 +234,26 @@ namespace big
}
}
components::sub_title("Ped Model");
components::sub_title("PED_MODEL"_T);
{
ImGui::BeginGroup();
{
ImGui::Text("Ped Type");
ImGui::Text("PED_TYPE"_T.data());
ImGui::SetNextItemWidth(160.f);
if (ImGui::BeginCombo(
"##ped_type",
selected_ped_type == -1 ? "ALL" :
selected_ped_type == -2 ? "ONLINE PLAYER" :
selected_ped_type == -1 ? "ALL"_T.data() :
selected_ped_type == -2 ? "ONLINE_PLAYER"_T.data() :
ped_type_arr[selected_ped_type].c_str()
)) {
if (ImGui::Selectable("ONLINE PLAYER", selected_ped_type == -2))
if (ImGui::Selectable("ONLINE_PLAYER"_T.data(), selected_ped_type == -2))
{
selected_ped_type = -2;
}
if (ImGui::Selectable("ALL", selected_ped_type == -1))
if (ImGui::Selectable("ALL"_T.data(), selected_ped_type == -1))
{
selected_ped_type = -1;
}
@ -283,16 +283,16 @@ namespace big
{
ImGui::BeginGroup();
{
ImGui::Text("Player");
ImGui::Text("PLAYER"_T.data());
ImGui::SetNextItemWidth(240.f);
if (ImGui::BeginCombo(
"##ped_player",
selected_ped_player_id == -1 ?
"Self" :
"SELF"_T.data() :
g_player_service->get_by_id(selected_ped_player_id)->get_name()
)) {
if (ImGui::Selectable("Self", selected_ped_player_id == -1))
if (ImGui::Selectable("SELF"_T.data(), selected_ped_player_id == -1))
{
selected_ped_player_id = -1;
g_model_preview_service->stop_preview();
@ -364,11 +364,11 @@ namespace big
{
ImGui::BeginGroup();
{
ImGui::Text("Model Name");
ImGui::Text("MODEL_NAME"_T.data());
ImGui::SetNextItemWidth(240.f);
components::input_text_with_hint(
"##ped_model_name", "Model Name",
"##ped_model_name", "MODEL_NAME"_T,
ped_model_buf, sizeof(ped_model_buf), ImGuiInputTextFlags_EnterReturnsTrue,
[] {
ped_model_dropdown_open = false;
@ -453,22 +453,22 @@ namespace big
ImGui::Separator();
components::sub_title("Weapon");
components::sub_title("WEAPON"_T);
{
ImGui::BeginGroup();
{
ImGui::Text("Weapon Type");
ImGui::Text("WEAPON_TYPE"_T.data());
ImGui::SetNextItemWidth(160.f);
if (ImGui::BeginCombo(
"##ped_weapon_type",
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ?
"ALL" :
"ALL"_T.data() :
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ?
"NO WEAPONS" :
"NO_WEAPONS"_T.data() :
weapon_type_arr[selected_ped_weapon_type].c_str()
)) {
if (ImGui::Selectable("ALL", selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS))
if (ImGui::Selectable("ALL"_T.data(), selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS))
{
selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
}
@ -478,7 +478,7 @@ namespace big
ImGui::SetItemDefaultFocus();
}
if (ImGui::Selectable("NO WEAPONS", selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS))
if (ImGui::Selectable("NO_WEAPONS"_T.data(), selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS))
{
selected_ped_weapon_type = SPAWN_PED_NO_WEAPONS;
}
@ -511,20 +511,20 @@ namespace big
ImGui::BeginGroup();
{
ImGui::Text("Weapon");
ImGui::Text("WEAPON"_T.data());
ImGui::SetNextItemWidth(240.f);
if (ImGui::BeginCombo(
"##ped_weapon",
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ?
"NO WEAPONS" :
"NO_WEAPONS"_T.data() :
selected_ped_weapon_hash == 0 ?
"ALL" :
"ALL"_T.data() :
g_gta_data_service->weapon_by_hash(selected_ped_weapon_hash).m_display_name
)) {
if (selected_ped_weapon_type != SPAWN_PED_NO_WEAPONS)
{
if (ImGui::Selectable("ALL", selected_ped_weapon_hash == 0))
if (ImGui::Selectable("ALL"_T.data(), selected_ped_weapon_hash == 0))
{
selected_ped_weapon_hash = 0;
}
@ -562,7 +562,7 @@ namespace big
ImGui::Separator();
components::sub_title("Spawn For");
components::sub_title("SPAWN_FOR"_T);
{
if (ImGui::BeginCombo(
"##ped_for",
@ -619,7 +619,7 @@ namespace big
ImGui::Separator();
if (ImGui::Checkbox("Preview", &g.world.spawn_ped.preview_ped))
if (ImGui::Checkbox("PREVIEW"_T.data(), &g.world.spawn_ped.preview_ped))
{
if (!g.world.spawn_ped.preview_ped)
{
@ -631,7 +631,7 @@ namespace big
ImGui::Checkbox("Invisible", &g.world.spawn_ped.spawn_invisible);
ImGui::Checkbox("Attacker", &g.world.spawn_ped.spawn_as_attacker);
components::button("Change Player Model", []
components::button("CHANGE_PLAYER_MODEL"_T, []
{
if (selected_ped_type == -2)
{
@ -649,7 +649,7 @@ namespace big
{
if (!ped::change_player_model(rage::joaat(ped_model_buf)))
{
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model?");
g_notification_service->push_error("PED"_T.data(), "SPAWN_MODEL_FAILED"_T.data());
return;
}
@ -659,7 +659,8 @@ namespace big
ImGui::SameLine();
components::button("Spawn Ped", []
components::button("SPAWN_PED"_T, []
{
if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE)
{
@ -676,7 +677,7 @@ namespace big
ImGui::SameLine();
components::button("Spawn Bodyguard", []
components::button("SPAWN_BODYGUARD"_T, []
{
if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE)
{

View File

@ -6,28 +6,28 @@ namespace big
{
void view::time_and_weather()
{
if (ImGui::TreeNode("Local Time"))
if (ImGui::TreeNode("LOCAL_TIME"_T.data()))
{
ImGui::Checkbox("Override Time", &g.session.override_time);
ImGui::Checkbox("OVERRIDE_TIME"_T.data(), &g.session.override_time);
if (g.session.override_time)
{
ImGui::SliderInt("Hour", &g.session.custom_time.hour, 0, 23);
ImGui::SliderInt("Minute", &g.session.custom_time.minute, 0, 59);
ImGui::SliderInt("Second", &g.session.custom_time.second, 0, 59);
ImGui::SliderInt("HOUR"_T.data(), &g.session.custom_time.hour, 0, 23);
ImGui::SliderInt("MINUTE"_T.data(), &g.session.custom_time.minute, 0, 59);
ImGui::SliderInt("SECOND"_T.data(), &g.session.custom_time.second, 0, 59);
}
ImGui::TreePop();
}
if (ImGui::TreeNode("Local Weather"))
if (ImGui::TreeNode("LOCAL_WEATHER"_T.data()))
{
components::button("Clear Override", []
components::button("CLEAR_OVERRIDE"_T, []
{
MISC::CLEAR_OVERRIDE_WEATHER();
});
if (ImGui::ListBox("", &g.session.local_weather, session::weathers, 15))
if (ImGui::ListBox("##weather-listbox", &g.session.local_weather, session::weathers, 15))
{
g_fiber_pool->queue_job([]
{

View File

@ -8,39 +8,38 @@ namespace big
{
void view::train()
{
components::button("Hijack Train", []
{
train::hijack_train();
});
components::button("HIJACK_TRAIN"_T, []
{
train::hijack_train();
});
ImGui::SameLine();
components::button("Delete Train", []
{
train::delete_train();
});
components::button("DELETE_TRAIN"_T, []
{
train::delete_train();
});
if (ImGui::IsItemHovered())
ImGui::SetTooltip("You cant delete the train while in it.");
ImGui::SetTooltip("DELETE_TRAIN_DESC"_T.data());
ImGui::SameLine();
components::button("Exit Train", []
{
train::exit_train();
});
components::button("EXIT_TRAIN"_T, []
{
train::exit_train();
});
static float train_speed = 0;
ImGui::SliderFloat("Train Speed", &train_speed, -500.f, 500.f);
ImGui::SliderFloat("TRAIN_SPEED"_T.data(), &train_speed, -500.f, 500.f);
ImGui::SameLine();
components::button("Set", [] { train::set_train_speed(train_speed); });
components::button("SET"_T, [] { train::set_train_speed(train_speed); });
ImGui::Checkbox("Drive Train", &g.world.train.drive_train);
ImGui::Checkbox("DRIVE_TRAIN"_T.data(), &g.world.train.drive_train);
ImGui::SameLine();
ImGui::Checkbox("Derail Train", &g.world.train.derail_train);
ImGui::Checkbox("DERAIL_TRAIN"_T.data(), &g.world.train.derail_train);
}
}