mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
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:
10
src/app.cpp
10
src/app.cpp
@@ -3,10 +3,12 @@
|
||||
#include "Cubed/camera.hpp"
|
||||
#include "Cubed/config.hpp"
|
||||
#include "Cubed/debug_collector.hpp"
|
||||
#include "Cubed/localization.hpp"
|
||||
#include "Cubed/tools/arg_parser.hpp"
|
||||
#include "Cubed/tools/cubed_assert.hpp"
|
||||
#include "Cubed/tools/log.hpp"
|
||||
#include "Cubed/tools/system_info.hpp"
|
||||
#include "Cubed/tools/system_locate.hpp"
|
||||
#include "Cubed/tools/text_tools.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
@@ -39,6 +41,14 @@ void App::init(int argc, char** argv) {
|
||||
handle_toml();
|
||||
handle_argument(argc, argv);
|
||||
|
||||
auto locate = get_system_locale();
|
||||
std::string default_value = "en_US";
|
||||
if (locate.country == "CN") {
|
||||
default_value = "zh_CN";
|
||||
}
|
||||
Localization::instance().load_language(
|
||||
m_game_config.get("language", default_value));
|
||||
|
||||
m_window.init();
|
||||
m_window.imgui_init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user