PebbleOS v4.45.0-223-gf3212a729
Loading...
Searching...
No Matches
Language packs

Manages the installed language packs and the one translations come from. More...

Functions

void language_pack_set_resource (uint32_t resource_id)
 Select the system resource holding the translation catalog.
 
void language_pack_enable (bool enable)
 Use or stop using the selected translation catalog.
 
bool language_pack_get_info (uint8_t slot, struct pbl_i18n_catalog_info *info)
 Read the metadata of an installed pack without changing the language.
 
bool language_pack_has_fonts (uint8_t slot)
 Check whether a pack carries at least one valid font, with or without a translation.
 
bool language_pack_remove (uint8_t slot)
 Remove an installed pack, falling back to English if it was selected.
 
const char * language_pack_install_begin (const char *filename)
 Resolve the file a PutBytes file transfer writes to.
 
void language_pack_install_end (bool success)
 Finish a transfer started with language_pack_install_begin().
 

Detailed Description

Manages the installed language packs and the one translations come from.

A language pack is a file of system resources: a translation catalog and fonts. The catalog of the selected pack is given to Internationalization, and is given again whenever its file changes. Changing the language puts a PEBBLE_LANGUAGE_CHANGE_EVENT.

Function Documentation

◆ language_pack_enable()

void language_pack_enable ( bool  enable)

Use or stop using the selected translation catalog.

Parameters
enabletrue to translate with the catalog, false to fall back to English.

◆ language_pack_get_info()

bool language_pack_get_info ( uint8_t  slot,
struct pbl_i18n_catalog_info *  info 
)

Read the metadata of an installed pack without changing the language.

Parameters
slotPack slot.
[out]infoMetadata, with its strings zero-padded.
Returns
true if the pack has a translation catalog.

◆ language_pack_has_fonts()

bool language_pack_has_fonts ( uint8_t  slot)

Check whether a pack carries at least one valid font, with or without a translation.

Parameters
slotPack slot.

◆ language_pack_install_begin()

const char * language_pack_install_begin ( const char *  filename)

Resolve the file a PutBytes file transfer writes to.

Additive pack installs go to the first free pack slot; other files are unchanged.

Parameters
filenamePath of the file being transferred.
Returns
Path to write, or NULL if every pack slot is occupied.

◆ language_pack_install_end()

void language_pack_install_end ( bool  success)

Finish a transfer started with language_pack_install_begin().

Parameters
successWhether the transfer completed.

◆ language_pack_remove()

bool language_pack_remove ( uint8_t  slot)

Remove an installed pack, falling back to English if it was selected.

Parameters
slotPack slot.
Returns
true if the pack was removed.

◆ language_pack_set_resource()

void language_pack_set_resource ( uint32_t  resource_id)

Select the system resource holding the translation catalog.

If the user chose English, the catalog is not used.

Parameters
resource_idSystem resource ID of the catalog.