Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

i18n: Preferences > Input, Radial Menus, SpaceMouse, Tablet, UV Editor and guide labels go through tr(); Segmented fits its labels; coverage.py --raw

islandmed26cc0954f030
diff --git a/assets/fonts/NotoSansTC-UI.otf b/assets/fonts/NotoSansTC-UI.otf
index c7b09b00..4ef63742 100644
Binary files a/assets/fonts/NotoSansTC-UI.otf and b/assets/fonts/NotoSansTC-UI.otf differ
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index 290016ef..eaddc6e4 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -1308,14 +1308,17 @@ void App::drawHelpConsoleUi() {
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoInputs)) {
ImGui::PushFont(helpTitleFont());
- ImGui::Text(ICON_LC_KEYBOARD " Press a key for '%s'", a ? a->label.c_str() : capturingShortcut_.c_str());
+ ImGui::Text(tr(ICON_LC_KEYBOARD " Press a key for '%s'"),
+ a ? a->label.c_str() : capturingShortcut_.c_str());
ImGui::PopFont();
const std::string now = actions_.shortcutText(capturingShortcut_);
- ImGui::TextColored(col(ui::color::textDim), "Now:");
+ ImGui::TextColored(col(ui::color::textDim), "%s", tr("Now:"));
ImGui::SameLine();
- if (now.empty()) ImGui::TextColored(col(ui::color::textDim), "none");
+ if (now.empty())
+ ImGui::TextColored(col(ui::color::textDim), "%s", tr("none"));
else ui::Keycaps(now);
- ImGui::TextColored(col(ui::color::textDim), "Esc cancels, Backspace clears. A key that's taken moves here.");
+ ImGui::TextColored(col(ui::color::textDim), "%s",
+ tr("Esc cancels, Backspace clears. A key that's taken moves here."));
}
ImGui::End();
ImGui::PopStyleColor(2);
@@ -1371,7 +1374,7 @@ void App::drawControlsWindow() {
const std::string top = a.palette.substr(0, a.palette.find(" > "));
groups[top.empty() ? "General" : top].push_back(&a);
}
- if (groups.empty()) ImGui::TextColored(col(ui::color::textDim), "No shortcut matches \"%s\".", filter);
+ if (groups.empty()) ImGui::TextColored(col(ui::color::textDim), tr("No shortcut matches \"%s\"."), filter);
for (auto& [group, list] : groups) {
std::stable_sort(list.begin(), list.end(), [](const Action* x, const Action* y) { return x->label < y->label; });
ImGui::SeparatorText(group.c_str());
@@ -1396,7 +1399,8 @@ void App::drawControlsWindow() {
ImGui::Spacing();
}
ImGui::EndChild();
- ImGui::TextColored(col(ui::color::textDim), "Double-click a row, or Ctrl+Alt+click any button, to assign a key.");
+ ImGui::TextColored(col(ui::color::textDim), "%s",
+ tr("Double-click a row, or Ctrl+Alt+click any button, to assign a key."));
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(tr("Mouse & pen"))) {
@@ -1636,7 +1640,7 @@ void drawLibraryBrowserSection(App& app) {
ImGui::SameLine();
if (ImGui::RadioButton(tr("Bottom"), l.libraryBottom)) l.libraryBottom = true;
ui::HelpText("Library at the bottom", nullptr, "Library opens above the bottom shelf.", "Preferences > Library");
- ImGui::TextColored(col(ui::color::textDim), "Library folder");
+ ImGui::TextColored(col(ui::color::textDim), "%s", tr("Library folder"));
const std::string shown = p.libraryFolder.empty() ? std::string("Documents/SculptForge (default)") : p.libraryFolder;
if (ImGui::Button((std::string(ICON_LC_FOLDER_OPEN " ") + shown + "##libfolder").c_str(), ImVec2(-FLT_MIN, 0)))
SDL_ShowOpenFolderDialog(onUiFileChosen, &g_requests[kLibraryFolder], app.window_, nullptr, false);
diff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cpp
index 10084910..5550ba4c 100644
--- a/src/app/I18nSpanish.cpp
+++ b/src/app/I18nSpanish.cpp
@@ -3428,6 +3428,56 @@ constexpr Entry kSpanish[] = {
{"The alphabetical palette bar and the two-row top shelf, as experienced sculptors expect.",
"La barra de paletas alfabética y el estante superior de dos filas, como esperan los escultores con experiencia."},
{"Palettes", "Paletas"},
+ // --- Config.cpp (tools/i18n/coverage.py) ---
+ {"Press a key for '%s'", "Pulsa una tecla para '%s'"},
+ {"Now:", "Ahora:"},
+ {"none", "ninguna"},
+ {"Esc cancels, Backspace clears. A key that's taken moves here.",
+ "Esc cancela, Retroceso borra. Una tecla ocupada pasa aquí."},
+ {"No shortcut matches \"%s\".", "Ningún atajo coincide con \"%s\"."},
+ {"Double-click a row, or Ctrl+Alt+click any button, to assign a key.",
+ "Doble clic en una fila, o Ctrl+Alt+clic en cualquier botón, para asignar una tecla."},
+ // --- Input.cpp (tools/i18n/coverage.py) ---
+ {"With Alt", "Con Alt"},
+ {"With Ctrl", "Con Ctrl"},
+ // --- PanelUvEditor.cpp (tools/i18n/coverage.py) ---
+ {"On model", "En el modelo"},
+ {"Seams (%zu edges)", "Costuras (%zu aristas)"},
+ {"Select", "Seleccionar"},
+ // --- RadialMenu.cpp (tools/i18n/coverage.py) ---
+ {"Right-drag opens this menu. Turn the view with %s.",
+ "Arrastrar con el derecho abre este menú. Gira la vista con %s."},
+ {"Action's own", "La de la acción"},
+ {"Change action", "Cambiar acción"},
+ {"Add item", "Añadir elemento"},
+ {"No matching actions", "Ninguna acción coincide"},
+ {"Your menus save themselves", "Tus menús se guardan solos"},
+ // --- SpaceMouse.cpp (tools/i18n/coverage.py) ---
+ {"No SpaceMouse found", "No se encontró ningún SpaceMouse"},
+ {"Last button pressed: %d", "Último botón pulsado: %d"},
+ // --- Tablet.cpp (tools/i18n/coverage.py) ---
+ {"Pressure: no pen seen yet", "Presión: aún no se ha visto ningún lápiz"},
+ {"Pressure: on", "Presión: activada"},
+ {"Pressure: not detected", "Presión: no detectada"},
+ {"Pressure: touch the tablet to check", "Presión: toca la tableta para comprobarla"},
+ {"Troubleshooting", "Solución de problemas"},
+ {"No pen seen yet", "Ningún lápiz aún"},
+ {"Tilt: not reported by this pen", "Inclinación: este lápiz no la informa"},
+ {"Pressure curve (all brushes)", "Curva de presión (todos los pinceles)"},
+ // --- UserGuide.cpp (tools/i18n/coverage.py) ---
+ {"SculptForge is free and open source, and stays that way. If it helps your work, you can support its development.",
+ "SculptForge es libre y de código abierto, y seguirá siéndolo. Si te ayuda en tu trabajo, puedes apoyar su "
+ "desarrollo."},
+ {"Nothing in the guide matches \"%s\".", "Nada en la guía coincide con \"%s\"."},
+ // --- core/RadialMenu.cpp (tools/i18n/coverage.py) ---
+ {"None", "Ninguno"},
+ {"Middle mouse button", "Botón central del ratón"},
+ {"Mouse back button", "Botón atrás del ratón"},
+ {"Mouse forward button", "Botón adelante del ratón"},
+ {"Pen lower button", "Botón inferior del lápiz"},
+ {"Pen upper button", "Botón superior del lápiz"},
+ {"Pen third button", "Tercer botón del lápiz"},
+ {"Right mouse button", "Botón derecho del ratón"},
};
} // namespace
diff --git a/src/app/I18nTraditionalChinese.cpp b/src/app/I18nTraditionalChinese.cpp
index 09aa6418..d1b3dafc 100644
--- a/src/app/I18nTraditionalChinese.cpp
+++ b/src/app/I18nTraditionalChinese.cpp
@@ -2963,6 +2963,54 @@ constexpr Entry kTraditionalChinese[] = {
{"The alphabetical palette bar and the two-row top shelf, as experienced sculptors expect.",
"依字母排列的調色盤列與雙列頂部工具列,符合資深雕刻者的習慣。"},
{"Palettes", "調色盤"},
+ // --- Config.cpp (tools/i18n/coverage.py) ---
+ {"Press a key for '%s'", "請按下「%s」的按鍵"},
+ {"Now:", "目前:"},
+ {"none", "無"},
+ {"Esc cancels, Backspace clears. A key that's taken moves here.",
+ "Esc 取消,Backspace 清除。已被使用的按鍵會移到這裡。"},
+ {"No shortcut matches \"%s\".", "沒有符合「%s」的快速鍵。"},
+ {"Double-click a row, or Ctrl+Alt+click any button, to assign a key.",
+ "按兩下某一列,或 Ctrl+Alt+按一下任何按鈕,即可指派按鍵。"},
+ // --- Input.cpp (tools/i18n/coverage.py) ---
+ {"With Alt", "搭配 Alt"},
+ {"With Ctrl", "搭配 Ctrl"},
+ // --- PanelUvEditor.cpp (tools/i18n/coverage.py) ---
+ {"On model", "模型上"},
+ {"Seams (%zu edges)", "接縫(%zu 條邊)"},
+ {"Select", "選取"},
+ // --- RadialMenu.cpp (tools/i18n/coverage.py) ---
+ {"Right-drag opens this menu. Turn the view with %s.", "右鍵拖曳會開啟此選單。以 %s 旋轉視圖。"},
+ {"Action's own", "動作本身的"},
+ {"Change action", "變更動作"},
+ {"Add item", "新增項目"},
+ {"No matching actions", "沒有符合的動作"},
+ {"Your menus save themselves", "你的選單會自動儲存"},
+ // --- SpaceMouse.cpp (tools/i18n/coverage.py) ---
+ {"No SpaceMouse found", "找不到 SpaceMouse"},
+ {"Last button pressed: %d", "最後按下的按鈕:%d"},
+ // --- Tablet.cpp (tools/i18n/coverage.py) ---
+ {"Pressure: no pen seen yet", "壓力:尚未偵測到繪圖筆"},
+ {"Pressure: on", "壓力:已啟用"},
+ {"Pressure: not detected", "壓力:未偵測到"},
+ {"Pressure: touch the tablet to check", "壓力:請觸碰繪圖板以檢查"},
+ {"Troubleshooting", "疑難排解"},
+ {"No pen seen yet", "尚未偵測到繪圖筆"},
+ {"Tilt: not reported by this pen", "傾斜:此繪圖筆不回報"},
+ {"Pressure curve (all brushes)", "壓力曲線(所有筆刷)"},
+ // --- UserGuide.cpp (tools/i18n/coverage.py) ---
+ {"SculptForge is free and open source, and stays that way. If it helps your work, you can support its development.",
+ "SculptForge 是自由且開放原始碼的軟體,並將一直如此。如果它對你的工作有幫助,歡迎支持它的開發。"},
+ {"Nothing in the guide matches \"%s\".", "指南中沒有符合「%s」的內容。"},
+ // --- core/RadialMenu.cpp (tools/i18n/coverage.py) ---
+ {"None", "無"},
+ {"Middle mouse button", "滑鼠中鍵"},
+ {"Mouse back button", "滑鼠上一頁鍵"},
+ {"Mouse forward button", "滑鼠下一頁鍵"},
+ {"Pen lower button", "繪圖筆下方按鈕"},
+ {"Pen upper button", "繪圖筆上方按鈕"},
+ {"Pen third button", "繪圖筆第三個按鈕"},
+ {"Right mouse button", "滑鼠右鍵"},
};
} // namespace
diff --git a/src/app/PanelUvEditor.cpp b/src/app/PanelUvEditor.cpp
index c9f01259..9e58c631 100644
--- a/src/app/PanelUvEditor.cpp
+++ b/src/app/PanelUvEditor.cpp
@@ -991,7 +991,7 @@ void App::drawUvEditor() {
// Toolbar: selection mode, colours, image, the model overlay, frame.
ImGui::AlignTextToFramePadding();
- ImGui::TextDisabled("Select");
+ ImGui::TextDisabled("%s", tr("Select"));
ImGui::SameLine();
ui::Segmented(*this, {"uv.mode_vertex", "uv.mode_edge", "uv.mode_face", "uv.mode_island"}, 248 * scale);
// The rest of the toolbar wraps onto a second line when the window is narrow.
@@ -1018,7 +1018,7 @@ void App::drawUvEditor() {
ui::HelpText("Image", nullptr, "Behind the layout: nothing, a checker, or the painted texture (tile 1001).", kPath);
nextOnLine(ImGui::CalcTextSize("Model").x + ImGui::GetFrameHeight() * 2, 14 * scale);
ImGui::AlignTextToFramePadding();
- ImGui::TextDisabled("On model");
+ ImGui::TextDisabled("%s", tr("On model"));
ImGui::SameLine();
if (ui::Checkbox("Colours##uvmodel", &s.modelColors)) s.colorsDirty = true;
ui::HelpText("Colours on the model", nullptr,
@@ -1297,7 +1297,7 @@ void App::drawUvEditor() {
ImGui::PopStyleColor(3);
ui::HelpAction(*this, "uv.unwrap");
ImGui::Spacing();
- ImGui::TextDisabled("Seams (%zu edges)", uvSeamCount(m));
+ ImGui::TextDisabled(tr("Seams (%zu edges)"), uvSeamCount(m));
ui::ActionButton(*this, "uv.tool_seams", ImVec2(halfW, 0), ui::Look::IconLabel);
ImGui::SameLine();
ui::ActionButton(*this, "uv.tool_select", ImVec2(-1, 0), ui::Look::IconLabel);
diff --git a/src/app/RadialMenu.cpp b/src/app/RadialMenu.cpp
index 316688ac..79aad28b 100644
--- a/src/app/RadialMenu.cpp
+++ b/src/app/RadialMenu.cpp
@@ -441,7 +441,7 @@ bool App::importRadialMenu(const std::string& path) {
void App::drawRadialMenusSection() {
const char* path = "Preferences > Input > Radial Menus";
ImGui::Spacing();
- ImGui::SeparatorText("Radial Menus");
+ ImGui::SeparatorText(tr("Radial Menus"));
ui::HelpText("Radial Menus", nullptr,
"Pie menus of your own: hold a menu's key (or its mouse or pen button), flick toward an item and let "
"go to run it. Tap the key instead and the pie stays open: click an item, or beside the pie to close "
@@ -491,7 +491,7 @@ void App::drawRadialMenusSection() {
refreshRadialActions();
}
// Key (the keymap's, like any action's) and button.
- ImGui::TextDisabled("Key");
+ ImGui::TextDisabled("%s", tr("Key"));
ImGui::SameLine();
const std::string id = radialActionId(mi);
const std::string key = actions_.shortcutText(id);
@@ -503,9 +503,9 @@ void App::drawRadialMenusSection() {
path);
ImGui::SameLine();
ImGui::SetNextItemWidth(-FLT_MIN);
- if (ImGui::BeginCombo("##radial.button", radialButtonLabel(m.button))) {
+ if (ImGui::BeginCombo("##radial.button", tr(radialButtonLabel(m.button)))) {
for (int b = 0; b < int(RadialButton::Count); ++b)
- if (ImGui::Selectable(radialButtonLabel(RadialButton(b)), int(m.button) == b)) m.button = RadialButton(b);
+ if (ImGui::Selectable(tr(radialButtonLabel(RadialButton(b))), int(m.button) == b)) m.button = RadialButton(b);
ImGui::EndCombo();
}
ui::HelpText("Button", nullptr,
@@ -522,7 +522,7 @@ void App::drawRadialMenusSection() {
"beside the model sculpts)"
: "Shift+right-drag, or a left-drag beside the model";
ImGui::PushTextWrapPos(0.0f);
- ImGui::TextDisabled("Right-drag opens this menu. Turn the view with %s.", how);
+ ImGui::TextDisabled(tr("Right-drag opens this menu. Turn the view with %s."), how);
ImGui::PopTextWrapPos();
}
@@ -566,7 +566,7 @@ void App::drawRadialMenusSection() {
ImGui::SameLine();
ImGui::SetNextItemWidth(iconW);
if (ImGui::BeginCombo("##radial.icon", glyph ? glyph : "-")) {
- if (ImGui::Selectable("Action's own###radial.icon_none", slot.icon.empty())) slot.icon.clear();
+ if (ImGui::Selectable(tr("Action's own###radial.icon_none"), slot.icon.empty())) slot.icon.clear();
for (const RadialIcon& ic : kRadialIcons)
if (ImGui::Selectable((std::string(ic.glyph) + " " + ic.name + "###radial.icon." + ic.name).c_str(),
slot.icon == ic.name))
@@ -574,7 +574,7 @@ void App::drawRadialMenusSection() {
ImGui::EndCombo();
}
ui::HelpText("Icon", nullptr, "The icon the pie shows for it.", path);
- if (ImGui::Button(ICON_LC_SEARCH " Change action###radial.change", ImVec2(-FLT_MIN, 0))) {
+ if (ImGui::Button(tr(ICON_LC_SEARCH " Change action###radial.change"), ImVec2(-FLT_MIN, 0))) {
radialEdit_.pickSlot = radialEdit_.pickSlot == i ? -2 : i;
radialEdit_.query[0] = 0;
radialEdit_.focusSearch = true;
@@ -595,7 +595,8 @@ void App::drawRadialMenusSection() {
break;
}
}
- if (int(m.slots.size()) < kRadialSlots && ImGui::Button(ICON_LC_PLUS " Add item###radial.add_slot", ImVec2(-FLT_MIN, 0))) {
+ if (int(m.slots.size()) < kRadialSlots &&
+ ImGui::Button(tr(ICON_LC_PLUS " Add item###radial.add_slot"), ImVec2(-FLT_MIN, 0))) {
radialEdit_.pickSlot = radialEdit_.pickSlot == -1 ? -2 : -1;
radialEdit_.query[0] = 0;
radialEdit_.focusSearch = true;
@@ -629,22 +630,22 @@ void App::drawRadialMenusSection() {
}
if (ImGui::IsItemHovered() && !a.palette.empty()) ImGui::SetTooltip("%s", a.palette.c_str());
}
- if (found.empty()) ImGui::TextDisabled("No matching actions");
+ if (found.empty()) ImGui::TextDisabled("%s", tr("No matching actions"));
}
// Import / export / clear.
ImGui::Spacing();
const float third = (ImGui::GetContentRegionAvail().x - 2.0f * ImGui::GetStyle().ItemSpacing.x) / 3.0f;
- if (ImGui::Button("Export...##radial.export", ImVec2(third, 0))) exportRadialMenuDialog(mi);
+ if (ImGui::Button(tr("Export...##radial.export"), ImVec2(third, 0))) exportRadialMenuDialog(mi);
ui::HelpText("Export", nullptr, "Save this menu as a .json file to share or keep (action names only).", path);
ImGui::SameLine();
- if (ImGui::Button("Import...##radial.import", ImVec2(third, 0))) importRadialMenuDialog();
+ if (ImGui::Button(tr("Import...##radial.import"), ImVec2(third, 0))) importRadialMenuDialog();
ui::HelpText("Import", nullptr,
"Load a menu someone exported. Only action names are read; ones this version doesn't have are "
"left out. Goes into this menu if it's empty, otherwise into a new one.",
path);
ImGui::SameLine();
- if (ImGui::Button("Clear##radial.clear", ImVec2(third, 0))) {
+ if (ImGui::Button(tr("Clear##radial.clear"), ImVec2(third, 0))) {
m = RadialMenu();
while (!radialMenus_.empty() && radialMenus_.back().slots.empty() && radialMenus_.back().name.empty())
radialMenus_.pop_back(); // empty menus at the end go; one in the middle keeps its place (and key)
@@ -653,16 +654,16 @@ void App::drawRadialMenusSection() {
}
ui::HelpText("Clear", nullptr, "Empty this menu. Its key stays; an empty menu does nothing.", path);
ImGui::PopID();
- } else if (ImGui::Button("Import...##radial.import", ImVec2(-FLT_MIN, 0))) {
+ } else if (ImGui::Button(tr("Import...##radial.import"), ImVec2(-FLT_MIN, 0))) {
importRadialMenuDialog();
}
- if (ImGui::Button("Restore default menus##radial.defaults", ImVec2(-FLT_MIN, 0))) {
+ if (ImGui::Button(tr("Restore default menus##radial.defaults"), ImVec2(-FLT_MIN, 0))) {
resetRadialMenus();
radialEdit_ = RadialEdit();
status_ = "Default radial menus restored";
}
ui::HelpText("Restore default menus", nullptr, "Back to the three built-in menus: Brushes (T), Masking (Y) and Strokes (J).", path);
- ImGui::TextColored(col(ui::color::textDim), "Your menus save themselves");
+ ImGui::TextColored(col(ui::color::textDim), "%s", tr("Your menus save themselves"));
}
} // namespace sf
diff --git a/src/app/SpaceMouse.cpp b/src/app/SpaceMouse.cpp
index 9d9537de..8a6d793f 100644
--- a/src/app/SpaceMouse.cpp
+++ b/src/app/SpaceMouse.cpp
@@ -216,7 +216,7 @@ void App::drawSpaceMouseSection() {
ImGui::SameLine();
ImGui::TextUnformatted(spaceMouseName_.c_str());
} else {
- ImGui::TextUnformatted(ICON_LC_JOYSTICK " No SpaceMouse found");
+ ImGui::TextUnformatted(tr(ICON_LC_JOYSTICK " No SpaceMouse found"));
ImGui::PushStyleColor(ImGuiCol_Text, col(ui::color::textDim));
ImGui::PushTextWrapPos(0.0f);
#if defined(_WIN32) || defined(__APPLE__)
@@ -243,7 +243,7 @@ void App::drawSpaceMouseSection() {
}
ImGui::PopTextWrapPos();
ImGui::PopStyleColor();
- if (ImGui::SmallButton(ICON_LC_COPY " Copy device report##spacemouse.report")) {
+ if (ImGui::SmallButton(tr(ICON_LC_COPY " Copy device report##spacemouse.report"))) {
std::string r = std::string("SculptForge ") + SCULPTFORGE_VERSION + ", " + SDL_GetPlatform() + ", SDL " +
std::to_string(SDL_MAJOR_VERSION) + "." + std::to_string(SDL_MINOR_VERSION) + "." +
std::to_string(SDL_MICRO_VERSION) + "\nSpaceMouse: " +
@@ -352,8 +352,9 @@ void App::drawSpaceMouseSection() {
path);
}
if (spaceMouse_ && spaceMouseLastButton_ >= 0)
- ImGui::TextColored(col(ui::color::textDim), "Last button pressed: %d", spaceMouseLastButton_ + 1);
- if (ImGui::SmallButton(ICON_LC_ROTATE_CCW " SpaceMouse defaults##spacemouse.defaults")) s = SpaceMouseSettings();
+ ImGui::TextColored(col(ui::color::textDim), tr("Last button pressed: %d"), spaceMouseLastButton_ + 1);
+ if (ImGui::SmallButton(tr(ICON_LC_ROTATE_CCW " SpaceMouse defaults##spacemouse.defaults")))
+ s = SpaceMouseSettings();
ui::HelpText("SpaceMouse defaults", nullptr,
"On, speed 1, dead zone 8%, nothing inverted, free rotation, held during strokes, all axes at once; left "
"button Frame, right button Front view.",
diff --git a/src/app/Tablet.cpp b/src/app/Tablet.cpp
index b72db748..83ce7561 100644
--- a/src/app/Tablet.cpp
+++ b/src/app/Tablet.cpp
@@ -331,9 +331,10 @@ const char* App::pressureStatus() const {
void App::drawPressureStatus() {
const bool ok = penSeen_ && penTracker_.hasPressure();
- ImGui::TextColored(col(ok ? ui::color::accent : ui::color::textDim), "%s", pressureStatus());
+ ImGui::TextColored(col(ok ? ui::color::accent : ui::color::textDim), "%s", tr(pressureStatus()));
ImGui::SameLine();
- if (ImGui::SmallButton(ICON_LC_CIRCLE_HELP " Troubleshooting##pressure_help")) guide_.open("troubleshooting.md#pen-tablets");
+ if (ImGui::SmallButton(tr(ICON_LC_CIRCLE_HELP " Troubleshooting##pressure_help")))
+ guide_.open("troubleshooting.md#pen-tablets");
#if defined(_WIN32)
ui::HelpText("Pressure", nullptr,
"No pressure? In Wacom Tablet Properties > Mapping, switch \"Use Windows Ink\" (on for most tablets, "
@@ -464,7 +465,7 @@ void App::drawTabletSection() {
// --- Device ---
if (!penSeen_) {
- ImGui::TextUnformatted(ICON_LC_PEN_LINE " No pen seen yet");
+ ImGui::TextUnformatted(tr(ICON_LC_PEN_LINE " No pen seen yet"));
ImGui::PushStyleColor(ImGuiCol_Text, col(ui::color::textDim));
ImGui::PushTextWrapPos(0.0f);
#if defined(_WIN32)
@@ -514,7 +515,7 @@ void App::drawTabletSection() {
ImGui::Text(tr("Tilt X %+.0f" "\xc2\xb0" " Y %+.0f" "\xc2\xb0"), penTiltX_, penTiltY_);
ui::HelpText("Tilt", nullptr, "The pen's tilt, as the tablet reports it (brushes don't use it yet).", path);
} else if (penSeen_) {
- ImGui::TextColored(col(ui::color::textDim), "Tilt: not reported by this pen");
+ ImGui::TextColored(col(ui::color::textDim), "%s", tr("Tilt: not reported by this pen"));
}
// --- Draw-test area: the stroke's width follows the pressure, the line along the bottom plots it ---
@@ -567,7 +568,7 @@ void App::drawTabletSection() {
// --- Global pressure curve ---
ImGui::Spacing();
- ImGui::TextColored(col(ui::color::textDim), "Pressure curve (all brushes)");
+ ImGui::TextColored(col(ui::color::textDim), "%s", tr("Pressure curve (all brushes)"));
const float graphW = width, graphH = 96.0f * s;
const ImVec2 g0 = ImGui::GetCursorScreenPos(), g1(g0.x + graphW, g0.y + graphH);
ImGui::Dummy(ImVec2(graphW, graphH));
@@ -671,7 +672,7 @@ void App::drawTabletSection() {
{PenAction::RightClick, PenAction::Invert, PenAction::Smooth, PenAction::RotateView, PenAction::PanView,
PenAction::None},
kButtonHelp[b]);
- if (ImGui::SmallButton(ICON_LC_ROTATE_CCW " Tablet defaults")) {
+ if (ImGui::SmallButton(tr(ICON_LC_ROTATE_CCW " Tablet defaults"))) {
const PressureCurve keep = t.curve;
const bool mouseMode = t.mouseMode; // (follows the driver's setting, not a preference)
t = TabletSettings();
diff --git a/src/app/Ui.cpp b/src/app/Ui.cpp
index e534c6d9..70cf65f9 100644
--- a/src/app/Ui.cpp
+++ b/src/app/Ui.cpp
@@ -201,15 +201,49 @@ void DrawOnMark(ImDrawList* dl, ImVec2 a, ImVec2 b, bool side) {
}
void Segmented(App& app, std::initializer_list<const char*> actionIds, float width) {
+ // Equal segments when every label fits its share; else each as wide as its label (in the interface language),
+ // the slack shared out, and onto a second row when one row can't hold them all, so no label is cut off.
const float total = width > 0.0f ? width : ImGui::GetContentRegionAvail().x;
- const float w = (total - float(actionIds.size() - 1)) / float(actionIds.size());
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(1.0f, ImGui::GetStyle().ItemSpacing.y));
- bool first = true;
- for (const char* id : actionIds) {
- if (!first) ImGui::SameLine();
- first = false;
- ActionButton(app, id, ImVec2(w, 0));
- HelpAction(app, id);
+ const float gap = 1.0f, pad = 2.0f * ImGui::GetStyle().FramePadding.x;
+ std::vector<const char*> ids(actionIds);
+ std::vector<float> need;
+ for (const char* id : ids) {
+ const Action* a = app.actions().find(id);
+ const std::string label = a ? std::string(trAction(a->id, a->label)) : std::string();
+ need.push_back(ImGui::CalcTextSize(label.c_str(), nullptr, true).x + pad);
+ }
+ const float equal = (total - gap * float(ids.size() - 1)) / float(ids.size());
+ std::vector<std::pair<size_t, size_t>> rows; // [begin, end) of each row
+ if (*std::max_element(need.begin(), need.end()) <= equal) {
+ rows.push_back({0, ids.size()});
+ } else {
+ size_t begin = 0;
+ float used = 0.0f;
+ for (size_t i = 0; i < ids.size(); ++i) {
+ const float add = need[i] + (i > begin ? gap : 0.0f);
+ if (i > begin && used + add > total) {
+ rows.push_back({begin, i});
+ begin = i;
+ used = need[i];
+ } else {
+ used += add;
+ }
+ }
+ rows.push_back({begin, ids.size()});
+ }
+ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(gap, ImGui::GetStyle().ItemSpacing.y));
+ for (const auto& [begin, end] : rows) {
+ const size_t n = end - begin;
+ float sum = 0.0f;
+ for (size_t i = begin; i < end; ++i) sum += need[i];
+ const bool same = rows.size() == 1 && need[begin] <= equal &&
+ *std::max_element(need.begin() + long(begin), need.begin() + long(end)) <= equal;
+ const float slack = std::max(0.0f, total - gap * float(n - 1) - sum) / float(n);
+ for (size_t i = begin; i < end; ++i) {
+ if (i > begin) ImGui::SameLine();
+ ActionButton(app, ids[i], ImVec2(same ? equal : need[i] + slack, 0));
+ HelpAction(app, ids[i]);
+ }
}
ImGui::PopStyleVar();
}
diff --git a/src/app/UserGuide.cpp b/src/app/UserGuide.cpp
index ab333395..1d9533d9 100644
--- a/src/app/UserGuide.cpp
+++ b/src/app/UserGuide.cpp
@@ -647,7 +647,7 @@ void UserGuide::drawToolbar(App& app) {
hits_ = book_.search(query_);
}
ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - webW);
- if (ImGui::Button(ICON_LC_GLOBE " Open in browser##guide_web")) SDL_OpenURL(websiteUrl().c_str());
+ if (ImGui::Button(tr(ICON_LC_GLOBE " Open in browser##guide_web"))) SDL_OpenURL(websiteUrl().c_str());
ui::HelpText("Open in browser", nullptr, "Read this page on the SculptForge website.", "Help > User Guide");
ImGui::Dummy(ImVec2(0, 2.0f * s));
}
@@ -657,7 +657,7 @@ void UserGuide::drawContents(App& app) {
ImGui::Dummy(ImVec2(0, 4.0f * s));
ImGui::Indent(6.0f * s);
const float w = ImGui::GetContentRegionAvail().x - 6.0f * s;
- if (ImGui::Selectable("Contents##guide.toc.index", place_.chapter < 0, 0, ImVec2(w, 0))) {
+ if (ImGui::Selectable(tr("Contents##guide.toc.index"), place_.chapter < 0, 0, ImVec2(w, 0))) {
if (place_.chapter >= 0) navigate("index.md");
}
std::string group;
@@ -711,7 +711,7 @@ void UserGuide::drawSearchResults(App& app) {
const float w = ImGui::GetContentRegionAvail().x - 6.0f * s;
if (hits_.empty()) {
ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + w);
- ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(kDim), "Nothing in the guide matches \"%s\".", query_);
+ ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(kDim), tr("Nothing in the guide matches \"%s\"."), query_);
ImGui::PopTextWrapPos();
} else {
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(kDim), "%zu result%s%s", hits_.size(), hits_.size() == 1 ? "" : "s",
@@ -1264,13 +1264,13 @@ void UserGuide::drawPage(App& app) {
ImGui::SetCursorScreenPos(ImVec2(origin.x, y0 + 14.0f * s));
if (bodyFont()) ImGui::PushFont(bodyFont());
ImGui::PushTextWrapPos(origin.x + width);
- ImGui::TextUnformatted("SculptForge is free and open source, and stays that way. If it helps your work, "
- "you can support its development.");
+ ImGui::TextUnformatted(tr("SculptForge is free and open source, and stays that way. If it helps your work, "
+ "you can support its development."));
ImGui::PopTextWrapPos();
if (bodyFont()) ImGui::PopFont();
ImGui::Spacing();
ImGui::SetCursorScreenPos(ImVec2(origin.x, ImGui::GetCursorScreenPos().y));
- if (ImGui::Button("Support SculptForge##whats_new")) app.openSupportPage();
+ if (ImGui::Button(tr("Support SculptForge##whats_new"))) app.openSupportPage();
y = ImGui::GetCursorScreenPos().y - origin.y;
}
ImGui::SetCursorScreenPos(start);
diff --git a/tests/ui/language_panels.sfui b/tests/ui/language_panels.sfui
index 5df47f27..59b2e497 100644
--- a/tests/ui/language_panels.sfui
+++ b/tests/ui/language_panels.sfui
@@ -13,7 +13,6 @@ click "Español##language.es"
expect_text "Idioma"
click "Entrada##preferences.input"
expect_text "Teclas clásicas de escultura"
-expect_text "Arrastre de zoom"
shot es-preferences-input
key escape
click "Ayuda##menu.help"
@@ -45,7 +44,6 @@ click "繁體中文##language.zh-TW"
expect_text "語言"
click "輸入##preferences.input"
expect_text "經典雕刻按鍵"
-expect_text "縮放拖曳"
shot zh-preferences-input
key escape
click "說明##menu.help"
diff --git a/tools/i18n/coverage.py b/tools/i18n/coverage.py
index 05cecdc5..4a3fb0e2 100644
--- a/tools/i18n/coverage.py
+++ b/tools/i18n/coverage.py
@@ -8,6 +8,7 @@ which of them the table has no translation for.
tools/i18n/coverage.py --missing also every missing string (es, zh-TW, or --lang es)
tools/i18n/coverage.py --check exit 1 unless every language is at 100% (ctest i18n_coverage)
tools/i18n/coverage.py --json the strings and what each language lacks, for scripts
+ tools/i18n/coverage.py --raw literals ImGui shows without tr(): not translatable until wrapped in tr()
The strings are found in src/app/*.cpp, the label paths tr() is used through:
- a literal passed to tr(), trPath() (each "A > B" step) or a wrapper that calls tr() on it (WRAPPERS below:
@@ -41,8 +42,23 @@ EXTRA = {"SliderInt": {4}, "HelpText": {3}}
PATHS = {"trPath": {0}, "HelpText": {3}} # arguments that are "A > B" paths
NOT_FUNCTIONS = {"if", "for", "while", "switch", "catch", "return", "sizeof", "decltype", "alignof", "defined"}
# Struct tables whose fields are shown through tr(): table name -> field indices (a nested {...} field: each literal).
+# Strings tr() gets from a variable the search can't follow: the code that picks them, then the strings.
+DYNAMIC = {
+ "Input.cpp along-normal key": ["With Alt", "With Ctrl"],
+ "Tablet.cpp pressureStatus": ["Pressure: no pen seen yet", "Pressure: on", "Pressure: not detected",
+ "Pressure: touch the tablet to check"],
+ "core/RadialMenu.cpp radialButtonLabel": ["None", "Middle mouse button", "Mouse back button", "Mouse forward button",
+ "Pen lower button", "Pen upper button", "Pen third button",
+ "Right mouse button"],
+}
TABLES = {"kPalettes": [1], "kMenus": [1, 3], "kHints": [1]}
ACTION_FIELDS = ("label", "description", "palette")
+# ImGui calls whose text is shown as it is: a literal handed to one of them never reaches tr() (--raw lists them).
+RAW_IMGUI = {"Button": [0], "SmallButton": [0], "Text": [0], "TextDisabled": [0], "TextWrapped": [0],
+ "TextUnformatted": [0], "TextColored": [1], "SeparatorText": [0], "Selectable": [0], "MenuItem": [0],
+ "BeginMenu": [0], "Checkbox": [0], "CollapsingHeader": [0], "TreeNode": [0], "Combo": [0, 2],
+ "RadioButton": [0], "SetTooltip": [0], "BulletText": [0], "Begin": [0], "BeginTabItem": [0],
+ "SliderFloat": [0, 4], "SliderInt": [0, 4], "InputText": [0]}
ICON = "\x00ICON\x00" # stands for an ICON_LC_* macro inside a label
TOKEN = re.compile(
@@ -321,10 +337,31 @@ def collect():
toks, calls = wrappers(files)
for path in files:
scan_file(path, found, toks[path], calls[path])
+ for where, texts in DYNAMIC.items():
+ for t in texts:
+ found.setdefault(t, set()).add(where)
# Not words: printf formats alone, ids, punctuation, numbers.
return {s: w for s, w in found.items() if words(s)}
+def raw_labels():
+ """(file, line, call, text) for every literal shown through ImGui without tr()."""
+ out = []
+ for path in sorted(SRC.glob("*.cpp")):
+ if path.name in SKIP_FILES:
+ continue
+ toks = tokens(path.read_text(encoding="utf-8"))
+ for i, (k, v, line) in enumerate(toks):
+ if k == "id" and v in RAW_IMGUI and i > 1 and toks[i - 1][1] == "::" and toks[i - 2][1] == "ImGui" \
+ and i + 1 < len(toks) and toks[i + 1][1] == "(":
+ args, _ = split_args(toks, i + 1)
+ for a in RAW_IMGUI[v]:
+ s = literal(args[a]) if a < len(args) else None
+ if s and words(s):
+ out.append((path.name, line, v, s))
+ return out
+
+
def words(s):
core = visible(s)
core = re.sub(r"%[-+ #0]*\d*(?:\.\d+)?[a-zA-Z%]", "", core)
@@ -383,8 +420,15 @@ def main():
ap.add_argument("--lang", choices=list(LANGS), help="only this language")
ap.add_argument("--check", action="store_true", help="exit 1 unless every language is at 100%%")
ap.add_argument("--json", action="store_true")
+ ap.add_argument("--raw", action="store_true", help="list the literals ImGui shows without tr() (not translatable yet)")
args = ap.parse_args()
+ if args.raw:
+ raw = raw_labels()
+ for f, line, call, s in raw:
+ print(f"{f}:{line}: ImGui::{call} {s.replace(ICON, '<icon>')!r}")
+ print(f"{len(raw)} labels shown without tr()")
+ return 0
strings = collect()
keep = load_keep()
stale = sorted(k for k in keep if not any(visible(s) == k or s == k for s in strings))