feature: localization (#32)

* build: add nlohmann/json library

* build(deps): add harfbuzz dependency

* feat(cmake): add guard to reject macOS builds

* feat(font): add HarfBuzz shaping and replace font with unifont

* feat(localization): add i18n support with en_US and zh_CN translations

Implement Localization class to load JSON translation files. Replace hardcoded strings in UI with translation keys and update sliders/combo buttons to use dynamic text.

* feat(localization): detect system locale for language default

* feat(settings): add language selection option with restart notification

* fix: use vckpg to add freetype on windows
This commit is contained in:
zhenyan121
2026-07-16 17:11:53 +08:00
committed by GitHub
parent cc2df5e4ec
commit d62b310a21
33 changed files with 26143 additions and 137 deletions

View File

@@ -13,7 +13,9 @@ public:
ComboButton& operator=(ComboButton&&) = delete;
ComboButton(Widget* parent);
Button& set_text(const std::string& text) override;
ComboButton& set_combo_text(const std::string& key,
const std::string& variable);
Button& set_text(const std::string& key) override;
bool handle_mouse_button_event(const MouseButtonEvent& e) override;
ComboButton& set_combos(std::span<ComboPair> combos);
ComboButton& set_index(int index);
@@ -23,7 +25,8 @@ private:
std::vector<std::string> m_suffix;
std::vector<std::function<void()>> m_funs;
std::string m_text;
std::string m_key;
std::string m_variable;
int m_index = 0;
int m_sum = 0;
};

View File

@@ -23,7 +23,8 @@ public:
Slider& set_scale(float scale);
Slider& set_width(float width);
Slider& set_height(float h);
Slider& set_text(const std::string& text);
Slider& set_slider_text(const std::string& key,
const std::string& variable);
Slider& set_track_image(const std::string& path,
TextureManager& texture_manager);
Slider& set_thumb_image(const std::string& path,
@@ -57,8 +58,8 @@ private:
int* m_int_value = nullptr;
float m_min = 0;
float m_max = 0;
std::string m_text;
std::string m_key;
std::string m_variable;
void init_track();
void init_thumb();