Files
dusk/archive/dusk/locale/language.h
2025-08-20 19:18:38 -05:00

65 lines
1.7 KiB
C

/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "locale/language/languages.h"
typedef struct {
uint8_t current;
} language_t;
extern language_t LANGUAGE;
/**
* Initializes the language system.
*
* This function sets up the language system, loading the default language
* and preparing any necessary resources for language handling.
*/
void languageInit(void);
/**
* Gets a language string by its key.
*
* @param key The key for the language string.
* @return The language string associated with the key.
*/
const char_t * languageGet(const char_t *key);
/**
* Gets the length of a language string by its key.
*
* @param key The key for the language string.
* @return The length of the language string associated with the key.
*/
uint16_t langaugeGetLength(const char_t *key);
/**
* Formats a language string with given keys and values.
*
* This function replaces placeholders in the language string with the provided
* values based on the keys.
*
* If buffer is NULL, the function will instead calculate the length of the
* formatted string.
*
* @param key The key for the language string to format.
* @param buffer The buffer to store the formatted string.
* @param buffSize The size of the buffer.
* @param keys An array of keys to replace in the language string.
* @param values An array of values corresponding to the keys.
* @param valueCount The number of key-value pairs.
* @return The number of characters written to the buffer.
*/
uint16_t languageFormat(
const char_t *key,
char_t *buffer,
uint16_t buffSize,
const char_t **keys,
const char_t **values,
const uint16_t valueCount
);