DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::Localization Namespace Reference

Classes

struct  Language
class  ScopedPackage
 While it lives, Tr and TrLabel look in package's own table first, so text a package's class shows (its component, property and enum names) reads as that package translates it even when the editor or another package translates the same English word differently: deki-fsm's "Add" (an arithmetic operation) is not the editor's "Add" button. More...

Functions

const std::vector< Language > & Languages ()
 Every language the editor offers, English first.
const std::string & Current ()
 The language text is shown in, such as "en" or "ja".
void SetLanguage (const std::string &code)
 Shows text in another language from now on and remembers it for the next session.
void UseLanguage (const std::string &code)
 Shows text in another language for this session only, without saving it.
void Load ()
 Reads the language saved in the editor settings and the editor's own tables.
void AddTableDirectory (const std::string &dir, const std::string &package="")
 Adds the translations in dir/.json and in every file of dir//.
uint32_t Generation ()
 Changes whenever the language or a table changes, for caches of translated text.

Function Documentation

◆ Languages()

const std::vector< Language > & DekiEditor::Localization::Languages ( )

Every language the editor offers, English first.

◆ Current()

const std::string & DekiEditor::Localization::Current ( )

The language text is shown in, such as "en" or "ja".

◆ SetLanguage()

void DekiEditor::Localization::SetLanguage ( const std::string & code)

Shows text in another language from now on and remembers it for the next session.

An unknown code means English.

◆ UseLanguage()

void DekiEditor::Localization::UseLanguage ( const std::string & code)

Shows text in another language for this session only, without saving it.

An unknown code means English.

◆ Load()

void DekiEditor::Localization::Load ( )

Reads the language saved in the editor settings and the editor's own tables.

Called once at startup, after the settings load.

◆ AddTableDirectory()

void DekiEditor::Localization::AddTableDirectory ( const std::string & dir,
const std::string & package = "" )

Adds the translations in dir/.json and in every file of dir//.

They go into one shared table, where a key the editor (or an earlier package) already translates keeps that translation. With a package ("deki-fsm"), they are also that package's own table, which wins inside its ScopedPackage.

◆ Generation()

uint32_t DekiEditor::Localization::Generation ( )

Changes whenever the language or a table changes, for caches of translated text.