Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Localization.cpp File Reference

Go to the source code of this file.

Namespaces

namespace  FW
 
namespace  Divide
 Handle console commands that start with a forward slash.
 
namespace  Divide::Locale
 
namespace  Divide::Locale::detail
 

Functions

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

Variables

static Str< 64 > Divide::Locale::detail::g_localeFile = {}
 Default language can be set at compile time.
 
static bool Divide::Locale::detail::g_init = false
 
static bool Divide::Locale::detail::g_fileWatcher = false
 
static LanguageData_uptr Divide::Locale::detail::g_data = nullptr
 
static FW::FileWatcher_uptr Divide::Locale::detail::g_LanguageFileWatcher = nullptr
 External modification monitoring system.
 
static UpdateListener Divide::Locale::detail::g_fileWatcherListener ([](const std::string_view languageFile, const FileUpdateEvent evt) { if(evt==FileUpdateEvent::DELETE) { return;} if((g_localeFile+g_languageFileExtension).c_str()==languageFile) { ChangeLanguage(g_localeFile.c_str());} })
 Callback for external file changes.
 
constexpr U32 Divide::Locale::detail::g_fileWatcherUpdateFrameInterval = 120u