PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
i18n.h File Reference
#include <inttypes.h>
#include <stddef.h>
#include <pbl/util/list.h>

Data Structures

struct  I18nString
 Cached translation, stored in a list per language pack. More...
 

Macros

#define ISO_LOCALE_LENGTH   6
 Size of an ISO locale string such as "en_US", including the terminator.
 
#define LOCALE_NAME_LENGTH   30
 Size of a language name buffer, including the terminator.
 
#define i18n_noop(string)   (string)
 Tag a string for extraction without translating it.
 
#define i18n_ctx_noop(ctx, string)   (ctx "\4" string)
 Tag a string with a context for extraction without translating it.
 
#define i18n_ctx_get(ctx, string, owner)   i18n_get(i18n_ctx_noop(ctx, string), owner)
 i18n_get() with a context.
 
#define i18n_ctx_get_with_buffer(ctx, string, buffer, length)    i18n_get_with_buffer(i18n_ctx_noop(ctx, string), buffer, length)
 i18n_get_with_buffer() with a context.
 
#define i18n_ctx_get_length(ctx, string)   i18n_get_length(i18n_ctx_noop(ctx, string))
 i18n_get_length() with a context.
 
#define i18n_ctx_free(ctx, string, owner)   i18n_free(i18n_ctx_noop(ctx, string), owner)
 i18n_free() with a context.
 

Functions

const char * i18n_get (const char *string, const void *owner)
 Translate a string, caching the result for an owner.
 
void i18n_get_with_buffer (const char *string, char *buffer, size_t length)
 Translate a string into a buffer.
 
size_t i18n_get_length (const char *string)
 Get the length of a translated string.
 
void i18n_free (const char *string, const void *owner)
 Free a cached translation.
 
void i18n_free_all (const void *owner)
 Free all cached translations of an owner.
 
void i18n_set_resource (uint32_t resource_id)
 Select the system resource holding the language pack.
 
char * i18n_get_locale (void)
 Get the ISO locale of the installed language.
 
uint16_t i18n_get_version (void)
 Get the version of the installed language pack.
 
char * i18n_get_lang_name (void)
 Get the name of the installed language.
 
void i18n_enable (bool enable)
 Load or unload the language pack.