glogging
Loading...
Searching...
No Matches
GMessageCatalog Class Reference

Immutable, cached translations of complete English message templates. More...

#include <gmessageCatalog.h>

Public Member Functions

std::string_view translate (std::string_view english) const
 Returns a translated template, or the original view when no translation is available.
template<typename... Args>
std::string format (std::string_view message, Args &&... args) const
 Translate and format a complete template without logging headers or verbosity filtering. Supports %1 through %99 and literal %%; inserted parameter text is never interpreted as a template. Invalid or unused parameter positions throw std::invalid_argument, matching GLogger formatting.
const std::string & language () const
 Normalized requested language tag; a missing catalog still falls back to English per message.

Static Public Member Functions

static std::shared_ptr< const GMessageCatalog > load (const GOptions *options=nullptr)
 Resolve language and catalog paths from options/environment and reuse the cached catalog.
static std::vector< std::filesystem::path > searchDirectories (const GOptions *options=nullptr)
 Catalog search paths shared by logging and GUI translation startup.

Detailed Description

Catalogs use schema 1 and an English-template-to-translation mapping. Invalid files are ignored with a diagnostic; missing messages retain their English text. Loading never changes the process locale.

Definition at line 22 of file gmessageCatalog.h.

Member Function Documentation

◆ format()

template<typename... Args>
std::string GMessageCatalog::format ( std::string_view message,
Args &&... args ) const
inlinenodiscard

Definition at line 42 of file gmessageCatalog.h.

◆ language()

const std::string & GMessageCatalog::language ( ) const
inlinenodiscard

Definition at line 90 of file gmessageCatalog.h.

◆ load()

std::shared_ptr< const GMessageCatalog > GMessageCatalog::load ( const GOptions * options = nullptr)
staticnodiscard
Parameters
optionsOptional configuration with language and plugin_path scalar options.

Definition at line 215 of file gmessageCatalog.cc.

◆ searchDirectories()

std::vector< std::filesystem::path > GMessageCatalog::searchDirectories ( const GOptions * options = nullptr)
staticnodiscard

Definition at line 238 of file gmessageCatalog.cc.

◆ translate()

std::string_view GMessageCatalog::translate ( std::string_view english) const
nodiscard

Definition at line 233 of file gmessageCatalog.cc.


The documentation for this class was generated from the following files: