Add context to strings for translation

This commit is contained in:
Guillaume Meunier
2026-07-26 17:24:37 +02:00
parent 6ce05184af
commit f5a0554384
6 changed files with 117 additions and 149 deletions
+2 -2
View File
@@ -159,7 +159,7 @@ app_launcher::clicked app_launcher::draw_gui(imgui_context & imgui_ctx, const st
const float header_top = ImGui::GetCursorPosY();
const std::string subtitle = _S("Pick an application to start streaming, or start one on the PC.");
if (server_name.empty())
ui::page_header(_S("Connected"), subtitle);
ui::page_header(_cS("status in the title bar", "Connected"), subtitle);
else
ui::page_header(fmt::format(_F("Connected to {}"), server_name), subtitle);
const float content_y = ImGui::GetCursorPosY();
@@ -167,7 +167,7 @@ app_launcher::clicked app_launcher::draw_gui(imgui_context & imgui_ctx, const st
const bool has_apps = not apps->empty();
int view = config.app_list_view ? 1 : 0;
int size_idx = std::clamp<int>(config.app_icon_size, 0, 2);
const std::vector<std::string> size_opts = {_S("Small"), _S("Medium"), _S("Large")};
const std::vector<std::string> size_opts = {_cS("icon size", "Small"), _cS("icon size", "Medium"), _cS("icon size", "Large")};
const std::vector<std::string> view_opts = {ICON_FA_TABLE_CELLS_LARGE, ICON_FA_LIST};
const float gap = ImGui::GetStyle().ItemSpacing.x;
const float view_w = ui::metrics::app_view_toggle_width;
+36 -36
View File
@@ -209,7 +209,7 @@ namespace wivrn::gui
void settings_performance(const settings_context & ctx)
{
auto & config = ctx.config;
const std::string disconnect_tip = ctx.in_game ? _("Disconnect to change this setting.") : std::string{};
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
std::vector<setting> list;
if (ctx.instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME) and not ctx.session.get_refresh_rates().empty())
@@ -294,7 +294,7 @@ void settings_performance(const settings_context & ctx)
list.push_back({
.id = "##spacewarp",
.label = _("Application SpaceWarp"),
.description = _("Renders at half the refresh rate and synthesises in-between frames. Managed automatically while the refresh rate is set to Auto."),
.description = _("Renders at half the refresh rate. The headset may synthesise frames."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.fps_divider == 2; },
.set_bool = [&ctx, &config](bool v) { config.fps_divider = v ? 2 : 1; config.save(); if (ctx.on_streaming_changed) ctx.on_streaming_changed(); },
@@ -317,14 +317,14 @@ void settings_performance(const settings_context & ctx)
});
}
ui::page_header(_S("Performance"), _S("Frame rate, resolution and power draw."));
ui::page_header(_cS("page header title", "Performance"), _cS("page header subtitle", "Frame rate, resolution and power draw."));
render_settings(ctx, "##performance", list);
}
void settings_streaming(const settings_context & ctx)
{
auto & config = ctx.config;
const std::string disconnect_tip = ctx.in_game ? _("Disconnect to change this setting.") : std::string{};
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
std::vector<setting> list;
auto codec_name = [](std::optional<wivrn::video_codec> codec) -> std::string {
@@ -351,7 +351,7 @@ void settings_streaming(const settings_context & ctx)
list.push_back({
.id = "##codec",
.label = _("Video codec"),
.label = _C("setting name", "Video codec"),
.description = _("How video is compressed before it is sent to the headset."),
.ui = ui_kind::combo,
.get_int = [&config, codecs] {
@@ -369,7 +369,7 @@ void settings_streaming(const settings_context & ctx)
for (auto c: codecs)
opts.push_back(codec_name(c));
return opts; },
.title = _("Video codec"),
.title = _C("setting name", "Video codec"),
.default_int = 0,
.enabled = [&ctx] { return not ctx.in_game; },
.disabled_tooltip = disconnect_tip,
@@ -379,7 +379,7 @@ void settings_streaming(const settings_context & ctx)
{
list.push_back({
.id = "##ten_bit",
.label = _("10-bit color"),
.label = _C("setting name", "10-bit color"),
.description = _("Higher color precision, supported by HEVC and AV1."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.bit_depth == 10; },
@@ -412,7 +412,7 @@ void settings_streaming(const settings_context & ctx)
.label = _("Adjust bitrate with thumbstick"),
.description = _("Use the right thumbstick to fine-tune the bitrate."),
.ui = ui_kind::button,
.button_label = _("Adjust"),
.button_label = _C("button label to adjust the bitrate", "Adjust"),
.on_click = [&ctx] { ctx.enter_bitrate_adjust(); },
});
}
@@ -422,7 +422,7 @@ void settings_streaming(const settings_context & ctx)
{
list.push_back({
.id = "##fov_override",
.label = _("Foveation center override"),
.label = _C("setting name", "Foveation center override"),
.description = _("Manually set where image quality is focused, instead of the center or your gaze."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.override_foveation_enable; },
@@ -435,19 +435,19 @@ void settings_streaming(const settings_context & ctx)
});
list.push_back({
.id = "##fov_adjust",
.label = _("Foveation center"),
.description = fmt::format(_F("Height {:.1f} deg, distance {:.2f} m"), -config.override_foveation_pitch * 180 / M_PI, config.override_foveation_distance),
.label = _C("setting name", "Foveation center"),
.description = fmt::format(_F("Height {:.1f} °, distance {:.2f} m"), -config.override_foveation_pitch * 180 / M_PI, config.override_foveation_distance),
.ui = ui_kind::button,
.button_label = _("Change"),
.button_label = _C("button label to change the foveation center", "Change"),
.on_click = [&ctx] { if (ctx.enter_foveation_adjust) ctx.enter_foveation_adjust(); },
.enabled = [&config] { return config.override_foveation_enable; },
.disabled_tooltip = _("Enable foveation center override to change this setting"),
.disabled_tooltip = _("Enable foveation center override to change this setting."),
});
}
list.push_back({
.id = "##stream_gui",
.label = _("In-stream window"),
.label = _C("setting name", "In-stream window"),
.description = _("Enables the configuration window to be shown while the game is streaming. If enabled, the window is activated by pressing both thumbsticks."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.enable_stream_gui; },
@@ -455,7 +455,7 @@ void settings_streaming(const settings_context & ctx)
.default_bool = true,
});
ui::page_header(_S("Streaming"), _S("How video is encoded and sent to the headset."));
ui::page_header(_cS("page header title", "Streaming"), _cS("page header subtitle", "How video is encoded and sent to the headset."));
render_settings(ctx, "##streaming", list);
}
@@ -509,19 +509,19 @@ void settings_post_processing(const settings_context & ctx)
flag_combo("##sharpening", _("Sharpening"), _("Improve clarity of high contrast edges and counteract blur. Useful when the input resolution is low compared to the headset display."), {0, XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB, XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB}, &configuration::openxr_post_processing_settings::sharpening);
}
ui::page_header(_S("Post-processing"), _S("OpenXR layer supersampling and sharpening."));
ui::page_header(_S("Post-processing"), _cS("page header subtitle", "OpenXR layer supersampling and sharpening."));
render_settings(ctx, "##post_processing", list);
}
void settings_audio(const settings_context & ctx)
{
auto & config = ctx.config;
const std::string disconnect_tip = ctx.in_game ? _("Disconnect to change this setting.") : std::string{};
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
std::vector<setting> list;
list.push_back({
.id = "##microphone",
.label = _("Microphone"),
.label = _C("setting name", "Microphone"),
.description = _("Stream the headset microphone to the PC."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.check_feature(feature::microphone); },
@@ -533,7 +533,7 @@ void settings_audio(const settings_context & ctx)
list.push_back({
.id = "##unprocessed",
.label = _("Unprocessed audio"),
.label = _C("setting name", "Unprocessed audio"),
.description = _("Force disable audio filters, such as noise cancellation."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.mic_unprocessed_audio; },
@@ -543,7 +543,7 @@ void settings_audio(const settings_context & ctx)
.disabled_tooltip = disconnect_tip,
});
ui::page_header(_S("Audio"), _S("Microphone streamed to the PC."));
ui::page_header(_cS("page header title", "Audio"), _cS("page header subtitle", "Microphone streamed to the PC."));
render_settings(ctx, "##audio", list);
}
@@ -554,7 +554,7 @@ void settings_devices(const settings_context & ctx)
list.push_back({
.id = "##keyboard",
.label = _("Keyboard"),
.label = _C("setting name", "Keyboard"),
.description = _("Forward the keyboard from the headset to the PC."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.forward_keyboard; },
@@ -564,7 +564,7 @@ void settings_devices(const settings_context & ctx)
list.push_back({
.id = "##mouse",
.label = _("Mouse"),
.label = _C("setting name", "Mouse"),
.description = _("Forward the mouse from the headset to the PC."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.forward_mouse; },
@@ -574,7 +574,7 @@ void settings_devices(const settings_context & ctx)
list.push_back({
.id = "##gamepad",
.label = _("Gamepad"),
.label = _C("setting name", "Gamepad"),
.description = _("Forward the gamepad from the headset to the PC."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.forward_gamepad; },
@@ -582,7 +582,7 @@ void settings_devices(const settings_context & ctx)
.default_bool = false,
});
ui::page_header(_S("Devices"), _S("Forward input devices to the PC."));
ui::page_header(_cS("page header title", "Devices"), _cS("page header subtitle", "Forward input devices to the PC."));
render_settings(ctx, "##devices", list);
if (ctx.server_hid_forwarding == false and (config.forward_keyboard or config.forward_mouse or config.forward_gamepad))
@@ -592,7 +592,7 @@ void settings_devices(const settings_context & ctx)
bool settings_tracking(const settings_context & ctx)
{
auto & config = ctx.config;
const std::string disconnect_tip = ctx.in_game ? _("Disconnect to change this setting.") : std::string{};
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
std::vector<setting> list;
auto feature_toggle = [&](const char * id, std::string label, std::string desc, feature f, bool def) {
@@ -610,13 +610,13 @@ bool settings_tracking(const settings_context & ctx)
};
if (ctx.system.hand_tracking_supported())
feature_toggle("##hand", _("Hand tracking"), _("Track your hands for input when controllers are down."), feature::hand_tracking, true);
feature_toggle("##hand", _C("setting name", "Hand tracking"), _("Track your hands for input when controllers are down."), feature::hand_tracking, true);
if (application::get_eye_gaze_supported())
feature_toggle("##eye", _("Eye tracking"), _("Used by foveated encoding to focus quality where you look."), feature::eye_gaze, false);
feature_toggle("##eye", _C("setting name", "Eye tracking"), _("Used by foveated encoding to focus quality where you look."), feature::eye_gaze, false);
if (ctx.system.face_tracker_supported() != xr::face_tracker_type::none)
feature_toggle("##face", _("Face tracking"), _("Stream facial expressions to the PC."), feature::face_tracking, false);
feature_toggle("##face", _C("setting name", "Face tracking"), _("Stream facial expressions to the PC."), feature::face_tracking, false);
const auto body_tracker = ctx.system.body_tracker_supported();
@@ -646,7 +646,7 @@ bool settings_tracking(const settings_context & ctx)
{
list.push_back({
.id = "##body",
.label = _("Body tracking"),
.label = _C("setting name", "Body tracking"),
.description = body_tracker == xr::body_tracker_type::fb or body_tracker == xr::body_tracker_type::meta
? _("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings, otherwise body data will be guessed from controller and headset positions.")
: _("Stream body joint positions to the PC."),
@@ -660,7 +660,7 @@ bool settings_tracking(const settings_context & ctx)
list.push_back({
.id = "##body_tracking_parts",
.label = _("Virtual body trackers"),
.label = _C("setting name", "Virtual body trackers"),
.description = _("Create virtual tracker devices."),
.ui = ui_kind::combo_multi,
.get_multi = [&config, &body_parts_bit](int index) {
@@ -674,14 +674,14 @@ bool settings_tracking(const settings_context & ctx)
config.body_part_mask &= ~underlying;
changed = true; },
.options = [&body_parts_names]() { return body_parts_names; },
.title = _("Virtual body trackers"),
.title = _C("setting name", "Virtual body trackers"),
.default_multi = body_parts_default,
.enabled = [&ctx] { return not ctx.in_game; },
.disabled_tooltip = disconnect_tip,
});
}
ui::page_header(_S("Tracking"), _S("Body and input tracking sent to the PC."));
ui::page_header(_cS("page header title", "Tracking"), _cS("page header subtitle", "Body and input tracking sent to the PC."));
render_settings(ctx, "##tracking", list);
return changed;
@@ -709,7 +709,7 @@ void settings_system(const settings_context & ctx)
list.push_back({
.id = "##language",
.label = _("Language"),
.description = _("Interface language."),
.description = _C("setting name", "Interface language."),
.ui = ui_kind::combo,
.get_int = [&config, languages] {
if (not config.locale.empty())
@@ -723,7 +723,7 @@ void settings_system(const settings_context & ctx)
application::instance().load_locale(); },
.options = [languages] {
std::vector<std::string> opts;
opts.push_back(_C("language", "System language"));
opts.push_back(_C("item in the interface language combobox", "System language"));
for (const auto & [lang, loc, code]: languages)
opts.push_back(lang);
return opts; },
@@ -733,7 +733,7 @@ void settings_system(const settings_context & ctx)
list.push_back({
.id = "##extended",
.label = _("Extended configuration"),
.label = _C("setting name", "Extended configuration"),
.description = _("Allows unsafe configuration values, use at your own risk."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.extended_config; },
@@ -741,7 +741,7 @@ void settings_system(const settings_context & ctx)
.default_bool = false,
});
ui::page_header(_S("System"), _S("Language and advanced options."));
ui::page_header(_cS("page header title", "System"), _cS("page header suibtitle", "Language and advanced options."));
render_settings(ctx, "##system", list);
}
+32 -32
View File
@@ -305,11 +305,11 @@ void scenes::lobby::gui_new_server()
ImGui::TextUnformatted(_S("Name"));
if (ImGui::IsWindowAppearing())
ImGui::SetKeyboardFocusHere();
ui::input_text("##name", add_server_window_prettyname, _S("My gaming PC"), w);
ui::input_text("##name", add_server_window_prettyname, _cS("placeholder for the server name when adding/editing a server", "My gaming PC"), w);
ImGui::Dummy({0, 6});
ImGui::TextUnformatted(_S("Address"));
ui::input_text("##hostname", add_server_window_hostname, _S("192.168.1.10 or host.local"), w);
ui::input_text("##hostname", add_server_window_hostname, _cS("placeholder for the server address when adding/editing a server", "192.168.1.10 or host.local"), w);
ImGui::Dummy({0, 6});
ImGui::TextUnformatted(_S("Port"));
@@ -369,7 +369,7 @@ void scenes::lobby::gui_server_list()
// header with an Add server button on the right
const ImVec2 hstart = ImGui::GetCursorPos();
const float header_avail = ImGui::GetContentRegionAvail().x;
ui::page_header(_S("Computers"), _S("Pick a PC running the WiVRn server to stream from."));
ui::page_header(_cS("page header title", "Computers"), _cS("page header subtitle", "Pick a PC running the WiVRn server to stream from."));
const ImVec2 hend = ImGui::GetCursorPos();
const std::string add_label = _("Add server");
@@ -423,10 +423,10 @@ void scenes::lobby::gui_server_list()
// trailing controls [Auto chip] [Connect] [menu], measured up front to exclude from the row click area
const char * c_icon = reachable ? ICON_FA_PLAY : (incompatible ? ICON_FA_TRIANGLE_EXCLAMATION : ICON_FA_MAGNIFYING_GLASS);
const std::string c_label = ui::icon_label(c_icon, reachable ? _("Connect") : (incompatible ? _("Incompatible") : _("Searching…")));
const std::string c_label = ui::icon_label(c_icon, reachable ? _("Connect") : (incompatible ? _C("button label when the server has an incompatible version", "Incompatible") : _C("button label when the server is known but not visible", "Searching…")));
const std::string c_tooltip = reachable ? std::string{} : (incompatible ? _("Incompatible server version") : _("Looking for this server on your network"));
const float cw = ui::button_width(c_label);
const std::string chip_label = ui::icon_label(ICON_FA_BOLT, _("Auto"));
const std::string chip_label = ui::icon_label(ICON_FA_BOLT, _C("chip displayed in server list when autoconnect is enabled", "Auto"));
const ImVec2 chip_sz = ui::chip_size(chip_label);
float trailing = bh + gap + cw + (data.autoconnect ? gap + chip_sz.x : 0) + ui::metrics::list_row_pad;
@@ -435,8 +435,8 @@ void scenes::lobby::gui_server_list()
// overflow menu
const std::string auto_l = _("Autoconnect");
const std::string edit_l = _("Edit server");
const std::string del_l = _("Delete server");
const std::string edit_l = _C("item in action menu", "Edit server");
const std::string del_l = _C("item in action menu", "Delete server");
std::vector<ui::action_item> actions;
ImGui::SetCursorScreenPos(row.trailing(x, {bh, bh}));
if (data.manual)
@@ -530,7 +530,7 @@ void scenes::lobby::gui_server_list()
wivrn::ui::end_modal();
}
if (wivrn::ui::begin_modal("add or edit server", add_server_cookie.empty() ? _("Add server") : _("Edit server"), 620))
if (wivrn::ui::begin_modal("add or edit server", add_server_cookie.empty() ? _C("popup window title", "Add server") : _C("popup window title", "Edit server"), 620))
{
gui_new_server();
wivrn::ui::end_modal();
@@ -542,7 +542,7 @@ void scenes::lobby::gui_server_list()
if (auto it = config.servers.find(delete_server_cookie); it != config.servers.end())
name = it->second.service.name;
switch (wivrn::ui::confirm_modal("delete server", _("Delete server"), fmt::format(_F("Remove \"{}\" from your saved computers?"), name), _("Delete"), _("Cancel"), true))
switch (wivrn::ui::confirm_modal("delete server", _C("confirmation messagebox title", "Delete server"), fmt::format(_cF("confirmation message", "Remove \"{}\" from your saved computers?"), name), _("Delete"), _("Cancel"), true))
{
case 1:
config.servers.erase(delete_server_cookie);
@@ -927,7 +927,7 @@ void scenes::lobby::gui_licenses()
for (const auto & c: components)
items.push_back({c.c_str()});
if (ui::combo("##component", _("Component"), items, &selected, ui::metrics::setting_control_width) or not license)
if (ui::combo("##component", _C("name of the combobox to choose which component license to display in the licenses page", "Component"), items, &selected, ui::metrics::setting_control_width) or not license)
{
selected_item = components[selected];
try
@@ -1115,21 +1115,21 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
}});
};
toggle_item(ICON_FA_MICROPHONE, _S("Microphone"), feature::microphone);
toggle_item(ICON_FA_MICROPHONE, _cS("tooltip for top bar item in the lobby", "Microphone"), feature::microphone);
if (system.hand_tracking_supported())
toggle_item(ICON_FA_HAND, _S("Hand tracking"), feature::hand_tracking);
toggle_item(ICON_FA_HAND, _cS("tooltip for top bar item in the lobby", "Hand tracking"), feature::hand_tracking);
if (application::get_eye_gaze_supported())
toggle_item(ICON_FA_EYE, _S("Eye tracking"), feature::eye_gaze);
toggle_item(ICON_FA_EYE, _cS("tooltip for top bar item in the lobby", "Eye tracking"), feature::eye_gaze);
if (system.face_tracker_supported() != xr::face_tracker_type::none)
toggle_item(ICON_FA_FACE_SMILE, _S("Face tracking"), feature::face_tracking);
toggle_item(ICON_FA_FACE_SMILE, _cS("tooltip for top bar item in the lobby", "Face tracking"), feature::face_tracking);
if (system.body_tracker_supported() != xr::body_tracker_type::none)
toggle_item(ICON_FA_PERSON, _S("Body tracking"), feature::body_tracking);
toggle_item(ICON_FA_PERSON, _cS("tooltip for top bar item in the lobby", "Body tracking"), feature::body_tracking);
if (auto bat = wivrn::gui::battery_status_indicator(instance.now()))
top_items.push_back({wivrn::ui::chip_width(bat->label, false, side),
[bat = *bat, side] { wivrn::ui::chip(bat.label, bat.style, false, side); }});
const std::string conn = _("Not connected");
const std::string conn = _C("status in the title bar", "Not connected");
top_items.push_back({wivrn::ui::chip_width(conn, true, side),
[conn, side] { wivrn::ui::chip(conn, wivrn::ui::chip_style::muted, true, side); }});
@@ -1230,42 +1230,42 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
wivrn::ui::begin_sidebar(TopBarH, TabWidth, 3);
{
if (wivrn::ui::nav_item(ICON_FA_COMPUTER, _S("Computers"), current_tab == tab::server_list))
if (wivrn::ui::nav_item(ICON_FA_COMPUTER, _cS("tab label", "Computers"), current_tab == tab::server_list))
current_tab = tab::server_list;
wivrn::ui::nav_section(_S("SETTINGS"));
if (wivrn::ui::nav_item(ICON_FA_GAUGE_HIGH, _S("Performance"), current_tab == tab::performance))
wivrn::ui::nav_section(_cS("tab group", "SETTINGS"));
if (wivrn::ui::nav_item(ICON_FA_GAUGE_HIGH, _cS("tab label", "Performance"), current_tab == tab::performance))
current_tab = tab::performance;
if (wivrn::ui::nav_item(ICON_FA_TOWER_BROADCAST, _S("Streaming"), current_tab == tab::streaming))
if (wivrn::ui::nav_item(ICON_FA_TOWER_BROADCAST, _cS("tab label", "Streaming"), current_tab == tab::streaming))
current_tab = tab::streaming;
if (wivrn::ui::nav_item(ICON_FA_WAND_MAGIC_SPARKLES, _S("Post-processing"), current_tab == tab::post_processing))
if (wivrn::ui::nav_item(ICON_FA_WAND_MAGIC_SPARKLES, _cS("tab label", "Post-processing"), current_tab == tab::post_processing))
current_tab = tab::post_processing;
if (wivrn::ui::nav_item(ICON_FA_VOLUME_HIGH, _S("Audio"), current_tab == tab::audio))
if (wivrn::ui::nav_item(ICON_FA_VOLUME_HIGH, _cS("tab label", "Audio"), current_tab == tab::audio))
current_tab = tab::audio;
if (wivrn::ui::nav_item(ICON_FA_KEYBOARD, _S("Devices"), current_tab == tab::devices))
if (wivrn::ui::nav_item(ICON_FA_KEYBOARD, _cS("tab label", "Devices"), current_tab == tab::devices))
current_tab = tab::devices;
if (wivrn::ui::nav_item(ICON_FA_LOCATION_CROSSHAIRS, _S("Tracking"), current_tab == tab::tracking))
if (wivrn::ui::nav_item(ICON_FA_LOCATION_CROSSHAIRS, _cS("tab label", "Tracking"), current_tab == tab::tracking))
current_tab = tab::tracking;
if (wivrn::ui::nav_item(ICON_FA_GEARS, _S("System"), current_tab == tab::system))
if (wivrn::ui::nav_item(ICON_FA_GEARS, _cS("tab label", "System"), current_tab == tab::system))
current_tab = tab::system;
wivrn::ui::nav_section(_S("PERSONALIZE"));
if (wivrn::ui::nav_item(ICON_FA_IMAGE, _S("Environment"), current_tab == tab::customize))
wivrn::ui::nav_section(_cS("tab group", "PERSONALIZE"));
if (wivrn::ui::nav_item(ICON_FA_IMAGE, _cS("tab label", "Environment"), current_tab == tab::customize))
current_tab = tab::customize;
if (wivrn::ui::nav_item(ICON_FA_PALETTE, _S("Theme"), current_tab == tab::theme))
if (wivrn::ui::nav_item(ICON_FA_PALETTE, _cS("tab label", "Theme"), current_tab == tab::theme))
current_tab = tab::theme;
#if WIVRN_CLIENT_DEBUG_MENU
if (wivrn::ui::nav_item(ICON_FA_BUG_SLASH, _S("Debug"), current_tab == tab::debug))
if (wivrn::ui::nav_item(ICON_FA_BUG_SLASH, _cS("tab label", "Debug"), current_tab == tab::debug))
current_tab = tab::debug;
#endif
// pinned to the bottom
wivrn::ui::sidebar_footer();
if (wivrn::ui::nav_item(ICON_FA_CIRCLE_INFO, _S("About"), current_tab == tab::about))
if (wivrn::ui::nav_item(ICON_FA_CIRCLE_INFO, _cS("tab label", "About"), current_tab == tab::about))
current_tab = tab::about;
if (wivrn::ui::nav_item(ICON_FA_SCALE_BALANCED, _S("Licenses"), current_tab == tab::licenses))
if (wivrn::ui::nav_item(ICON_FA_SCALE_BALANCED, _cS("tab label", "Licenses"), current_tab == tab::licenses))
current_tab = tab::licenses;
if (wivrn::ui::nav_item(ICON_FA_DOOR_OPEN, _S("Exit"), current_tab == tab::exit))
if (wivrn::ui::nav_item(ICON_FA_DOOR_OPEN, _cS("exit button in the lobby", "Exit"), current_tab == tab::exit))
current_tab = tab::exit;
}
wivrn::ui::end_sidebar();
+24 -56
View File
@@ -422,7 +422,7 @@ scenes::lobby::environment_item_action scenes::lobby::environment_item(environme
const bool transferring = handle and handle->get_state() == libcurl::state::transferring;
// measure the trailing control so the row body click area can exclude it
const std::string active_l = ui::icon_label(ICON_FA_CHECK, _("Active"));
const std::string active_l = ui::icon_label(ICON_FA_CHECK, _C("chip displayed next to the selected environment in the settings", "Active"));
const ImVec2 active_sz = ui::chip_size(active_l);
float trailing = 0;
if (selected)
@@ -506,8 +506,8 @@ void scenes::lobby::environment_list(std::vector<environment_model> & models, bo
if (environment_to_be_deleted)
{
const std::string msg = fmt::format(_F("Permanently delete {}?"), environment_to_be_deleted->name);
switch (wivrn::ui::confirm_modal("confirm delete model", _("Delete environment"), msg, _("Delete"), _("Cancel"), true))
const std::string msg = fmt::format(_cF("confirmation message", "Permanently delete {}?"), environment_to_be_deleted->name);
switch (wivrn::ui::confirm_modal("confirm delete model", _C("confirmation messagebox title", "Delete environment"), msg, _("Delete"), _("Cancel"), true))
{
case 1:
delete_environment(*environment_to_be_deleted);
@@ -648,7 +648,7 @@ void scenes::lobby::gui_customize(XrTime predicted_display_time)
namespace ui = wivrn::ui;
ui::page_header(_S("Environment"), _S("Choose the environment your panels float in."));
ui::page_header(_cS("page header title", "Environment"), _cS("page header subtitle", "Choose the environment your panels float in."));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ui::metrics::card_item_spacing);
@@ -661,27 +661,36 @@ void scenes::lobby::gui_customize(XrTime predicted_display_time)
ui::begin_list_card("##get_more");
{
const float bh = ImGui::GetFrameHeight() * ui::metrics::control_height;
const std::string browse = ui::icon_label(ICON_FA_UP_RIGHT_FROM_SQUARE, _("Browse"));
const float bw = ui::button_width(browse);
const auto row = ui::begin_list_row("##getmore", ICON_FA_IMAGES, 0, _S("Get more environments"), _S("Download community-made spaces from the WiVRn dashboard on your PC."), false, bw + ui::metrics::list_row_pad, 0, false, false);
ImGui::SetCursorScreenPos(row.trailing(row.max.x, {bw, bh}));
if (ui::button(browse, ui::button_style::secondary, {bw, 0}))
const std::string browse = ui::icon_label(ICON_FA_UP_RIGHT_FROM_SQUARE, _C("button label to browse environments to download", "Browse"));
const float bw1 = ui::button_width(browse);
const std::string open = ui::icon_label(ICON_FA_FOLDER_OPEN, _C("button label to open an environment from a local gltf file", "Open"));
const float bw2 = ui::button_width(open);
const float bw = ImMax(bw1, bw2);
const auto row1 = ui::begin_list_row("##getmore", ICON_FA_IMAGES, 0, _S("Get more environments"), _S("Download community-made spaces."), false, bw1 + ui::metrics::list_row_pad, 0, false, false);
ImGui::SetCursorScreenPos(row1.trailing(row1.max.x, {bw, bh}));
if (ui::button(browse + "##browse", ui::button_style::secondary, {bw, 0}))
{
download_environment_list();
open_download_popup = true;
}
ui::end_list_row();
ui::end_card();
const auto row2 = ui::begin_list_row("##localgltf", ICON_FA_CUBE, 0, _S("Open local glTF model"), _S("Open a local glTF file saved on your headset."), false, bw2 + ui::metrics::list_row_pad, 0, false, false);
ImGui::SetCursorScreenPos(row2.trailing(row2.max.x, {bw, bh}));
if (ui::button(open + "##open", ui::button_style::secondary, {bw, 0}))
lobby_file_picker_future = lobby_file_picker.open();
ui::end_list_row();
}
ui::end_card();
// deferred past end_card so OpenPopup hashes at the same id-stack level as BeginPopupModal
if (open_download_popup)
ImGui::OpenPopup("download environment model");
if (ui::button(_S("Open local glTF model"), ui::button_style::secondary))
lobby_file_picker_future = lobby_file_picker.open();
if (ui::begin_modal("download environment model", _S("Browse environments"), 1200))
if (ui::begin_modal("download environment model", _cS("popup window title", "Browse environments"), 1200))
{
const float side = ImGui::GetFrameHeight() * ui::metrics::control_height;
const float list_h = 760;
@@ -722,7 +731,7 @@ void scenes::lobby::gui_customize(XrTime predicted_display_time)
ImGui::Dummy({0, constants::gui::font_size_large});
ImGui::SetCursorPosX((ImGui::GetWindowSize().x - side) / 2);
if (ui::icon_button(ICON_FA_ROTATE, {side, side}, false, _("Refresh")))
if (ui::icon_button(ICON_FA_ROTATE, {side, side}, false, _C("button label to re-deownload the environment list", "Refresh")))
download_environment_list();
}
}
@@ -746,46 +755,5 @@ void scenes::lobby::gui_customize(XrTime predicted_display_time)
popup_load_environment(predicted_display_time);
}
// if (ImGui::RadioButton(_S("Custom environment"), not config.passthrough_enabled and config.environment_model_uri != ""))
// lobby_file_picker_future = lobby_file_picker.open();
// imgui_ctx->vibrate_on_hover();
//
// try
// {
// lobby_file_picker.display();
//
// if (lobby_file_picker_future.valid() and lobby_file_picker_future.wait_for(0s) == std::future_status::ready)
// {
// auto environment = lobby_file_picker_future.get();
//
// // TODO load asynchronously
// // TODO allow caching
// spdlog::info("Loading new environment from {}", environment.path.native());
// auto t0 = std::chrono::steady_clock::now();
// auto new_lobby = load_gltf(environment.file);
// auto dt = std::chrono::steady_clock::now() - t0;
// spdlog::info("Loaded successfully in {}", dt);
//
// remove(lobby_entity);
// lobby_entity = add_gltf(new_lobby, layer_lobby).first;
//
// config.passthrough_enabled = false;
// setup_passthrough();
// }
// }
// catch (std::exception & e)
// {
// spdlog::warn("Cannot load environment: {}", e.what());
// }
// auto & lobby_node = world.get<components::node>(lobby_entity);
// float scale = lobby_node.scale.x;
// if (ImGui::SliderFloat("Environment scale", &scale, 0.1, 10, "%.3f", ImGuiSliderFlags_Logarithmic))
// lobby_node.scale = glm::vec3{scale, scale, scale};
// imgui_ctx->vibrate_on_hover();
//
// ImGui::SliderFloat("Environment elevation", &lobby_node.position.y, -3, 3, "%.3f");
// imgui_ctx->vibrate_on_hover();
ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing
}
+7 -7
View File
@@ -69,7 +69,7 @@ void scenes::lobby::gui_theme()
ui::theme & theme = ui::current();
auto & config = application::get_config();
ui::page_header(_S("Theme"), _S("Accent color, palette and sizing of the interface."));
ui::page_header(_cS("page header title", "Theme"), _cS("page header subtitle", "Accent color, palette and sizing of the interface."));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ui::metrics::card_item_spacing);
const float control_w = ui::metrics::setting_control_width;
@@ -77,7 +77,7 @@ void scenes::lobby::gui_theme()
ui::begin_card("##theme");
{
// Accent
ImGui::TextUnformatted(_S("Accent color"));
ImGui::TextUnformatted(_cS("setting name", "Accent color"));
ImGui::Dummy({0, 2});
for (const auto & swatch: ui::accent_swatches())
{
@@ -110,7 +110,7 @@ void scenes::lobby::gui_theme()
}();
static const int preset_default = 1;
ui::setting_label(_S("Preset"), _S("Surface and background palette"), control_w);
ui::setting_label(_cS("setting name", "Preset"), _cS("setting description", "Surface and background palette"), control_w);
if (ui::combo("##preset", _("Theme preset"), preset_items, &preset, control_w, &preset_default))
{
// keep the accent across a preset change, only the surfaces swap
@@ -130,7 +130,7 @@ void scenes::lobby::gui_theme()
// Rounding
static const int rounding_default = 8;
int rounding = int(theme.rounding);
ui::setting_label(_S("Rounding"), _S("Corner radius of controls"), control_w);
ui::setting_label(_cS("setting label", "Rounding"), _cS("setting description", "Corner radius of controls"), control_w);
if (ui::slider_int("##rounding", &rounding, 0, 20, "%d px", {control_w, 0}, &rounding_default))
{
theme.rounding = float(rounding);
@@ -142,7 +142,7 @@ void scenes::lobby::gui_theme()
static const int card_rounding_default = 14;
int card_rounding = int(theme.card_rounding);
ui::setting_label(_S("Card rounding"), _S("Corner radius of panels"), control_w);
ui::setting_label(_cS("setting label", "Card rounding"), _cS("setting description", "Corner radius of panels"), control_w);
if (ui::slider_int("##card_rounding", &card_rounding, 0, 28, "%d px", {control_w, 0}, &card_rounding_default))
{
theme.card_rounding = float(card_rounding);
@@ -155,7 +155,7 @@ void scenes::lobby::gui_theme()
// global font scale, 100% is the design default
static const int font_scale_default = 100;
int font_scale = int(theme.font_scale * 100);
ui::setting_label(_S("Text size"), _S("Global font scale"), control_w);
ui::setting_label(_cS("setting name", "Text size"), _cS("setting description", "Global font scale"), control_w);
if (ui::slider_int("##font_scale", &font_scale, 60, 140, "%d%%", {control_w, 0}, &font_scale_default))
{
theme.font_scale = float(font_scale) / 100.f;
@@ -168,7 +168,7 @@ void scenes::lobby::gui_theme()
// Panel transparency, independent of the selected preset
static const int opacity_default = 90;
int opacity = int(ui::background_alpha() * 100);
ui::setting_label(_S("Panel opacity"), _S("Opacity of the panel and card backgrounds"), control_w);
ui::setting_label(_cS("setting name", "Panel opacity"), _cS("setting description", "Opacity of the panel and card backgrounds"), control_w);
if (ui::slider_int("##opacity", &opacity, 20, 100, "%d%%", {control_w, 0}, &opacity_default))
{
ui::background_alpha() = float(opacity) / 100.f;
+16 -16
View File
@@ -531,7 +531,7 @@ void scenes::stream::gui_applications()
network_session->send_control(from_headset::get_running_applications{});
}
wivrn::ui::page_header(_S("Applications"), _S("Running XR applications on the server."));
wivrn::ui::page_header(_cS("page header title", "Applications"), _cS("page header subtitle", "Running XR applications on the server."));
auto apps = running_applications.lock();
std::ranges::sort(apps->applications, [](auto & l, auto & r) {
@@ -542,9 +542,9 @@ void scenes::stream::gui_applications()
const float gap = ImGui::GetStyle().ItemSpacing.x;
const float ctrl_h = ImGui::GetFrameHeight() * wivrn::ui::metrics::control_height;
const std::string stop_label = wivrn::ui::icon_label(ICON_FA_XMARK, _("Stop"));
const std::string stop_label = wivrn::ui::icon_label(ICON_FA_XMARK, _C("button label to ask an application to quit", "Stop"));
const float stop_w = wivrn::ui::button_width(stop_label);
const std::string active_label = wivrn::ui::icon_label(ICON_FA_CIRCLE_CHECK, _("Active"));
const std::string active_label = wivrn::ui::icon_label(ICON_FA_CIRCLE_CHECK, _C("chip displayed next to a running application while streaming", "Active"));
const ImVec2 active_sz = wivrn::ui::chip_size(active_label);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, wivrn::ui::metrics::card_item_spacing);
@@ -922,7 +922,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
if (auto bat = wivrn::gui::battery_status_indicator(instance.now()))
top_items.push_back({wivrn::ui::chip_width(bat->label, false, side),
[bat = *bat, side] { wivrn::ui::chip(bat.label, bat.style, false, side); }});
const std::string conn = _("Connected");
const std::string conn = _C("status in the title bar", "Connected");
top_items.push_back({wivrn::ui::chip_width(conn, true, side),
[conn, side] { wivrn::ui::chip(conn, wivrn::ui::chip_style::success, true, side); }});
const std::string close_label = _S("Close");
@@ -949,10 +949,10 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
// navigation sidebar, the settings items swap the page but keep the coarse settings tab
wivrn::ui::begin_sidebar(top_bar_h, tab_width, 2);
{
wivrn::ui::nav_section(_S("STREAM"));
if (wivrn::ui::nav_item(ICON_FA_LIST, _S("Applications"), gui_status == stream_tab::applications))
wivrn::ui::nav_section(_cS("tab group", "STREAM"));
if (wivrn::ui::nav_item(ICON_FA_LIST, _cS("tab label", "Applications"), gui_status == stream_tab::applications))
next_gui_status = stream_tab::applications;
if (wivrn::ui::nav_item(ICON_FA_ROCKET, _S("Start"), false))
if (wivrn::ui::nav_item(ICON_FA_ROCKET, _cS("tab label", "Start"), false))
{
apps.reset();
network_session->send_control(from_headset::get_application_list{
@@ -965,7 +965,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
if (wivrn::ui::nav_item(ICON_FA_COMPUTER, _S("Statistics"), gui_status == stream_tab::stats))
next_gui_status = stream_tab::stats;
wivrn::ui::nav_section(_S("SETTINGS"));
wivrn::ui::nav_section(_cS("tab group", "SETTINGS"));
auto settings_item = [&](const char * icon, const std::string & label, settings_page page) {
if (wivrn::ui::nav_item(icon, label, gui_status == stream_tab::settings and current_settings_page == page))
{
@@ -973,18 +973,18 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
next_gui_status = stream_tab::settings;
}
};
settings_item(ICON_FA_GAUGE_HIGH, _S("Performance"), settings_page::performance);
settings_item(ICON_FA_TOWER_BROADCAST, _S("Streaming"), settings_page::streaming);
settings_item(ICON_FA_WAND_MAGIC_SPARKLES, _S("Post-processing"), settings_page::post_processing);
settings_item(ICON_FA_VOLUME_HIGH, _S("Audio"), settings_page::audio);
settings_item(ICON_FA_LOCATION_CROSSHAIRS, _S("Tracking"), settings_page::tracking);
settings_item(ICON_FA_GEARS, _S("System"), settings_page::system);
settings_item(ICON_FA_GAUGE_HIGH, _cS("tab label", "Performance"), settings_page::performance);
settings_item(ICON_FA_TOWER_BROADCAST, _cS("tab label", "Streaming"), settings_page::streaming);
settings_item(ICON_FA_WAND_MAGIC_SPARKLES, _cS("tab label", "Post-processing"), settings_page::post_processing);
settings_item(ICON_FA_VOLUME_HIGH, _cS("tab label", "Audio"), settings_page::audio);
settings_item(ICON_FA_LOCATION_CROSSHAIRS, _cS("tab label", "Tracking"), settings_page::tracking);
settings_item(ICON_FA_GEARS, _cS("tab label", "System"), settings_page::system);
// pinned to the bottom
wivrn::ui::sidebar_footer();
if (wivrn::ui::nav_item(ICON_FA_CHART_LINE, _S("Statistics overlay"), false))
if (wivrn::ui::nav_item(ICON_FA_CHART_LINE, _cS("tab label", "Statistics overlay"), false))
next_gui_status = stream_tab::overlay_only;
if (wivrn::ui::nav_item(ICON_FA_MINIMIZE, _S("Compact view"), false))
if (wivrn::ui::nav_item(ICON_FA_MINIMIZE, _cS("tab label", "Compact view"), false))
next_gui_status = stream_tab::compact;
}
wivrn::ui::end_sidebar();