Dawn/src/locale/language.h

59 lines
1.7 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
/**
* Initializes a language.
* @param language Language to initialize.
*/
void languageInit(language_t *language);
/**
* Adds a string to a language.
* @param lang Language to add to.
* @param key Key to use for the string.
* @param text Value to use for the language string
* @return The language string added to the language.
*/
languagestring_t * languageAddString(language_t *lang, char *key, char *text);
/**
* Returns the language string for a given language string key.
*
* @param language Language to get from.
* @param key Key to get from.
* @return The string matching the key, or NULL if no match.
*/
languagestring_t * languageGetStringByKey(language_t *language, char *key);
/**
* Returns the value for a given language string.
*
* @param language Language to get from.
* @param string Language string to get.
* @return The string.
*/
char * languageGetText(language_t *language, languagestring_t *string);
/**
* Retreives the value of a given language string, and replaces the variables in
* the string with the provided variable values.
*
* @param language Language to read from.
* @param string String to get and parse.
* @param variables Variables to use in the parsing.
* @param variableCount How many variables in the array.
* @param buffer The buffer to write the output data to.
* @return The count of characters that were written to the buffer.
*/
int32_t languageGetTextWithVariables(
language_t *language, languagestring_t *string,
languagevariable_t *variables, int32_t variableCount,
char *buffer
);