Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Locale Namespace Reference

Namespaces

namespace  detail
 

Classes

class  LanguageData
 
struct  LanguageEntry
 

Functions

 FWD_DECLARE_MANAGED_CLASS (LanguageData)
 
ErrorCode Init (const char *newLanguage=DEFAULT_LANG)
 Reset everything and load the specified language file.
 
void Clear () noexcept
 clear the language table
 
void Idle ()
 perform maintenance tasks
 
ErrorCode ChangeLanguage (const char *newLanguage)
 
void SetChangeLanguageCallback (const DELEGATE< void, std::string_view > &cbk)
 Set a function to be called on each language change.
 
const Str< 64 > & CurrentLanguage () noexcept
 Query the current language code to detect changes.
 
const char * Get (U64 key, bool appendSection=true, const char *defaultValue=nullptr)
 

Variables

constexpr const char * DEFAULT_LANG = "enGB"
 
constexpr const char *const g_languageFileExtension = ".ini"
 

Function Documentation

◆ ChangeLanguage()

ErrorCode Divide::Locale::ChangeLanguage ( const char *  newLanguage)

Although the language can be set at compile time, in-game options may support language changes

Definition at line 163 of file Localization.cpp.

◆ Clear()

void Divide::Locale::Clear ( )
noexcept

clear the language table

Definition at line 143 of file Localization.cpp.

◆ CurrentLanguage()

const Str< 64 > & Divide::Locale::CurrentLanguage ( )
noexcept

Query the current language code to detect changes.

Definition at line 185 of file Localization.cpp.

◆ FWD_DECLARE_MANAGED_CLASS()

Divide::Locale::FWD_DECLARE_MANAGED_CLASS ( LanguageData  )

◆ Get()

const char * Divide::Locale::Get ( U64  key,
bool  appendSection = true,
const char *  defaultValue = nullptr 
)

usage: Locale::Get("A_B_C")) or Locale::Get("A_B_C"), true/false, "X") where "A_B_C" is the language key we want and "X" is a default string in case the key does not exist in the INI file appendSection will add [ sectionName ] in front of the returned string.

Definition at line 171 of file Localization.cpp.

◆ Idle()

void Divide::Locale::Idle ( )

perform maintenance tasks

Definition at line 152 of file Localization.cpp.

◆ Init()

ErrorCode Divide::Locale::Init ( const char *  newLanguage = DEFAULT_LANG)

Reset everything and load the specified language file.

Definition at line 120 of file Localization.cpp.

◆ SetChangeLanguageCallback()

void Divide::Locale::SetChangeLanguageCallback ( const DELEGATE< void, std::string_view > &  cbk)

Set a function to be called on each language change.

Definition at line 178 of file Localization.cpp.

Variable Documentation

◆ DEFAULT_LANG

constexpr const char* Divide::Locale::DEFAULT_LANG = "enGB"
constexpr

Definition at line 44 of file Localization.h.

◆ g_languageFileExtension

constexpr const char* const Divide::Locale::g_languageFileExtension = ".ini"
constexpr

Definition at line 45 of file Localization.h.