mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-11-11 14:47:39 +00:00
Compose the CM0 fullscreen application and standard Debian package, align the Cardputer Zero shell, and share protocol, configuration, audio and storage services with embedded targets through existing platform seams. Add the paginated on-device TMAP creator using Center's published producer, private workspace recovery and direct keyboard shortcuts. Preserve unfinished management work behind its existing opt-in capability. Include native, ARM and shared-core regression fixtures, integration records, packaging helpers and dependency/license updates. Keep local build trees, device credentials, produced packages and validation logs outside version control. Validation before integration: ESP stack hygiene, Reticulum scope guard, staged whitespace checks and GitNexus scope audit. Prior device/build evidence and remaining hardware/package boundaries are recorded in the acceptance documents.
105 lines
3.7 KiB
C++
105 lines
3.7 KiB
C++
#pragma once
|
|
|
|
#include <cstdarg>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "lvgl.h"
|
|
|
|
namespace ui::i18n
|
|
{
|
|
|
|
struct LocaleInfo
|
|
{
|
|
const char* id = nullptr;
|
|
const char* display_name = nullptr;
|
|
const char* native_name = nullptr;
|
|
const char* ui_font_pack_id = nullptr;
|
|
const char* content_font_pack_id = nullptr;
|
|
const char* ime_pack_id = nullptr;
|
|
const char* direction = nullptr; // "ltr" (default) or "rtl"
|
|
bool builtin = true;
|
|
};
|
|
|
|
struct ImeInfo
|
|
{
|
|
const char* id = nullptr;
|
|
const char* display_name = nullptr;
|
|
const char* backend = nullptr;
|
|
const char* layout = nullptr;
|
|
bool builtin = true;
|
|
};
|
|
|
|
using LocaleChangeCompletion = void (*)(bool changed, void* user_data);
|
|
|
|
// Set by the composition before the first registry access, on the LVGL owner.
|
|
// Empty selects the platform's historical removable-storage path.
|
|
bool configure_external_pack_root(const std::string& root);
|
|
void reload_language();
|
|
std::size_t locale_count();
|
|
const LocaleInfo* locale_at(std::size_t index);
|
|
int current_locale_index();
|
|
const char* current_locale_id();
|
|
const char* current_locale_display_name();
|
|
const char* current_locale_direction();
|
|
bool set_locale(const char* locale_id, bool persist = true);
|
|
bool set_locale_by_index(std::size_t index, bool persist = true);
|
|
// Queues an external-font locale activation until a normal LVGL frame has
|
|
// completed. The completion runs on the LVGL owner context after the handler
|
|
// returns, never from the input callback that requested the change.
|
|
bool request_locale_by_index(std::size_t index,
|
|
bool persist = true,
|
|
LocaleChangeCompletion completion = nullptr,
|
|
void* user_data = nullptr);
|
|
// Called by the platform's sole LVGL handler owner immediately after one
|
|
// handler pass returns. It runs at most one deferred font operation.
|
|
void on_lvgl_frame_completed();
|
|
const lv_font_t* active_ui_font_fallback();
|
|
const lv_font_t* active_content_font_fallback();
|
|
const lv_font_t* locale_preview_font(const char* locale_id, const lv_font_t* ascii_font = nullptr);
|
|
bool ensure_content_font_for_text(const char* text);
|
|
bool prepare_content_font_for_text(const char* text, bool force_overlay = true);
|
|
void log_direct_text_route(const char* owner, const void* label, const char* text);
|
|
std::size_t ime_count();
|
|
const ImeInfo* ime_at(std::size_t index);
|
|
std::size_t enabled_ime_count();
|
|
bool ime_enabled(const char* ime_id);
|
|
bool set_ime_enabled(const char* ime_id, bool enabled, bool persist = true);
|
|
bool any_enabled_script_input();
|
|
const char* active_ime_pack_id();
|
|
bool active_locale_supports_script_input();
|
|
const char* tr(const char* english);
|
|
std::string vformat(const char* english_fmt, va_list args);
|
|
std::string format(const char* english_fmt, ...);
|
|
|
|
void set_label_text(lv_obj_t* label, const char* english);
|
|
void set_label_text_raw(lv_obj_t* label, const char* text);
|
|
void set_content_label_text(lv_obj_t* label, const char* english);
|
|
void set_content_label_text_raw(lv_obj_t* label, const char* text);
|
|
void set_label_text_fmt(lv_obj_t* label, const char* english_fmt, ...);
|
|
|
|
#if defined(__cpp_char8_t)
|
|
inline void set_label_text(lv_obj_t* label, const char8_t* english)
|
|
{
|
|
set_label_text(label, reinterpret_cast<const char*>(english));
|
|
}
|
|
|
|
inline void set_label_text_raw(lv_obj_t* label, const char8_t* text)
|
|
{
|
|
set_label_text_raw(label, reinterpret_cast<const char*>(text));
|
|
}
|
|
|
|
inline void set_content_label_text(lv_obj_t* label, const char8_t* english)
|
|
{
|
|
set_content_label_text(label, reinterpret_cast<const char*>(english));
|
|
}
|
|
|
|
inline void set_content_label_text_raw(lv_obj_t* label, const char8_t* text)
|
|
{
|
|
set_content_label_text_raw(label, reinterpret_cast<const char*>(text));
|
|
}
|
|
#endif
|
|
|
|
} // namespace ui::i18n
|