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.

Traditional Chinese interface (#114, yoyomaimai): zh-TW table, Noto Sans CJK TC subset, tests

islandmed2d45f3de2e78
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c017153e..19396893 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -322,8 +322,8 @@ target_link_libraries(sculptforge-cli PRIVATE sculptforge_core sculptforge_ai sc
# library both link, so an edit to one of these files compiles once, not once per program.
if(SCULPTFORGE_BUILD_APP OR SCULPTFORGE_BUILD_TESTS)
add_library(sculptforge_appshared STATIC src/app/AssetLibrary.cpp src/app/BrushPreview.cpp src/app/UiLayout.cpp
- src/app/ShellGeometry.cpp src/app/LookSchemes.cpp src/app/I18n.cpp src/app/I18nSpanish.cpp src/render/Camera.cpp
- src/render/Clusters.cpp src/render/Ghost.cpp)
+ src/app/ShellGeometry.cpp src/app/LookSchemes.cpp src/app/I18n.cpp src/app/I18nSpanish.cpp
+ src/app/I18nTraditionalChinese.cpp src/render/Camera.cpp src/render/Clusters.cpp src/render/Ghost.cpp)
target_link_libraries(sculptforge_appshared PUBLIC sculptforge_core)
if(MSVC)
target_compile_options(sculptforge_appshared PRIVATE /W4 /utf-8 /permissive-)
@@ -352,6 +352,7 @@ if(SCULPTFORGE_BUILD_APP)
fontLucide ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/lucide.ttf
fontMono ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/JetBrainsMono-Regular.ttf # the looks (Preferences > Interface > Look)
fontMonoBold ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/JetBrainsMono-SemiBold.ttf
+ fontCjk ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/NotoSansTC-UI.otf # Traditional Chinese (tools/i18n/subset_cjk_font.py)
appIcon ${CMAKE_CURRENT_SOURCE_DIR}/assets/branding/sculptforge-256.png
supporters ${CMAKE_CURRENT_SOURCE_DIR}/docs/supporters.txt # Help > About (never empty: it starts with comments)
foundingMembers ${CMAKE_CURRENT_SOURCE_DIR}/website/founding.json) # Help > About and the membership card
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 0d6cd4ad..bb9b1201 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -20,6 +20,7 @@ licenses require.
| [GoB](https://github.com/JoseConseco/GoB) | format reference only, nothing vendored | GNU GPL 3 | The Bridge file layout that the Bridge and Bridge file import/export read and write (src/io/BridgeProtocol.h, integrations/bridge-plugin/PROTOCOL.md) follows this open-source Blender add-on, credited with thanks. No code from it is included. |
| [Inter typeface](https://github.com/rsms/inter) | 4.1 | SIL Open Font License 1.1 | User interface font, embedded in the desktop app. Vendored in assets/fonts. |
| [JetBrains Mono](https://github.com/JetBrains/JetBrainsMono) | 2.304 | SIL Open Font License 1.1 | The monospace font of the interface looks (Preferences > Interface > Look): labels, numbers and status bar. Regular and SemiBold, embedded in the desktop app. Vendored in assets/fonts. |
+| [Noto Sans CJK TC](https://github.com/notofonts/noto-cjk) | 2.004 | SIL Open Font License 1.1 | The Chinese glyphs of the Traditional Chinese interface: a subset with only the characters the translation uses (tools/i18n/subset_cjk_font.py), embedded in the desktop app. Vendored in assets/fonts (NotoSansTC-UI.otf, license NotoSansCJK-OFL.txt). |
| Colour schemes of the Forge Terminal look: [Tokyo Night](https://github.com/enkia/tokyo-night-vscode-theme), [Catppuccin](https://github.com/catppuccin/catppuccin) (Mocha), [Gruvbox](https://github.com/morhetz/gruvbox) (dark), [Nord](https://github.com/nordtheme/nord), [Rosé Pine](https://github.com/rose-pine/rose-pine-theme), [Kanagawa](https://github.com/rebelot/kanagawa.nvim), [Everforest](https://github.com/sainnhe/everforest) (dark) | colour values only | MIT License (each) | The published colour values of each scheme, as data in src/app/LookSchemes.cpp. No code from these projects is included. Credited with thanks below. |
| [Poly Haven](https://polyhaven.com) HDRIs: Brown Photostudio 02, Studio Small 09 (Sergej Majboroda), Kloofendal 48d Partly Cloudy (Pure Sky) (Greg Zaal, sky edits by Jarod Guest) | 1K files, downsampled to 512 x 256 | CC0 1.0 (public domain) | Image-based lighting of the PBR viewport (Material > Viewport Shading). Vendored in assets/hdri and embedded. |
| [MakeHuman](https://github.com/makehumancommunity/makehuman) base mesh hm08 | commit a8bc2d5 (base.obj, SHA-256 8e761e66...) | CC0 1.0 (public domain) | The human starter meshes (head, bust, full body, hand, foot, ear, stylised head, torso), cut and reshaped by tools/starter/build_starter_meshes.py into assets/starter (embedded). Only the CC0 mesh asset is used, no MakeHuman code (AGPL). See docs/starter-meshes.md. |
@@ -321,6 +322,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
+## Noto Sans CJK TC
+
+https://github.com/notofonts/noto-cjk — SIL Open Font License 1.1. assets/fonts/NotoSansTC-UI.otf is a subset (a
+Modified Version under the license) holding only the characters the Traditional Chinese interface uses; the full
+license text is in assets/fonts/NotoSansCJK-OFL.txt.
+
+```
+Copyright © 2014-2021 Adobe (http://www.adobe.com/).
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+```
+
## Inter typeface
https://github.com/rsms/inter — SIL Open Font License 1.1
diff --git a/assets/fonts/NotoSansCJK-OFL.txt b/assets/fonts/NotoSansCJK-OFL.txt
new file mode 100644
index 00000000..7a855b15
--- /dev/null
+++ b/assets/fonts/NotoSansCJK-OFL.txt
@@ -0,0 +1,95 @@
+Noto Sans CJK TC, cut down to the characters SculptForge uses (tools/i18n/subset_cjk_font.py).
+Copyright © 2014-2021 Adobe (http://www.adobe.com/). Noto is a trademark of Google LLC.
+
+This Font Software is licensed under the SIL Open Font License,
+Version 1.1.
+
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font
+creation efforts of academic and linguistic communities, and to
+provide a free and open framework in which fonts may be shared and
+improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply to
+any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to,
+deleting, or substituting -- in part or in whole -- any of the
+components of the Original Version, by changing formats or by porting
+the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed,
+modify, redistribute, and sell modified and unmodified copies of the
+Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in
+Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the
+corresponding Copyright Holder. This restriction only applies to the
+primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created using
+the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/assets/fonts/NotoSansTC-UI.otf b/assets/fonts/NotoSansTC-UI.otf
new file mode 100644
index 00000000..a566d749
Binary files /dev/null and b/assets/fonts/NotoSansTC-UI.otf differ
diff --git a/changes/feat-zh-hant.md b/changes/feat-zh-hant.md
new file mode 100644
index 00000000..1b880489
--- /dev/null
+++ b/changes/feat-zh-hant.md
@@ -0,0 +1,14 @@
+---
+whats_new: **Traditional Chinese**: **Preferences > Interface > Language > 繁體中文** puts the menus, palettes,
+ shelves and messages in Traditional Chinese (thanks yoyomaimai). Brush and tool names stay in English.
+added: **Traditional Chinese interface** (#114, translation by yoyomaimai): Preferences > Interface > Language >
+ 繁體中文 (saved as `zh-TW`). About 740 labels, Taiwan usage, brush and tool names kept in English; anything not
+ translated yet stays in English. The Chinese glyphs come from a small embedded subset of Noto Sans CJK TC
+ (SIL OFL), loaded only while the interface is in Chinese.
+testers:
+ - Any OS: Preferences > Interface > Language > 繁體中文: the palette bar, Preferences and Tool > Geometry read in
+ Chinese with no "?" boxes, at 100% and 200% UI scale and in a non-Classic look. Back to English: all English.
+ - Any OS: restart with Chinese chosen: it starts in Chinese.
+---
+Reviewed every string of the contributed table: 35 stale entries dropped (old labels), 3 printf-order fixes,
+term consistency (部件, 資源庫, 工具列, 工具匣), ~60 hand fixes in the last groups. Product names kept English.
diff --git a/docs/guide/interface.md b/docs/guide/interface.md
index 443a2428..527e9674 100644
--- a/docs/guide/interface.md
+++ b/docs/guide/interface.md
@@ -522,7 +522,7 @@ Layout keeps it.
| Setting | Default | What it does |
|---|---|---|
| **Look**, **Outlines** and **Layout** | Forge Terminal, Neutral, Subtle, SculptForge | See [Looks and layouts](#looks-and-layouts) |
-| **Language** | English | The interface language: **English** or **Español** (see below) |
+| **Language** | English | The interface language: **English**, **Español** or **繁體中文** (Traditional Chinese; see below) |
| **Ctrl+hover help** | On | Ctrl-hover help boxes |
| **Help box opacity** | 0.97 | How solid the help box is |
| **Tooltip delay** | 0.5 s | How long to point at an icon-only button before its name appears |
@@ -538,7 +538,8 @@ Layout keeps it.
**Español** the menus, the palettes, the shelves, the Library, the command palette and the Ctrl-help titles
are in Spanish, while the names of tools and brushes stay in English, as Spanish-speaking sculptors use them (Parts,
Quad Remesh, Forge Spheres, Library, Lit Sphere, Clay Block, Add). The command palette finds a command by its Spanish or its
-English name. Anything not translated yet (most Ctrl-help descriptions, this guide) shows in English. Scripts and
+English name. **繁體中文** (Traditional Chinese, contributed by yoyomaimai) works the same way, with Taiwan usage
+and the brush and tool names in English. Anything not translated yet (most Ctrl-help descriptions, this guide) shows in English. Scripts and
`sculptforge-cli` commands are the same in every language.
**UI scale** also applies at once: text, buttons, shelves and trays resize on the next frame; saved automatically.
diff --git a/src/app/App.cpp b/src/app/App.cpp
index fc031144..fca3ff7a 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -7,6 +7,7 @@
#include "app/SpaceCamera.h"
#include "app/UiScale.h"
#include "app/AirStroke.h"
+#include "app/I18n.h"
#include "app/AsyncStroke.h"
#include "app/Calibration.h"
#include "app/CrashLog.h"
@@ -65,6 +66,8 @@ extern const unsigned char fontMono[];
extern const unsigned long long fontMono_size;
extern const unsigned char fontMonoBold[];
extern const unsigned long long fontMonoBold_size;
+extern const unsigned char fontCjk[];
+extern const unsigned long long fontCjk_size;
extern const unsigned char appIcon[];
extern const unsigned long long appIcon_size;
} // namespace assets
@@ -1195,7 +1198,7 @@ float App::targetUiScale() const {
void App::applyUiScale() {
uiScaleDirty_ = false;
const float scale = targetUiScale();
- if (!uiScaleChanged(uiScale_, scale)) return;
+ if (!uiScaleChanged(uiScale_, scale) && fontsCjk_ == languageNeedsCjkFont(language())) return;
SDL_Log("UI scale %.0f%%", double(scale * 100.0f));
uiScale_ = scale;
ImGui::GetIO().Fonts->Clear();
@@ -1209,9 +1212,25 @@ void App::requestUiScale() {
redrawIn(0.0);
}
+// Noto Sans CJK TC (SIL OFL), cut down to the Traditional Chinese table's characters (tools/i18n/subset_cjk_font.py),
+// merged into the font added just before. In another language only the language's own name (繁體中文, the Preferences
+// button) is merged, so the atlas stays Latin-sized.
+void App::mergeCjkFont(float px) {
+ // CJK punctuation, full-width forms and the unified ideographs; the subset has only what the table uses.
+ static const ImWchar kCjkRanges[] = {0x2000, 0x206F, 0x3000, 0x30FF, 0x4E00, 0x9FFF, 0xFF00, 0xFFEF, 0};
+ static const ImWchar kNameRanges[] = {0x4E2D, 0x4E2D, 0x6587, 0x6587, 0x7E41, 0x7E41, 0x9AD4, 0x9AD4, 0}; // 中文繁體
+ ImFontConfig cjk;
+ cjk.MergeMode = true;
+ cjk.FontDataOwnedByAtlas = false;
+ cjk.OversampleH = 1; // dense glyphs: oversampling only grows the atlas
+ ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontCjk), int(assets::fontCjk_size), px,
+ &cjk, fontsCjk_ ? kCjkRanges : kNameRanges);
+}
+
// Every font the UI uses, rasterised at `scale` for crisp text (Dear ImGui 1.91 has no dynamic font sizes).
void App::buildUiFonts(float scale) {
ImGuiIO& io = ImGui::GetIO();
+ fontsCjk_ = languageNeedsCjkFont(language());
const bool recording = !options_.recordPath.empty() || !options_.uiTest.empty();
// Inter (SIL OFL), embedded in the binary. Rasterised at the final size for crisp text.
ImFontConfig fontConfig;
@@ -1230,6 +1249,7 @@ void App::buildUiFonts(float scale) {
icons.GlyphOffset = ImVec2(0, 2.0f * scale);
io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontLucide), int(assets::fontLucide_size),
15.0f * scale, &icons, kIconRanges);
+ mergeCjkFont(15.0f * scale);
}
// Shell fonts: 12 px captions and 10 px right-shelf labels (with icons), large shelf icons, SemiBold titles.
{
@@ -1243,12 +1263,14 @@ void App::buildUiFonts(float scale) {
icons.GlyphOffset = ImVec2(0, size * 0.13f * scale);
io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontLucide), int(assets::fontLucide_size),
size * scale, &icons, kIconRanges);
+ mergeCjkFont(size * scale);
};
fontSmall_ = io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontRegular),
int(assets::fontRegular_size), 12.0f * scale, &fontConfig);
addIcons(12.0f);
fontTiny_ = io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontRegular),
int(assets::fontRegular_size), 10.5f * scale, &fontConfig);
+ mergeCjkFont(10.5f * scale);
fontBold_ = io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontSemiBold),
int(assets::fontSemiBold_size), 15.0f * scale, &fontConfig);
addIcons(15.0f);
@@ -1272,6 +1294,7 @@ void App::buildUiFonts(float scale) {
icons.GlyphOffset = ImVec2(0, px * 0.13f * scale);
io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontLucide), int(assets::fontLucide_size), px * scale,
&icons, kIconRanges);
+ mergeCjkFont(px * scale);
return f;
};
fontMono_ = addMono(assets::fontMono, assets::fontMono_size, 15.0f);
diff --git a/src/app/App.h b/src/app/App.h
index 01277bcc..689ce40b 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -244,6 +244,8 @@ private:
float targetUiScale() const; // what uiScale_ should be now (Preferences, the display; Config.cpp)
void applyUiScale(); // rebuild fonts and style live when it changed (between frames)
void buildUiFonts(float scale);
+ void mergeCjkFont(float px); // the Chinese glyphs into the font just added (all of them while fontsCjk_)
+ bool fontsCjk_ = false; // the atlas has every Chinese glyph (Traditional Chinese interface)
ImFont* fontCaption_ = nullptr;
ImFont* fontCaptionSub_ = nullptr;
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index 908f63f4..9f36e54f 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -355,6 +355,7 @@ void App::addHelpFonts(float scale) {
icons.GlyphOffset = ImVec2(0, 2.0f * scale);
io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(assets::fontLucide), int(assets::fontLucide_size), 15.0f * scale,
&icons, kIconRanges);
+ mergeCjkFont(15.0f * scale);
// ProggyClean (ships inside Dear ImGui) is a pixel font: keep it at whole multiples of 13 px.
ImFontConfig mono;
mono.SizePixels = 13.0f * std::max(1.0f, std::floor(scale + 0.25f));
@@ -1001,7 +1002,7 @@ bool App::readUiConfig(const std::string& path, std::string& err, bool own) {
layout_.customize = customize;
actions_.overridesFromJson(j["shortcuts"]);
if (j.has("radialMenus")) applyRadialMenusJson(j["radialMenus"]); // (an older file keeps the menus there are)
- setLanguage(languageFromCode(uiPrefs_.language));
+ setLanguage(languageFromCode(uiPrefs_.language)); // (the requestUiScale above adds the Chinese glyphs if needed)
applyPerformancePrefs();
applyInputStyle();
doc_.sculptor.dyntopo.constantDetail = uiPrefs_.dyntopoConstantDetail;
@@ -1452,6 +1453,7 @@ void drawInterfaceSection(App& app) {
if (ImGui::RadioButton(label.c_str(), languageFromCode(p.language) == lang)) {
p.language = languageCode(lang);
setLanguage(lang);
+ app.requestUiScale(); // the fonts again, with or without the Chinese glyphs
}
ui::HelpText("Language", nullptr,
"The language of menus, palettes, shelves and messages. Brush and tool names (Quad Remesh, Forge Spheres, "
diff --git a/src/app/Config.h b/src/app/Config.h
index 56cbb335..11ff65d0 100644
--- a/src/app/Config.h
+++ b/src/app/Config.h
@@ -32,7 +32,7 @@ struct UiPrefs {
bool libraryAtStartup = true;
std::string libraryFolder; // "" = Documents/SculptForge
bool alphabeticalPalettes = false; // strict A-Z palette bar (default: File, Edit first)
- std::string language = "en"; // Preferences > Interface: the interface language, "en" or "es" (app/I18n.h, #44)
+ std::string language = "en"; // Preferences > Interface: the interface language, "en", "es" or "zh-TW" (app/I18n.h)
int cameraNotch = 0; // keep the UI out of a laptop's camera notch: 0 automatic, 1 always, 2 never
bool turntable = false; // rotation: false = free, about the screen axes; true = turntable (Y up)
int inputStyle = 1; // Preferences > Input: 0 classic, 1 SculptForge (the default for new installs:
diff --git a/src/app/I18n.cpp b/src/app/I18n.cpp
index 18446230..02eccd3e 100644
--- a/src/app/I18n.cpp
+++ b/src/app/I18n.cpp
@@ -25,13 +25,20 @@ struct TransparentHash {
size_t operator()(std::string_view s) const noexcept { return std::hash<std::string_view>{}(s); }
};
-const std::unordered_map<std::string_view, const char*>& spanishMap() {
- static const std::unordered_map<std::string_view, const char*> map = [] {
- std::unordered_map<std::string_view, const char*> m;
- for (const i18n::Entry& e : i18n::spanishTable()) m.emplace(e.english, e.translated);
- return m;
- }();
- return map;
+using Table = std::unordered_map<std::string_view, const char*>;
+Table makeMap(std::span<const i18n::Entry> entries) {
+ Table m;
+ for (const i18n::Entry& e : entries) m.emplace(e.english, e.translated);
+ return m;
+}
+const Table* tableMap(Language language) {
+ static const Table spanish = makeMap(i18n::spanishTable());
+ static const Table chinese = makeMap(i18n::traditionalChineseTable());
+ switch (language) {
+ case Language::Spanish: return &spanish;
+ case Language::TraditionalChinese: return &chinese;
+ default: return nullptr;
+ }
}
// Labels put together from a translation (or found to have none), per language, kept for the life of the program
@@ -101,22 +108,50 @@ void setLanguage(Language language) { g_language.store(int(language)); }
Language language() { return Language(g_language.load()); }
-const char* languageCode(Language language) { return language == Language::Spanish ? "es" : "en"; }
+const char* languageCode(Language language) {
+ switch (language) {
+ case Language::Spanish: return "es";
+ case Language::TraditionalChinese: return "zh-TW";
+ default: return "en";
+ }
+}
Language languageFromCode(std::string_view code) {
- if (code == "es" || code.substr(0, 3) == "es-" || code.substr(0, 3) == "es_") return Language::Spanish;
+ auto is = [&](std::string_view c) { return code == c || (code.size() > c.size() && code.substr(0, c.size()) == c &&
+ (code[c.size()] == '-' || code[c.size()] == '_')); };
+ if (is("es")) return Language::Spanish;
+ // Traditional script: zh-TW, zh-HK, zh-MO and zh-Hant-*. Simplified (zh, zh-CN, zh-Hans) has no table yet: English.
+ if (is("zh-TW") || is("zh_TW") || is("zh-HK") || is("zh_HK") || is("zh-MO") || is("zh_MO") || is("zh-Hant") ||
+ is("zh_Hant"))
+ return Language::TraditionalChinese;
return Language::English;
}
-const char* languageName(Language language) { return language == Language::Spanish ? "Español" : "English"; }
+const char* languageName(Language language) {
+ switch (language) {
+ case Language::Spanish: return "Español";
+ case Language::TraditionalChinese: return "繁體中文";
+ default: return "English";
+ }
+}
+
+bool languageNeedsCjkFont(Language language) { return language == Language::TraditionalChinese; }
namespace i18n {
+std::span<const Entry> table(Language language) {
+ switch (language) {
+ case Language::Spanish: return spanishTable();
+ case Language::TraditionalChinese: return traditionalChineseTable();
+ default: return {};
+ }
+}
+
const char* lookup(Language language, std::string_view english) {
- if (language != Language::Spanish) return nullptr;
- const auto& map = spanishMap();
- const auto it = map.find(english);
- return it == map.end() ? nullptr : it->second;
+ const Table* map = tableMap(language);
+ if (!map) return nullptr;
+ const auto it = map->find(english);
+ return it == map->end() ? nullptr : it->second;
}
} // namespace i18n
diff --git a/src/app/I18n.h b/src/app/I18n.h
index 1950c817..63f9f249 100644
--- a/src/app/I18n.h
+++ b/src/app/I18n.h
@@ -1,10 +1,11 @@
// SculptForge - open source digital sculpting
// SPDX-License-Identifier: GPL-3.0-or-later
//
-// The interface language (#44): English, the default, and Spanish. A small,
-// dependency-free layer: the English text is the key, the translations are a
-// table compiled into the binary (I18nSpanish.cpp), and anything without an
-// entry stays in English, so a missing line never breaks a label.
+// The interface language (#44): English, the default, Spanish and Traditional
+// Chinese (#114). A small, dependency-free layer: the English text is the key, the
+// translations are tables compiled into the binary (I18nSpanish.cpp,
+// I18nTraditionalChinese.cpp), and anything without an entry stays in English, so
+// a missing line never breaks a label.
//
// ImGui::Button(tr("Decimate")) "Diezmar" in Spanish
// ImGui::Checkbox(tr("Keep Masked##remesh")) only "Keep Masked" is translated; "##remesh" is kept as it is
@@ -23,15 +24,17 @@
namespace sf {
-enum class Language { English, Spanish };
-inline constexpr int kLanguageCount = 2;
+enum class Language { English, Spanish, TraditionalChinese };
+inline constexpr int kLanguageCount = 3;
// The language tr() translates into (process-wide; Preferences > Interface sets it).
void setLanguage(Language language);
Language language();
-const char* languageCode(Language language); // "en", "es" (ui.json)
+const char* languageCode(Language language); // "en", "es", "zh-TW" (ui.json)
Language languageFromCode(std::string_view code); // unknown codes are English
-const char* languageName(Language language); // in that language: "English", "Español"
+const char* languageName(Language language); // in that language: "English", "Español", "繁體中文"
+// True for a language whose text needs the CJK font merged into the UI fonts (App::buildUiFonts).
+bool languageNeedsCjkFont(Language language);
// The text in the current language. The pointer is the argument itself (English, or no translation), a table
// entry, or a string kept for the life of the program: safe to keep across frames.
@@ -47,8 +50,10 @@ struct Entry {
const char* english;
const char* translated;
};
-// The compiled-in Spanish table (I18nSpanish.cpp), for tests.
+// The compiled-in tables (I18nSpanish.cpp, I18nTraditionalChinese.cpp), for tests.
std::span<const Entry> spanishTable();
+std::span<const Entry> traditionalChineseTable();
+std::span<const Entry> table(Language language); // empty for English
// The exact entry for `english` in that language's table, or nullptr (English has no table).
const char* lookup(Language language, std::string_view english);
} // namespace i18n
diff --git a/src/app/I18nTraditionalChinese.cpp b/src/app/I18nTraditionalChinese.cpp
new file mode 100644
index 00000000..2289e0c9
--- /dev/null
+++ b/src/app/I18nTraditionalChinese.cpp
@@ -0,0 +1,831 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// The Traditional Chinese interface (GitHub #114), translated by yoyomaimai and reviewed for SculptForge. The English
+// text is the key (I18n.h); a label without an entry stays in English.
+//
+// Conventions (Taiwan usage):
+// - Names of tools, brushes and products stay in English: Quad Remesh, Forge Spheres, Lit Sphere, Splats, Clay Block
+// and every other brush, VDM, Alpha. Generic words are translated: 部件 (Part), 資源庫 (Library), 頂點繪製
+// (Vertex Paint), 面群組 (Face Groups), 工具列 (shelf), 工具匣 (tray).
+// - A space between Chinese and Latin text or numbers (新增 VDM 平面), full-width punctuation (,。:()) except
+// right after a printf conversion or a literal %, where ASCII punctuation keeps the conversions the same.
+// - printf conversions (%d, %.1f, %s, %%) stay in the same order: tests check every entry.
+// - Every character has to be in assets/fonts/NotoSansTC-UI.otf: after changing this table, run
+// tools/i18n/subset_cjk_font.py (a test lists what is missing).
+// The entries follow the Spanish table's order and groups, one entry per English text.
+#include "app/I18n.h"
+
+#include <iterator>
+
+namespace sf::i18n {
+
+namespace {
+
+constexpr Entry kTraditionalChinese[] = {
+ // --- Palettes (the palette bar) and their sub-palettes ---
+ {"Alpha", "Alpha"},
+ {"Brush", "筆刷"},
+ {"Color", "色彩"},
+ {"Draw", "繪製"},
+ {"Edit", "編輯"},
+ {"File", "檔案"},
+ {"Generate", "產生"},
+ {"Help", "說明"},
+ {"Material", "材質"},
+ {"Preferences", "偏好設定"},
+ {"Render", "算繪"},
+ {"Script", "指令碼"},
+ {"Splats", "Splats"},
+ {"Stroke", "筆畫"},
+ {"Tool", "工具"},
+ {"Transform", "變形"},
+ // The SculptForge layout's task menus and their sections (Palettes.cpp taskMenus), Preferences > Interface > Look.
+ {"Mesh", "網格"},
+ {"View", "檢視"},
+ {"Draw & Tablet", "繪製與繪圖板"},
+ {"Symmetry & Gizmo", "對稱與操控器"},
+ {"Vertex Paint & Color", "頂點繪製與色彩"},
+ {"Parts & Geometry", "部件與幾何"},
+ {"Materials", "材質"},
+ {"Gaussian Splats", "高斯 Splat"},
+ {"Look", "外觀"},
+ {"Colours:", "色彩:"},
+ {"Match my desktop theme", "配合我的桌面佈景主題"},
+ {"Uses your Omarchy theme's colours when Omarchy is installed", "安裝 Omarchy 後,使用您的 Omarchy 主題顏色"},
+ {"Green", "綠色"},
+ {"Amber", "琥珀色"},
+ {"Scanlines & glow", "掃描線與光暈"},
+ {"AI brush provider", "AI 筆刷提供者"},
+ {"Autosave", "自動儲存"},
+ {"Bake", "烘焙"},
+ {"Config", "設定"},
+ {"Deformation", "變形"},
+ {"Display", "顯示"},
+ {"Export", "匯出"},
+ {"Facial Shapes", "臉部形狀"},
+ {"Geometry", "幾何"},
+ {"Hotkeys", "快速鍵"},
+ {"Input", "輸入"},
+ {"Interface", "界面"},
+ {"Kelvinlet & Capture", "彈性形變與擷取"},
+ {"Layers", "圖層"},
+ {"Library", "資源庫"},
+ {"Masking", "遮罩"},
+ {"Paint Layers", "繪製圖層"},
+ {"Performance", "效能"},
+ {"Face Groups", "面群組"},
+ {"Remesh", "重新網格化"},
+ {"Part", "部件"},
+ {"Parts", "部件"},
+ {"Tablet", "繪圖板"},
+ {"Texture Map", "貼圖"},
+ {"Updates", "更新"},
+ {"Vector Displacement", "向量位移"},
+ {"Visibility", "可見性"},
+ {"Forge Spheres", "Forge Spheres"},
+ {"Edit recipe", "編輯配方"},
+ // --- Palette paths in the Ctrl-help box ("Tool > Geometry") ---
+ {"Bottom shelf", "底部工具列"},
+ {"Left shelf", "左側工具列"},
+ {"Right shelf", "右側工具列"},
+ {"Top shelf", "頂部工具列"},
+ {"Title", "標題"},
+ {"Layout", "版面配置"},
+ {"Dynamic topology", "動態拓樸"},
+ {"Camera", "相機"},
+ {"Import / Export", "匯入/匯出"},
+ {"From an image", "從影像建立"},
+ {"Voxel Remesh", "體素重新網格化"},
+ {"Modify Topology", "修改拓樸"},
+ {"Game Ready", "適用於遊戲"},
+ {"Navigation", "導覽"},
+ // --- Title bar, status line, search ---
+ {"Untitled", "未命名"},
+ {"Project", "專案"},
+ {"Search", "搜尋"},
+ {"Minimize", "最小化"},
+ {"Menus", "選單"},
+ {"Snapshots", "快照"},
+ {"Save Snapshot", "儲存快照"},
+ {"Base", "基底"},
+ {" Splats ", " Splats "},
+ {"Verts %s Tris %s Part %s (%d/%d) Layer %s%s%s", "頂點 %s 三角面 %s 部件 %s (%d/%d) 圖層 %s%s%s"},
+ {"Customize: Ctrl+Alt+drag to move or remove items", "自訂:按住 Ctrl+Alt 並拖曳,即可移動或移除項目"},
+ {"Customize off", "自訂已關閉"},
+ {"Saved", "已儲存"},
+ {"Background: Flat Colour", "背景:純色"},
+ {"Background: Gradient", "背景:漸層"},
+ // --- Command palette ---
+ {"Search commands, brushes and settings", "搜尋命令、筆刷和設定"},
+ {"Recently used", "最近使用"},
+ {" No matching commands", " 找不到相符的命令"},
+ {" result", " 個結果"},
+ {" results", " 個結果"},
+ {"select", "選取"},
+ {"run", "執行"},
+ {"edit in console", "在主控台中編輯"},
+ {"close", "關閉"},
+ // --- Ctrl-help box ---
+ {"No description yet.", "目前沒有說明。"},
+ {"Not available right now.", "目前無法使用。"},
+ {"Learn more: %s", "深入瞭解:%s"},
+ {"Back to the palette bar", "返回調色盤列"},
+ {"Move to the tray", "移至工具匣"},
+ {"Take this palette out of the tray.", "將此調色盤從工具匣中取出。"},
+ {"Keep this palette in the right tray (Shift+click: left tray), or drag the icon onto a tray.",
+ "將此調色盤留在右側工具匣(Shift+按一下可移至左側工具匣),或將圖示拖曳至工具匣。"},
+ {"Click to open or close. Opening one closes the others (Shift+click keeps them open; Preferences > Interface).",
+ "按一下即可開啟或關閉。開啟其中一個會關閉其他項目(Shift+按一下可讓它們保持開啟;偏好設定 > 界面)。"},
+ {"Click to save the project. * means it has unsaved changes.", "按一下即可儲存專案。* 表示有尚未儲存的變更。"},
+ {"Find any command, brush or material by name and run it.", "依名稱搜尋任何命令、筆刷或材質,並執行。"},
+ {"Minimize the SculptForge window.", "最小化 SculptForge 視窗。"},
+ {"Left tray", "左側工具匣"},
+ {"Right tray", "右側工具匣"},
+ {"Shortcut for", "快速鍵:"},
+ // --- Shelves ---
+ {"Add a brush", "新增筆刷"},
+ {"Put another brush (built-in or one of yours) on this shelf.", "將其他筆刷(內建筆刷或自訂筆刷)加入此工具列。"},
+ {"One of your custom brushes.", "你的其中一個自訂筆刷。"},
+ {"Remove from shelf", "從工具列移除"},
+ {"Tile size", "圖示大小"},
+ {"Small", "小"},
+ {"Medium", "中"},
+ {"Large", "大"},
+ {"The active brush. Click for the brush picker; the bottom shelf holds favourites.", "目前使用的筆刷。按一下可開啟筆刷選擇器;底部工具列可放置我的最愛。"},
+ {"How dabs follow the cursor: Dots, Drag Stamp, Slide Stamp, Spray or Lazy Stroke. Click to choose.",
+ "筆觸印記跟隨游標的方式:點狀、拖曳印章、滑動印章、噴灑或延遲筆畫。按一下即可選擇。"},
+ {"The VDM brush's vector displacement map. Click to pick another.", "VDM 筆刷的向量位移貼圖。按一下可選擇其他貼圖。"},
+ {"The brush's stamp shape (white = full effect). Click for the alpha picker.", "筆刷的印章形狀(白色代表完整效果)。按一下可開啟 Alpha 選擇器。"},
+ {"How the model is shaded in the view. Click for the material picker.", "模型在視圖中的著色方式。按一下可開啟材質選擇器。"},
+ {"Brush radius in screen pixels. [ and ] change it by 10%; Ctrl+click to type.",
+ "以螢幕像素為單位的筆刷半徑。[ 和 ] 可調整 10%; 按住 Ctrl 並按一下即可輸入數值。"},
+ {"Brush radius in screen pixels. [ and ] change it by 10%.", "以螢幕像素為單位的筆刷半徑。[ 和 ] 可調整 10%."},
+ {"ActiveTris / TotalTris", "作用中三角面數/三角面總數"},
+ {"Move", "移動"},
+ {"Zoom", "縮放"},
+ {"Rotate", "旋轉"},
+ {"Scale", "比例"},
+ // --- Draw and the top shelf ---
+ {"Intensity", "強度"},
+ {"Smooth Intensity", "平滑強度"},
+ {"Focal Length", "焦距"},
+ {"Detail", "細節"},
+ {"Sculpt", "雕刻"},
+ {"Paint", "繪製"},
+ {"Dynamic", "動態"},
+ {"Constant detail", "固定細節"},
+ {"Axes", "座標軸"},
+ {"No pen detected", "未偵測到筆"},
+ {"Pen pressure", "筆壓"},
+ {"Pressure > Size", "筆壓 > 大小"},
+ {"Pressure > Strength", "筆壓 > 強度"},
+ {"Front faces only", "僅限正面"},
+ {"Ctrl+Shift+drag a Cut shape", "按住 Ctrl+Shift 並拖曳以建立切割形狀"},
+ {"Depth %.2f", "深度 %.2f"},
+ {"Copy the active Part (%s)", "複製目前的部件 (%s)"},
+ {"How deep Cut In goes, or how far Cut Add stands out, as a share of the Part's size.",
+ "Cut In 的切入深度,或 Cut Add 的凸出距離,以部件大小的比例表示。"},
+ {"Invert (Alt)", "反轉 (Alt)"},
+ {"Invert", "反轉"},
+ {"Smooth keeps volume", "平滑時保留體積"},
+ {"Smooth face group borders only", "僅平滑面群組邊界"},
+ {"Symmetry", "對稱"},
+ {"Symmetry X", "X 軸對稱"},
+ {"Local", "區域"},
+ {"X axis", "X 軸"},
+ {"Y axis", "Y 軸"},
+ {"Z axis", "Z 軸"},
+ {"Timeline position", "時間軸位置"},
+ {"Top of viewport", "視埠頂端"},
+ {"How strongly painting colours the surface (1-100); Ctrl+click to type.", "繪製為表面著色的強度(1-100);按住 Ctrl 並按一下即可輸入數值。"},
+ {"This Part has subdivision levels, so strokes don't remesh it: delete the lower (or higher) levels first.",
+ "此部件具有細分層級,因此筆畫不會對其重新網格化:請先刪除較低(或較高)的層級。"},
+ // --- Edit, File, Help ---
+ {"Undo", "復原"},
+ {"Redo", "重做"},
+ {"Paste brush", "貼上筆刷"},
+ {"New Sphere", "新增球體"},
+ {"New Plane", "新增平面"},
+ {"New Forge Sphere", "新增 Forge Sphere"},
+ {"Open", "開啟"},
+ {"Open Recent", "開啟最近使用的檔案"},
+ {"Save", "儲存"},
+ {"Save As", "另存新檔"},
+ {"Import", "匯入"},
+ {"Export OBJ", "匯出 OBJ"},
+ {"Export STL", "匯出 STL"},
+ {"Export GLB", "匯出 GLB"},
+ {"Export LOD Chain", "匯出 LOD 鏈"},
+ {"Export USD / USDZ", "匯出 USD / USDZ"},
+ {"Export FBX for Unreal", "匯出供 Unreal 使用的 FBX"},
+ {"Export EXR", "匯出 EXR"},
+ {"Export Maps", "匯出貼圖"},
+ {"Export Texture", "匯出紋理"},
+ {"Export Displacement", "匯出位移貼圖"},
+ {"Export timelapse", "匯出縮時影片"},
+ {"Send to Unreal", "傳送至 Unreal"},
+ {"Send to Blender", "傳送至 Blender"},
+ {"Receive from Blender", "從 Blender 接收"},
+ {"Save Splats", "儲存 Splats"},
+ {"Capture from phone", "從手機擷取"},
+ {"Quit", "結束"},
+ {"Controls", "操作方式"},
+ {"User Guide", "使用指南"},
+ {"What's New", "最新消息"},
+ {"Check for updates", "檢查更新"},
+ {"Command palette", "命令面板"},
+ {"Website & documentation", "網站與說明文件"},
+ {"Join the Discord", "加入 Discord"},
+ {"Join the community on Discord", "加入 Discord 社群"},
+ {"Report a problem", "回報問題"},
+ {"Open log folder", "開啟記錄檔資料夾"},
+ {"Fixes & suggestions", "修正與建議"},
+ {"Benchmark (proof mode)", "效能基準測試(證明模式)"},
+ {"Support SculptForge", "支持 SculptForge"},
+ {"About SculptForge", "關於 SculptForge"},
+ {"Welcome", "歡迎"},
+ // --- Generate ---
+ {"Generate 3D", "生成 3D 模型"},
+ {"Choose image", "選擇圖片"},
+ {"Change image", "更換圖片"},
+ {"Relief", "浮雕"},
+ {"Inflate", "膨脹"},
+ {"Stamp", "壓印"},
+ {"AI Brush", "AI 筆刷"},
+ {"Image or text to a sculptable 3D model: Hugging Face (free), fal.ai, Meshy, your ComfyUI server, your own command, or an offline blockout.",
+ "將圖片或文字轉換成可雕刻的 3D 模型:Hugging Face(免費)、fal.ai、Meshy、你的 ComfyUI 伺服器、自訂命令,或離線建立粗模。"},
+ // --- Render, Display, Material ---
+ {"Wireframe", "線框"},
+ {"Show Mesh", "顯示網格"},
+ {"Show Vertex Paint", "顯示頂點繪製"},
+ {"Show Mask", "顯示遮罩"},
+ {"Show Face Groups", "顯示面群組"},
+ {"Show Splats", "顯示 Splats"},
+ {"Show mesh", "顯示網格"},
+ {"Show mask", "顯示遮罩"},
+ {"Show face groups", "顯示面群組"},
+ {"Show vertex paint", "顯示頂點繪製"},
+ {"Colour tints the material", "顏色會為材質染色"},
+ {"Show texture", "顯示紋理"},
+ {"Show UVs", "顯示 UV"},
+ {"Mask", "遮罩"},
+ {"Groups", "群組"},
+ {"Material colour", "材質顏色"},
+ {"Colour of the Studio material (the clay colour).", "Studio 材質的顏色(黏土色)。"},
+ {"Frame model", "將模型置中顯示"},
+ {"Frame Part", "將部件置中顯示"},
+ {"Fullscreen", "全螢幕"},
+ {"Gradient", "漸層"},
+ {"Flat Colour", "純色"},
+ {"Background colour", "背景顏色"},
+ {"Flat", "平面"},
+ {"Load Lit Sphere", "載入 Lit Sphere"},
+ {"Material picker", "材質選擇器"},
+ {"Material swatches", "材質色票"},
+ // --- Script ---
+ {"Console", "主控台"},
+ {"Run script file", "執行指令碼檔案"},
+ {"Copy session as script", "將工作階段複製為指令碼"},
+ {"Clear console", "清除主控台"},
+ {"Close the console", "關閉主控台"},
+ {"Every action is a script command: run them with --script \"subdivide; remesh resolution=200\" or the sculptforge-cli tool.",
+ "每個操作都是一條指令碼命令:使用 --script \"subdivide; remesh resolution=200\" 或 sculptforge-cli 工具來執行。"},
+ // --- Stroke ---
+ {"Continuous", "連續"},
+ {"Stroke picker", "筆畫選擇器"},
+ {"Lazy radius", "延遲半徑"},
+ // --- Tool: header, Parts ---
+ {"tris", "tris"},
+ {"Append", "附加"},
+ {"Append as Part", "附加為部件"},
+ {"Add a new Part beside the model", "在模型旁新增部件"},
+ {"Insert on the model", "插入模型"},
+ {"Duplicate", "複製"},
+ {"Rename", "重新命名"},
+ {"Delete", "刪除"},
+ {"Move up", "上移"},
+ {"Move down", "下移"},
+ {"Move up the list", "在清單中上移"},
+ {"Move down the list", "在清單中下移"},
+ {"Merge down", "向下合併"},
+ {"Merge the active Part with the one below it", "將作用中的部件與下方部件合併"},
+ {"Merge visible", "合併可見項目"},
+ {"Split parts", "分離部件"},
+ {"Split groups", "分離群組"},
+ {"One Part per disconnected piece", "每個不相連的部分各自建立一個部件"},
+ {"One Part per face group", "每個面群組各自建立一個部件"},
+ {"Alt+click a Part to select it", "按住 Alt 並點選部件即可選取"},
+ {"All Parts", "所有部件"},
+ {"Solo", "單獨顯示"},
+ {"Sphere", "球體"},
+ {"Cube", "立方體"},
+ {"Plane", "平面"},
+ {"From file", "從檔案"},
+ {"Active Part's copy", "作用中部件的副本"},
+ {"Not enough GPU memory to show every Part: hide some or step down a subdivision level.",
+ "GPU 記憶體不足,無法顯示所有部件:請隱藏部分部件或降低一級細分。"},
+ {"%s\n%zu vertices, %zu triangles%s%s\nClick to select, double-click to rename", "%s\n%zu 個頂點,%zu 個三角形%s%s\n點選以選取,連按兩下以重新命名"},
+ {"Extract", "擷取"},
+ {"Accept", "接受"},
+ {"Double", "雙倍"},
+ {"Thick", "厚度"},
+ {"Dist", "距離"},
+ // --- Geometry ---
+ {"Divide", "細分"},
+ {"Subdivide", "細分"},
+ {"Reconstruct Subdiv", "重建細分"},
+ {"Divide to Micro", "細分至微細分"},
+ {"Delete Micro", "刪除微細分"},
+ {"Bake Micro", "烘焙微細分"},
+ {"Micro Surface Noise", "微細分表面雜訊"},
+ {"Micro", "微細分"},
+ {"SDiv", "細分級"},
+ {"No subdivision levels - Divide adds them", "沒有細分級別——使用「細分」新增級別"},
+ {"Decimate", "減面"},
+ {"Keep", "保留"},
+ {"Keep Masked", "保留遮罩"},
+ {"Keep Groups", "保留群組"},
+ {"Keep Original", "保留原始模型"},
+ {"Keep Texture", "保留紋理"},
+ {"Reduce the triangle count while keeping the shape. Sculpt layers are kept.", "在保留形狀的同時減少三角形數量,並保留雕刻圖層。"},
+ {"Fraction of the triangles Decimate keeps.", "減面後保留的三角形比例。"},
+ {"Mirror", "鏡像"},
+ {"Mirror And Weld", "鏡像並焊接"},
+ {"Close Gaps", "封閉間隙"},
+ {"Fill holes", "填補孔洞"},
+ {"Delete hidden", "刪除隱藏部分"},
+ // --- Quad Remesh and Remesh ---
+ {"Quad Remesh", "四邊形重拓樸"},
+ {"Quad Remesh Guides", "四邊形重拓樸引導線"},
+ {"Target Polygons", "目標多邊形數量"},
+ {"Adaptive Size", "自適應尺寸"},
+ {"Curves Strength", "曲線強度"},
+ {"Guides", "引導線"},
+ {"Use Vertex Paint", "使用頂點繪製"},
+ {"Detect Edges", "偵測邊緣"},
+ {"Half", "一半"},
+ {"Same", "相同"},
+ {"Quality Report", "品質報告"},
+ {"no curves", "沒有曲線"},
+ {"%zu curves (%zu loops)", "%zu 條曲線(%zu 個迴圈)"},
+ {"%zu polygons", "%zu 個多邊形"},
+ {"%s: %zu quads in %.1f s", "%s:%zu 個四邊形,耗時 %.1f 秒"},
+ {"%zu piece(s) used the legacy method", "%zu 個部分使用了舊版方法"},
+ {"Corners off square: %.1f deg mean, %.0f deg worst 1%%", "角落偏離直角:平均 %.1f°,最差 %.0f°(最差的 1%%)"},
+ {"Poles: %zu (3 edges %zu, 5 edges %zu, other %zu)", "極點:%zu(3 條邊 %zu,5 條邊 %zu,其他 %zu)"},
+ {"Distance to the sculpt: %.3f%% mean, %.2f%% max", "與雕刻表面的距離:平均 %.3f%%,最大 %.2f%%"},
+ {"Resolution", "解析度"},
+ {"Remeshing", "正在重拓樸"},
+ {"Cancel", "取消"},
+ {"Stop the remesh; the Part stays as it is.", "停止重拓樸;部件將維持目前狀態。"},
+ {"Voxels across the model: higher keeps more detail and makes more triangles.", "模型寬度方向的體素數量:數值越高,保留的細節越多,產生的三角形也越多。"},
+ {"Remesh for sculpting", "重拓樸以利雕刻"},
+ // --- Masking ---
+ {"Clear", "清除"},
+ {"All", "全部"},
+ {"Blur", "模糊"},
+ {"Sharpen", "銳化"},
+ {"Grow", "擴張"},
+ {"Shrink", "縮減"},
+ {"By cavity", "依凹陷處"},
+ {"By face group", "依面群組"},
+ {"Passes", "次數"},
+ {"Mask Strength", "遮罩強度"},
+ {"Threshold", "閾值"},
+ {"Clear Mask", "清除遮罩"},
+ {"Invert Mask", "反轉遮罩"},
+ {"Mask All", "全部加上遮罩"},
+ {"Mask brush", "遮罩筆刷"},
+ {"Unmask everything (Mask Pen: Ctrl + drag background)", "取消所有遮罩(遮罩筆:按住 Ctrl 並拖曳背景)"},
+ {"Ctrl + click background", "Ctrl + 點選背景"},
+ {"Mask creases and folds (replaces the mask; uses the mask strength)", "遮罩皺褶與折痕(取代目前的遮罩;使用遮罩強度設定)"},
+ {"Mask one face group (replaces the mask)", "遮罩單一面群組(取代目前的遮罩)"},
+ // --- Face Groups and Visibility ---
+ {"By normals", "依法線"},
+ {"By pieces", "依部件"},
+ {"From mask", "從遮罩建立"},
+ {"Clear groups", "清除群組"},
+ {"Angle", "角度"},
+ {"Group by UVs", "依 UV 分組"},
+ {"Masked triangles become a new group", "將遮罩中的三角形建立為新群組"},
+ {"New group wherever the surface turns more than the angle", "在表面轉折角度大於指定角度處建立新群組"},
+ {"One group per disconnected piece", "每個不相連的部件各自建立一個群組"},
+ {"Visible face groups", "可見的面群組"},
+ {"Hide face group under cursor", "隱藏游標下方的面群組"},
+ {"Isolate face group under cursor", "隔離游標下方的面群組"},
+ {"Show all", "全部顯示"},
+ {"Unhide all", "全部取消隱藏"},
+ {"Invert visible", "反轉可見狀態"},
+ {"Hide", "隱藏"},
+ {"Show", "顯示"},
+ {"Ctrl+Shift+click a group to isolate it, +Alt to hide it, on the background to show all.\nCtrl+Shift+drag hides outside the rectangle or lasso (Alt: inside).",
+ "Ctrl+Shift+按一下群組可將其隔離;加按 Alt 可將其隱藏;在背景按一下則顯示全部。\nCtrl+Shift+拖曳可隱藏矩形或套索範圍外的內容(加按 Alt 則隱藏範圍內的內容)。"},
+ // --- Layers, paint, texture ---
+ {"New paint layer", "新增繪製圖層"},
+ {"Delete layer", "刪除圖層"},
+ {"Opacity", "不透明度"},
+ {"Blend mode", "混合模式"},
+ {"Texture", "貼圖"},
+ {"New Texture", "新增貼圖"},
+ {"Import Texture", "匯入貼圖"},
+ {"Delete Texture", "刪除貼圖"},
+ {"Vertex Paint > Texture", "頂點繪製 > 貼圖"},
+ {"Texture > Vertex Paint", "貼圖 > 頂點繪製"},
+ {"Texture size", "貼圖尺寸"},
+ {"Auto UV", "自動 UV"},
+ {"Pick colour", "取樣顏色"},
+ {"Switch Color", "交換顏色"},
+ {"Main colour", "主要顏色"},
+ {"Second colour", "次要顏色"},
+ // --- Transform and the gizmo ---
+ {"Gizmo", "操縱器"},
+ {"Front view", "前視圖"},
+ {"Back view", "後視圖"},
+ {"Left view", "左視圖"},
+ {"Right view", "右視圖"},
+ {"Top view", "頂視圖"},
+ {"Bottom view", "底視圖"},
+ {"Opposite side", "相反側"},
+ {"Orbit left", "向左環繞"},
+ {"Orbit right", "向右環繞"},
+ {"Orbit up", "向上環繞"},
+ {"Orbit down", "向下環繞"},
+ {"Zoom in", "放大"},
+ {"Zoom out", "縮小"},
+ {"Orthographic", "正交"},
+ {"Larger brush", "放大筆刷"},
+ {"Smaller brush", "縮小筆刷"},
+ {"Pivot", "樞紐點"},
+ // --- Preferences > Config ---
+ // --- Preferences > Interface ---
+ {"Language", "語言"},
+ {"Tooltip delay", "工具提示延遲"},
+ {"One sub-palette open", "一次只開啟一個子調色盤"},
+ {"Reduce motion", "減少動態效果"},
+ {"Auto collapse left tray", "自動收合左側工具匣"},
+ {"Auto collapse right tray", "自動收合右側工具匣"},
+ {"Palettes strictly A-Z", "調色盤嚴格依 A 至 Z 排列"},
+ {"Left-handed layout", "左手操作版面"},
+ {"Shelf tiles", "工具列圖示大小"},
+ {"UI scale", "界面縮放比例"},
+ {"Automatic", "自動"},
+ {"Rotation", "旋轉"},
+ {"Turntable", "轉盤"},
+ {"Camera notch", "相機瀏海區"},
+ {"Always reserve", "一律保留空間"},
+ {"Off", "關閉"},
+ {"Hold Ctrl and point at any control to see what it does and its shortcut. Ctrl+Alt shows a command's scripting parameters.",
+ "按住 Ctrl,將游標移至任何控制項上,即可查看其功能和快速鍵。按 Ctrl+Alt 可查看命令的指令碼參數。"},
+ {"How long to point at an icon-only button (or a clipped label) before its name appears.",
+ "游標停留在僅含圖示的按鈕(或遭截斷的標籤)上多久後,才會顯示其名稱。"},
+ {"Opening a sub-palette closes the others in that palette. Shift+click opens more than one.",
+ "開啟子調色盤時,會關閉同一調色盤中的其他子調色盤。按住 Shift 並按一下,可同時開啟多個。"},
+ {"Opening a palette in the left tray collapses the others when they would not fit.", "在左側工具匣開啟調色盤時,若空間不足,其他調色盤會自動收合。"},
+ {"Opening a palette in the right tray collapses the others when they would not fit.", "在右側工具匣開啟調色盤時,若空間不足,其他調色盤會自動收合。"},
+ {"Mirror the shelves and trays: tools on the left, navigation on the right.", "鏡像排列工具列和工具匣:左側放工具,右側放導覽控制項。"},
+ {"How big the brush tiles on the bottom shelf are. Small leaves the most room for the model.",
+ "設定底部工具列上筆刷圖示的大小。選擇小型可為模型保留最多空間。"},
+ // --- Preferences > Input ---
+ {"Style", "操作風格"},
+ {"Blender", "Blender"},
+ {"Maya", "Maya"},
+ {"SculptForge", "SculptForge"},
+ {"Emulate Numpad", "模擬數字鍵盤"},
+ {"Right click opens the Quick Menu", "按滑鼠右鍵開啟快速選單"},
+ {"Hold Space and drag to move the camera", "按住空白鍵並拖曳以移動相機"},
+ {"Start strokes off the model", "在模型外開始筆畫"},
+ {"Strokes start off the model", "筆畫從模型外開始"},
+ {"Toggle strokes off the model", "切換在模型外開始筆畫"},
+ {"Cursor follows surface", "游標沿著表面移動"},
+ {"Hide ring while stroking", "繪製時隱藏圓環"},
+ {"Outlines", "輪廓線"},
+ {"Don't show again", "不再顯示"},
+ {"Hints", "提示"},
+ {"Show hints in the viewport", "在視埠中顯示提示"},
+ {"Show all hints again", "重新顯示所有提示"},
+ {"Previewing an LOD", "正在預覽 LOD"},
+ {"Face landmark steps", "臉部特徵點步驟"},
+ {"Subtle", "細微"},
+ {"Outline opacity", "輪廓線不透明度"},
+ {"Viewport cursor", "視埠游標"},
+ {"Crosshair", "十字線"},
+ {"Arrow", "箭頭"},
+ {"Import Blender keymap", "匯入 Blender 快速鍵配置"},
+ {"Quick Menu", "快速選單"},
+ // --- Preferences > Hotkeys ---
+ {"Filter", "篩選"},
+ {"press a key", "按下任意按鍵"},
+ {"Default shortcuts", "預設快速鍵"},
+ // --- Preferences > Display, Library, Tablet, Performance, Updates, Autosave ---
+ {"Show at startup", "啟動時顯示"},
+ {"Show Library at startup", "啟動時顯示資源庫"},
+ {"Placement", "位置"},
+ {"Top", "上方"},
+ {"Bottom", "下方"},
+ {"Rows", "列數"},
+ {"Library folder", "資源庫資料夾"},
+ {"Use the default folder", "使用預設資料夾"},
+ {"Mouse & pen", "滑鼠與筆"},
+ {"Mouse mode (relative)", "滑鼠模式(相對)"},
+ {"Mouse mode", "滑鼠模式"},
+ {"Pressure curve", "壓力曲線"},
+ {"Pressure test", "壓力測試"},
+ {"Pressure meter", "壓力計"},
+ {"Tablet defaults", "繪圖板預設值"},
+ {"Tilt X %+.0f\xc2\xb0 Y %+.0f\xc2\xb0", "傾斜 X %+.0f\xc2\xb0 Y %+.0f\xc2\xb0"},
+ {"Min", "最小值"},
+ {"Max", "最大值"},
+ {"Minimum", "最小值"},
+ {"Maximum", "最大值"},
+ {"Full at", "達到滿值"},
+ {"Full pressure at", "達到最大壓力"},
+ {"Curve", "曲線"},
+ {"Pen", "筆"},
+ {"Keyboard", "鍵盤"},
+ {"Bring the pen close to the tablet. Pressure works through the system's tablet driver.", "將筆靠近繪圖板。壓力感應由系統的繪圖板驅動程式提供。"},
+ {"Bring the pen close to the tablet. Wacom: turn on \"Use Windows Ink\" in Wacom Tablet Properties > Mapping; Huion / XP-Pen: enable Windows Ink in the driver.",
+ "將筆靠近繪圖板。Wacom:在 Wacom Tablet Properties > Mapping 中啟用 \"Use Windows Ink\";Huion / XP-Pen:在驅動程式中啟用 Windows Ink。"},
+ {"SpaceMouse (experimental)", "SpaceMouse(實驗性功能)"},
+ {"Use SpaceMouse", "使用 SpaceMouse"},
+ {"SpaceMouse speed", "SpaceMouse 速度"},
+ {"SpaceMouse defaults", "SpaceMouse 預設值"},
+ {"Speed", "速度"},
+ {"Dead zone", "死區"},
+ {"Dominant axis", "主要軸"},
+ {"Lock rotation to turntable", "將旋轉鎖定為轉盤模式"},
+ {"Plug it in. If 3DxWare is installed it may keep the device to itself: see the Navigation page of the guide.",
+ "請接上裝置。如果已安裝 3DxWare,它可能會獨占此裝置;請參閱指南中的「導覽」頁面。"},
+ {"Push the cap: if the bars below stay still, another program (3DxWare, spacenavd) holds the SpaceMouse. See the Navigation page of the guide.",
+ "推動控制帽:如果下方的指示條沒有反應,表示 SpaceMouse 正被其他程式(3DxWare、spacenavd)占用。請參閱指南中的「導覽」頁面。"},
+ {"No joysticks or game controllers seen.", "找不到搖桿或遊戲控制器。"},
+ {"Plug it in. SculptForge reads it as a joystick (/dev/input): you need read access to it, and spacenavd may hold it. See the Navigation page of the guide.",
+ "請接上裝置。SculptForge 會將它辨識為搖桿(/dev/input):你需要有讀取權限,而且它可能正被 spacenavd 占用。請參閱指南中的「導覽」頁面。"},
+ {"Antialiasing", "抗鋸齒"},
+ {"Anti-aliasing", "抗鋸齒"},
+ {"Fast Navigation", "快速導覽"},
+ {"Multithreading", "多執行緒"},
+ {"Predictive Strokes", "預測筆畫"},
+ {"Draft Strokes", "草稿筆畫"},
+ {"%d threads", "%d 個執行緒"},
+ {"Memory", "記憶體"},
+ {"Hardware profile", "硬體設定檔"},
+ {"Frame Governor", "影格速率調節器"},
+ {"Re-calibrate", "重新校準"},
+ {"Keep vertical sync on (frame rate capped at the display's)", "保持垂直同步(影格速率上限為螢幕更新率)"},
+ {"Every %d min", "每 %d 分鐘"},
+ {"Autosave off", "自動儲存已關閉"},
+ {"Save a recovery copy this often (0 = off). Restored after a crash.", "依此間隔儲存復原副本(0 = 關閉)。當程式當機後可還原。"},
+ // --- Library ---
+ {"Image", "影像"},
+ {"Recent", "最近使用"},
+ {"Nothing here yet.", "目前沒有內容。"},
+ {"Nothing here yet. Projects you save (Ctrl+S) into the User folder show up here.", "目前沒有內容。儲存(Ctrl+S)至 User 資料夾的專案會顯示在這裡。"},
+ {"Nothing here yet. Save Snapshot keeps timestamped copies of your scene here.", "目前沒有內容。使用「儲存快照」後,場景的時間戳記副本會保存在這裡。"},
+ {"Nothing here yet. Files you open show up here.", "目前沒有內容。開啟的檔案會顯示在這裡。"},
+ {"Nothing here yet. Put reference images in the User folder.", "目前沒有內容。請將參考影像放入 User 資料夾。"},
+ {"Nothing here yet. Put Gaussian splat captures (.ply, .splat) in the User folder.",
+ "目前沒有內容。請將 Gaussian splat 擷取檔(.ply、.splat)放入 User 資料夾。"},
+ {"Back", "上一頁"},
+ {"Forward", "下一頁"},
+ {"Open folder", "開啟資料夾"},
+ {"Close Library", "關閉資源庫"},
+ {"Relief from image", "從影像建立浮雕"},
+ {"Inflate image", "膨脹影像"},
+ {"Project onto model", "投影至模型"},
+ {"Use as alpha", "用作 Alpha"},
+ {"Use as Alpha", "用作 Alpha"},
+ {"Use as VDM", "用作 VDM"},
+ {"Show in file manager", "在檔案管理員中顯示"},
+ {"Refresh thumbnail", "重新整理縮圖"},
+ {"Nothing here matches \"%s\".", "找不到符合「%s」的項目。"},
+ {"Library rows", "資源庫列數"},
+ {"Library at the top", "資源庫置於上方"},
+ {"Library at the bottom", "資源庫置於下方"},
+ {"Show the items whose names contain this text.", "只顯示名稱包含這段文字的項目。"},
+ {"Show only the items whose names contain this text.", "只顯示名稱包含這段文字的項目。"},
+ {"The previous tab or folder.", "返回上一個分頁或資料夾。"},
+ {"Forward again after going back.", "返回後再次前進。"},
+ {"Hide the Library (comma toggles it).", "隱藏資源庫(按逗號鍵切換顯示)。"},
+ {"How many rows of thumbnails the Library shows (1-4).", "設定資源庫中縮圖的列數(1-4)。"},
+ {"Your projects (.sfproj) and recently opened projects.", "你的專案(.sfproj)及最近開啟的專案。"},
+ {"Models to start from or append as Parts: primitives and model files.", "可作為起始模型或新增為部件的模型:基本幾何體與模型檔案。"},
+ {"Every brush: built-in, custom and .sfbrush files in your library.", "所有筆刷:內建筆刷、自訂筆刷,以及資源庫中的 .sfbrush 檔案。"},
+ {"Brush alphas: built-in stamps and images in your Alphas folder.", "筆刷 Alpha:內建印章及 Alphas 資料夾中的影像。"},
+ {"Viewport materials: Studio and the Lit Spheres.", "視埠材質:Studio 和 Lit Spheres。"},
+ {"Reference images: generate 3D, relief, inflate, project onto the model or use as an alpha.",
+ "參考影像:生成 3D 模型、建立浮雕、膨脹影像、投影至模型,或用作 Alpha。"},
+ {"Gaussian splat captures (.ply, .splat) to sculpt against.", "用於對照雕刻的 Gaussian splat 擷取檔(.ply、.splat)。"},
+ {"Snapshots and the autosave, newest first.", "快照與自動儲存檔,最新的排在最前面。"},
+ {"Recently opened files of every kind.", "最近開啟的各類檔案。"},
+ {"Add a folder of your own to the Library (shown at the root of every tab).", "將自己的資料夾新增至資源庫(會顯示在每個分頁的根目錄)。"},
+ {"Browse projects, models, brushes, alphas, materials, images and splats. Double-click to load; Shift+double-click a model to append it as a Part; drag sideways to scrub.",
+ "瀏覽專案、模型、筆刷、Alpha、材質、影像和 splat。按兩下即可載入;對模型按 Shift+兩下可將其新增為部件;左右拖曳即可快速瀏覽。"},
+ // --- Pickers and brushes ---
+ {"Brush picker", "筆刷選取器"},
+ {"Alpha picker", "Alpha 選取器"},
+ {"Community brushes", "社群筆刷"},
+ {"Save to Library", "儲存至資源庫"},
+ {"Strength", "強度"},
+ {"Falloff", "衰減"},
+ {"Name", "名稱"},
+ // --- Common words and buttons ---
+ {"Apply", "套用"},
+ {"Reset", "重設"},
+ {"Preview", "預覽"},
+ {"Finish", "完成"},
+ {"Close", "關閉"},
+ {"OK", "確定"},
+ {"Yes", "是"},
+ {"No", "否"},
+ {"Lock", "鎖定"},
+ {"Live", "即時"},
+ {"Mean", "平均值"},
+ {"Source", "來源"},
+ {"Method", "方法"},
+ {"Weight", "權重"},
+ {"Review", "審閱"},
+ {"Network", "網路"},
+ {"Contents", "內容"},
+ {"Video", "影片"},
+ {"Surface", "表面"},
+ {"World", "世界"},
+ {"Vertex", "頂點"},
+ {"Front", "前方"},
+ {"Rear", "後方"},
+ {"Sharpness", "銳利度"},
+ {"Padding", "內距"},
+ {"Map size", "貼圖大小"},
+ {"Map Size", "貼圖大小"},
+ {"Output folder", "輸出資料夾"},
+ {"Output Folder", "輸出資料夾"},
+ {"Open in browser", "在瀏覽器中開啟"},
+ {"Open Folder", "開啟資料夾"},
+ // --- Project: unsaved changes, recovery, updates ---
+ {"Clear Recent", "清除最近使用項目"},
+ {"Autosave (min)", "自動儲存(分鐘)"},
+ {"Save changes to %s before continuing?", "繼續之前要將變更儲存至 %s 嗎?"},
+ {"Your changes will be lost if you don't save them.", "如果不儲存,變更將會遺失。"},
+ {"Don't Save", "不要儲存"},
+ {"SculptForge did not close normally last time.", "SculptForge 上次未正常關閉。"},
+ {"Restore the autosaved work?", "要還原自動儲存的工作內容嗎?"},
+ {"What happened is in sculptforge-previous.log (Help > Open log folder);", "詳細記錄請見 sculptforge-previous.log(說明 > 開啟記錄資料夾);"},
+ {"please attach it if you report the problem.", "回報問題時請附上此檔案。"},
+ {"Restore", "還原"},
+ {"Discard", "捨棄"},
+ {"SculptForge %s is available", "SculptForge %s 已推出"},
+ {"(you have %s)", "(你目前使用的是 %s)"},
+ {"What's new", "版本新功能"},
+ {"Download", "下載"},
+ {"Later", "稍後"},
+ {"Skip this version", "略過此版本"},
+ {"Checking", "正在檢查"},
+ {"This build gets its updates from your package manager.", "此版本的更新由你的套件管理員提供。"},
+ // --- Sculpt Timeline ---
+ {"Sculpt Timeline", "雕刻時間軸"},
+ {"Step %zu of %zu", "第 %zu 步,共 %zu 步"},
+ {"Step %d: %s", "第 %d 步:%s"},
+ {"Save with project", "與專案一併儲存"},
+ {"Start of the history", "歷史記錄起點"},
+ {"Show the model here", "在此顯示模型"},
+ {"Sculpting from an earlier step starts a branch;\nthe later steps stay as a lane above.",
+ "從較早的步驟開始雕刻會建立分支;\n後續步驟則會保留在上方的時間軸軌道中。"},
+ {"The history of the active Part (%zu steps up to the cursor) played as a turntable.", "以轉盤方式播放目前部件的歷史記錄(游標之前共 %zu 步)。"},
+ {"Length", "長度"},
+ {"Rendering timelapse", "正在算繪縮時影片"},
+ // --- Color, Vertex Paint, paint layers ---
+ {"Fill", "填滿"},
+ {"Fill layer", "填滿圖層"},
+ {"Fill masked", "填滿遮罩區域"},
+ {"Fill the unmasked area (the whole mesh if nothing is masked)", "填滿未遮罩區域(若沒有任何遮罩,則填滿整個網格)"},
+ {"Cavity", "凹陷"},
+ {"Darken creases and cavities (respects the mask)", "加深皺褶與凹陷(遵循遮罩)"},
+ {"Background", "背景"},
+ {"Shading", "著色"},
+ {"Scene", "場景"},
+ {"Colour", "色彩"},
+ {"Base colour", "基礎色彩"},
+ {"Paint brush (P)", "繪製筆刷 (P)"},
+ {"Paint into", "繪製到"},
+ {"Paint layer", "繪製圖層"},
+ {"Painting on: %s", "正在繪製於:%s"},
+ {"Painting on: texture, %s", "正在繪製於:紋理,%s"},
+ {"Layer channel", "圖層通道"},
+ {"Channel view", "通道檢視"},
+ {"RGB while sculpting", "雕刻時使用 RGB"},
+ {"Min Opacity", "最低不透明度"},
+ {"+ Add", "+ 新增"},
+ {"Group %d", "群組 %d"},
+ {"Group", "群組"},
+ {"(Ctrl paints, Ctrl+Alt erases)", "(Ctrl 繪製,Ctrl+Alt 擦除)"},
+ {"(Ctrl masks, Ctrl+Alt unmasks)", "(Ctrl 遮罩,Ctrl+Alt 取消遮罩)"},
+ // --- More actions (shelves, Quick Menu, palettes) ---
+ {"Shelves", "工具列"},
+ {"Frame", "置中顯示"},
+ {"Intensity at cursor", "游標處的強度"},
+ {"Falloff at cursor", "游標處的衰減"},
+ {"Last stroke", "最後一筆"},
+ {"To Surface", "到表面"},
+ {"Crop Box", "裁切框"},
+ {"Make Mesh", "建立網格"},
+ {"Delete Last", "刪除最後一個"},
+ {"Make sculptable", "轉為可雕刻"},
+ {"Sculpt to Splats", "雕刻轉為 Splats"},
+ {"Preview Normal Map", "預覽法線貼圖"},
+ {"AA Off", "關閉抗鋸齒"},
+ {"AA 2x", "抗鋸齒 2x"},
+ {"AA 4x", "抗鋸齒 4x"},
+ {"AA 8x", "抗鋸齒 8x"},
+ {"Pan X", "X 軸平移"},
+ {"Pan Y", "Y 軸平移"},
+ {"Roll", "翻滾"},
+ {"Tilt", "傾斜"},
+ {"Spin", "旋轉"},
+ // --- Extract, Project, Deformation ---
+ {"E Smt", "E Smt"},
+ {"Parts too", "連同其他部件"},
+ {"This Part", "此部件"},
+ {"Move along normals", "沿法線移動"},
+ {"Mirror left and right", "左右鏡像"},
+ {"Flip X", "翻轉 X 軸"},
+ {"Flip Y", "翻轉 Y 軸"},
+ {"Flip Z", "翻轉 Z 軸"},
+ {"Swap Y/Z", "交換 Y/Z 軸"},
+ {"Squash", "壓縮"},
+ {"Fit plane", "擬合平面"},
+ {"Edge Fade", "邊緣淡化"},
+ {"Base Smoothing", "基礎平滑"},
+ {"All pieces", "所有部分"},
+ {"Face loops", "面環"},
+ {"Low-poly", "低多邊形"},
+ {"Base mesh", "基礎網格"},
+ // --- Bake ---
+ {"Baking", "烘焙"},
+ {"AO rays", "AO 光線"},
+ {"AO reach", "AO 範圍"},
+ {"Auto distance", "自動距離"},
+ {"Max Frontal Distance", "最大正面距離"},
+ {"Max Rear Distance", "最大背面距離"},
+ {"Normal map convention", "法線貼圖慣例"},
+ {"Export preset", "匯出預設集"},
+ {"EXR displacement", "EXR 位移貼圖"},
+ {"UV view", "UV 檢視"},
+ // --- Facial shapes, Make sculptable, phone, splats ---
+ {"Generate Facial Shapes", "生成臉部形狀"},
+ {"Record face take", "錄製臉部表演"},
+ {"Play Take", "播放錄製"},
+ {"Load Take", "載入錄製"},
+ {"Bake Take", "烘焙錄製"},
+ {"Clear Baked Take", "清除已烘焙的錄製"},
+ {"Cancel Bake", "取消烘焙"},
+ {"Take", "錄製"},
+ {"Live axes", "即時坐標軸"},
+ {"Landmarks", "特徵點"},
+ {"Place Landmarks", "放置特徵點"},
+ {"Auto Landmarks", "自動放置特徵點"},
+ {"Clear Landmarks", "清除特徵點"},
+ {"Place by hand", "手動放置"},
+ {"Good enough - stop", "夠好了 - 停止"},
+ {"Try a test head", "試用測試頭部"},
+ {"Face test", "臉部測試"},
+ {"From scan", "從掃描"},
+ {"Keep scan", "保留掃描"},
+ {"Generate from a photo at once", "立即從照片生成"},
+ {"Capture from view", "從檢視擷取"},
+ {"Pairing code", "配對碼"},
+ {"QR code", "QR 碼"},
+ {"Unreal is on another computer", "Unreal 在另一台電腦上"},
+ {"Receive automatically", "自動接收"},
+ {"Update after each stroke", "每次筆觸後更新"},
+ {"Record a video of the run (needs ffmpeg)", "錄製執行過程影片(需要 ffmpeg)"},
+ {"Choose Brush", "選擇 Brush"},
+ {"Choose COLMAP", "選擇 COLMAP"},
+ {"Photos Folder", "照片資料夾"},
+ {"Find again", "重新尋找"},
+ // --- VDM, Kelvinlet, brush editing ---
+ {"Create VDM", "建立 VDM"},
+ {"Load VDM", "載入 VDM"},
+ {"New VDM Plane", "新增 VDM 平面"},
+ {"VDM name", "VDM 名稱"},
+ {"Plane Res", "平面解析度"},
+ {"Normal tilt", "法線傾斜"},
+ {"Detail Clone", "細節複製"},
+ {"Clone Spacing", "複製間距"},
+ {"Clone follows stroke", "複製跟隨筆畫"},
+ {"Refine the selected brush", "調整選取的筆刷"},
+ {"Preset amount", "預設數量"},
+ {"preset amount", "預設數量"},
+ {"Reset to 1", "重置為 1"},
+ {"Scatter", "散佈"},
+ {"Loop", "循環"},
+ {"Letter index", "字母索引"},
+ {"Load image", "載入圖片"},
+ {"Invert loaded image", "反轉載入的圖片"},
+ {"Dark is high", "暗部高"},
+};
+
+} // namespace
+
+std::span<const Entry> traditionalChineseTable() { return {kTraditionalChinese, std::size(kTraditionalChinese)}; }
+
+} // namespace sf::i18n
diff --git a/tests/test_i18n.cpp b/tests/test_i18n.cpp
index f1400333..183317ad 100644
--- a/tests/test_i18n.cpp
+++ b/tests/test_i18n.cpp
@@ -2,12 +2,16 @@
// SPDX-License-Identifier: GPL-3.0-or-later
//
// The interface language (#44, app/I18n.h): exact lookups, the English fallback, labels whose "##id" must not
-// change, icon prefixes and printf tails, and a Spanish table that is safe to hand to printf.
+// change, icon prefixes and printf tails, and Spanish and Traditional Chinese tables that are safe to hand to printf
+// and that the UI fonts can draw.
#include "TestHarness.h"
#include "app/I18n.h"
+#include <cstdint>
#include <cstdio>
+#include <fstream>
+#include <iterator>
#include <set>
#include <string>
#include <string_view>
@@ -37,6 +41,59 @@ std::vector<std::string> conversions(std::string_view s) {
return out;
}
+// The code points of a UTF-8 string.
+std::vector<unsigned> codepoints(std::string_view s) {
+ std::vector<unsigned> out;
+ for (size_t i = 0; i < s.size();) {
+ const unsigned char c = static_cast<unsigned char>(s[i]);
+ unsigned cp = c;
+ size_t n = 1;
+ if (c >= 0xF0) n = 4, cp = c & 0x07;
+ else if (c >= 0xE0) n = 3, cp = c & 0x0F;
+ else if (c >= 0xC0) n = 2, cp = c & 0x1F;
+ for (size_t k = 1; k < n && i + k < s.size(); ++k) cp = (cp << 6) | (static_cast<unsigned char>(s[i + k]) & 0x3F);
+ out.push_back(cp);
+ i += n;
+ }
+ return out;
+}
+
+// In Inter as the UI rasterises it (Basic Latin + Latin-1) or the Lucide icons (U+E000-U+F8FF).
+bool inLatinFont(unsigned cp) {
+ return cp == '\n' || (cp >= 0x20 && cp <= 0x7E) || (cp >= 0xA0 && cp <= 0xFF) || (cp >= 0xE000 && cp <= 0xF8FF);
+}
+
+// The BMP code points an OpenType font maps to a glyph (its format 4 cmap), read straight from the file.
+std::set<unsigned> fontCodepoints(const std::string& path) {
+ std::ifstream f(path, std::ios::binary);
+ const std::string d((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
+ auto u16 = [&](size_t o) { return o + 2 <= d.size() ? unsigned(uint8_t(d[o])) << 8 | uint8_t(d[o + 1]) : 0u; };
+ auto u32 = [&](size_t o) { return u16(o) << 16 | u16(o + 2); };
+ std::set<unsigned> out;
+ size_t cmap = 0;
+ for (unsigned t = 0, n = u16(4); t < n; ++t)
+ if (d.compare(12 + t * 16, 4, "cmap") == 0) cmap = u32(12 + t * 16 + 8);
+ if (!cmap) return out;
+ for (unsigned t = 0, n = u16(cmap + 2); t < n; ++t) {
+ const size_t sub = cmap + u32(cmap + 4 + t * 8 + 4);
+ if (u16(sub) != 4) continue;
+ const unsigned segs = u16(sub + 6) / 2;
+ const size_t ends = sub + 14, starts = ends + segs * 2 + 2, deltas = starts + segs * 2, offsets = deltas + segs * 2;
+ for (unsigned i = 0; i < segs; ++i) {
+ const unsigned end = u16(ends + i * 2), start = u16(starts + i * 2), delta = u16(deltas + i * 2);
+ const unsigned ro = u16(offsets + i * 2);
+ for (unsigned c = start; c <= end && c != 0xFFFF; ++c) {
+ unsigned glyph = 0;
+ if (ro == 0) glyph = (c + delta) & 0xFFFF;
+ else if (const unsigned g = u16(offsets + i * 2 + ro + (c - start) * 2)) glyph = (g + delta) & 0xFFFF;
+ if (glyph) out.insert(c);
+ }
+ }
+ break;
+ }
+ return out;
+}
+
} // namespace
TEST(i18n_english_returns_the_argument) {
@@ -106,12 +163,22 @@ TEST(i18n_language_codes) {
CHECK(languageFromCode("klingon") == Language::English);
CHECK(languageFromCode("") == Language::English);
CHECK(std::string(languageName(Language::Spanish)) == "Espa\xc3\xb1ol");
+ CHECK(std::string(languageCode(Language::TraditionalChinese)) == "zh-TW");
+ CHECK(languageFromCode("zh-TW") == Language::TraditionalChinese);
+ CHECK(languageFromCode("zh_TW") == Language::TraditionalChinese);
+ CHECK(languageFromCode("zh-HK") == Language::TraditionalChinese);
+ CHECK(languageFromCode("zh-Hant-TW") == Language::TraditionalChinese);
+ CHECK(languageFromCode("zh-CN") == Language::English); // Simplified: no table yet
+ CHECK(languageFromCode("zh") == Language::English);
+ CHECK(languageFromCode("esperanto") == Language::English);
+ CHECK(languageFromCode(languageCode(Language::TraditionalChinese)) == Language::TraditionalChinese);
}
-TEST(i18n_spanish_table_is_well_formed) {
+TEST(i18n_tables_are_well_formed) {
+ for (const Language lang : {Language::Spanish, Language::TraditionalChinese}) {
std::set<std::string_view> seen;
int problems = 0;
- for (const i18n::Entry& e : i18n::spanishTable()) {
+ for (const i18n::Entry& e : i18n::table(lang)) {
const std::string_view en = e.english, es = e.translated;
// One entry per English text, both sides non-empty, no ImGui ids in the table (tr() keeps those).
if (!seen.insert(en).second || en.empty() || es.empty() || en.find("##") != std::string_view::npos ||
@@ -132,29 +199,44 @@ TEST(i18n_spanish_table_is_well_formed) {
}
CHECK(problems == 0);
CHECK(seen.size() > 300);
+ }
}
TEST(i18n_spanish_table_fits_the_font) {
// The UI font is Inter rasterised with ImGui's default ranges, Basic Latin + Latin-1 (U+0020-U+00FF), plus the
// Lucide icons (U+E000-U+F8FF): every character of the table has to be in those, or it draws as "?".
int outside = 0;
- for (const i18n::Entry& e : i18n::spanishTable()) {
- const std::string_view s = e.translated;
- for (size_t i = 0; i < s.size();) {
- const unsigned char c = static_cast<unsigned char>(s[i]);
- unsigned cp = c;
- size_t n = 1;
- if (c >= 0xF0) n = 4, cp = c & 0x07;
- else if (c >= 0xE0) n = 3, cp = c & 0x0F;
- else if (c >= 0xC0) n = 2, cp = c & 0x1F;
- for (size_t k = 1; k < n && i + k < s.size(); ++k) cp = (cp << 6) | (static_cast<unsigned char>(s[i + k]) & 0x3F);
- const bool ok = cp == '\n' || (cp >= 0x20 && cp <= 0x7E) || (cp >= 0xA0 && cp <= 0xFF) || (cp >= 0xE000 && cp <= 0xF8FF);
- if (!ok) {
+ for (const i18n::Entry& e : i18n::spanishTable())
+ for (const unsigned cp : codepoints(e.translated))
+ if (!inLatinFont(cp)) {
std::printf(" U+%04X is not in the UI font: \"%s\"\n", cp, e.translated);
++outside;
}
- i += n;
- }
- }
CHECK(outside == 0);
}
+
+TEST(i18n_chinese_table_fits_the_font) {
+ // Chinese text is Inter, the icons, and assets/fonts/NotoSansTC-UI.otf merged in (App::mergeCjkFont): a subset with
+ // only the characters the table uses. A character it lacks draws as "?": run tools/i18n/subset_cjk_font.py.
+ const std::set<unsigned> cjk = fontCodepoints(std::string(SF_TEST_DATA_DIR) + "/../../assets/fonts/NotoSansTC-UI.otf");
+ CHECK(cjk.size() > 500);
+ std::set<unsigned> missing;
+ for (const i18n::Entry& e : i18n::traditionalChineseTable())
+ for (const unsigned cp : codepoints(e.translated))
+ if (!inLatinFont(cp) && !cjk.count(cp) && missing.insert(cp).second)
+ std::printf(" U+%04X is not in NotoSansTC-UI.otf: \"%s\"\n", cp, e.translated);
+ // The Preferences button shows the language's own name in every language (App::mergeCjkFont's kNameRanges).
+ for (const unsigned cp : codepoints(languageName(Language::TraditionalChinese)))
+ if (!cjk.count(cp)) missing.insert(cp);
+ CHECK(missing.empty());
+}
+
+TEST(i18n_chinese_lookup_keeps_ids_and_brush_names) {
+ LanguageScope scope(Language::TraditionalChinese);
+ CHECK(std::string(tr("Preferences##palette.preferences")) == "\u504f\u597d\u8a2d\u5b9a##palette.preferences");
+ CHECK(std::string(tr("Open...##file.open")) == "\u958b\u555f...##file.open");
+ CHECK(std::string(tr("Frobnicate")) == "Frobnicate"); // no entry: English
+ const std::string move = "Move";
+ CHECK(std::string(trAction("brush.move", move)) == "Move");
+ CHECK(trPath("Tool > Geometry") == "\u5de5\u5177 > \u5e7e\u4f55");
+}
diff --git a/tests/ui/language.sfui b/tests/ui/language.sfui
index 4af2a018..3d9f8421 100644
--- a/tests/ui/language.sfui
+++ b/tests/ui/language.sfui
@@ -68,3 +68,27 @@ key escape
expect "Geometry##tool.geometry"
expect "Draw##tool.draw"
expect_text "Size"
+
+# Traditional Chinese (#114): the UI fonts are built again with the Chinese glyphs (the shots show no "?" boxes);
+# the "##" ids stay, so the same clicks work, and brush names stay in English.
+click "Preferences##palette.preferences"
+click "Interface##preferences.interface"
+click "繁體中文##language.zh-TW"
+expect_text "語言"
+expect "偏好設定##palette.preferences"
+expect "界面##preferences.interface"
+shot zh_preferences
+key escape
+expect "檔案##palette.file"
+expect "工具##palette.tool"
+expect "繪製##tool.draw"
+expect "Clay Block##brush.clayblock"
+click "幾何##tool.geometry"
+click "細分##geometry.divide"
+expect_value sdiv_levels == 3
+shot zh_geometry
+click "幾何##tool.geometry"
+click "偏好設定##palette.preferences"
+click "English##language.en"
+expect "Preferences##palette.preferences"
+key escape
diff --git a/tools/i18n/subset_cjk_font.py b/tools/i18n/subset_cjk_font.py
new file mode 100755
index 00000000..1b55e6e1
--- /dev/null
+++ b/tools/i18n/subset_cjk_font.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+"""Writes assets/fonts/NotoSansTC-UI.otf: Noto Sans CJK TC (SIL OFL) cut down to the characters the Traditional Chinese
+table uses (src/app/I18nTraditionalChinese.cpp) plus CJK punctuation, so the binary carries a few hundred KB, not 16 MB.
+
+Run it after changing the table; the test i18n_chinese_table_fits_the_font lists what the font is missing.
+
+ subset_cjk_font.py [--source NotoSansCJK-Regular.ttc] (default: the Linux noto-fonts-cjk package's file)
+Needs fontTools (pip install fonttools).
+"""
+import argparse
+import re
+from pathlib import Path
+
+from fontTools import subset
+from fontTools.ttLib import TTCollection
+
+ROOT = Path(__file__).resolve().parent.parent.parent
+TABLE = ROOT / "src/app/I18nTraditionalChinese.cpp"
+OUT = ROOT / "assets/fonts/NotoSansTC-UI.otf"
+TC_FACE = "Noto Sans CJK TC"
+# Always kept: CJK and full-width punctuation the translations (and future edits) reach for.
+PUNCTUATION = ",。、:;!?()「」『』《》〈〉【】-~…·—%/+"
+
+
+def table_characters():
+ text = TABLE.read_text(encoding="utf-8")
+ chars = set()
+ for literal in re.findall(r'"((?:[^"\\]|\\.)*)"', text):
+ chars.update(c for c in literal if ord(c) > 0xFF)
+ return chars | set(PUNCTUATION)
+
+
+def main():
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ ap.add_argument("--source", default="/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc")
+ args = ap.parse_args()
+ collection = TTCollection(args.source)
+ font = next((f for f in collection.fonts if f["name"].getDebugName(4) == TC_FACE), None)
+ if font is None:
+ raise SystemExit(f"{args.source}: no '{TC_FACE}' face")
+ chars = sorted(table_characters())
+ cmap = font.getBestCmap()
+ missing = [c for c in chars if ord(c) not in cmap]
+ if missing:
+ raise SystemExit("not in the source font: " + "".join(missing))
+ options = subset.Options()
+ options.layout_features = [] # ImGui draws glyph by glyph: no shaping tables
+ options.hinting = False
+ options.name_IDs = ["*"] # keep the copyright and OFL notice
+ options.notdef_outline = True
+ sub = subset.Subsetter(options)
+ sub.populate(unicodes=[ord(c) for c in chars])
+ sub.subset(font)
+ font.flavor = None
+ font.save(OUT)
+ print(f"{OUT.relative_to(ROOT)}: {len(chars)} characters, {OUT.stat().st_size // 1024} KB")
+
+
+if __name__ == "__main__":
+ main()