CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
host_api_i18n.cpp File Reference

Manifest-driven i18n lookups for the currently active plugin. More...

#include "plugin_manager/host_api.h"
#include "plugin_manager/Plugin.h"
#include "cdc_ui/I18n.h"
#include "cdc_log.h"
#include <cstring>

Go to the source code of this file.

Functions

void * plg_get_active_plugin (void)
int host_i18n_tr_key (const char *key, char *out, uint32_t out_cap)
 Translate a plugin-local key into the current language.
int host_i18n_tr_meta (const char *field, char *out, uint32_t out_cap)
 Read a metadata field (name, description, ...) from the plugin manifest.
uint8_t host_i18n_current_language (void)
 Active language code (HOST_LANG_*).
int host_i18n_tr_core (const char *key, char *out, uint32_t out_cap)
 Translate a core.* key from the firmware string table.

Detailed Description

Manifest-driven i18n lookups for the currently active plugin.

The plugin manager registers a plugin's i18n.meta and i18n.strings entries when the plugin is loaded. Plugin code asks for a translation by key (host_i18n_tr_key("save", buf, sizeof(buf))) or for a metadata field (host_i18n_tr_meta("name", buf, sizeof(buf))). The host copies the resolved string into the caller-provided buffer (NUL-terminated when there is room) and returns the number of bytes written excluding the NUL, or -1 on error.

Definition in file host_api_i18n.cpp.

Function Documentation

◆ plg_get_active_plugin()

void * plg_get_active_plugin ( void )

Definition at line 24 of file plugin_log_bridge.cpp.