morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::MessageCatalogues Class Reference

The message catalogues of one bundle, by locale, and the provider t resolves through. More...

#include <catalogue.hpp>

Public Member Functions

void add (std::string locale, Catalogue catalogue)
 Adds, or replaces, a locale's catalogue.
std::vector< std::string > locales () const
 The locales with a catalogue, sorted.
std::vector< std::string > const & problems () const noexcept
 What went wrong while loading: a catalogue left out, or a pattern dropped. Each line names the file.
void note (std::string line)
 Records a loading problem.
std::optional< std::string > lookup (std::string_view key, std::string_view locale) const
 A message's pattern in a locale: the exact locale's catalogue, then its language's (de-AT, then de).
render::TranslationProvider provider () const
 A provider over the catalogues as they are now. It shares them, so it stays valid after this object is gone, and does not see a later add.

Detailed Description

The message catalogues of one bundle, by locale, and the provider t resolves through.

Definition at line 108 of file catalogue.hpp.

Member Function Documentation

◆ add()

void morph::ui::MessageCatalogues::add ( std::string locale,
Catalogue catalogue )
inline

Adds, or replaces, a locale's catalogue.

Parameters
localeThe locale.
catalogueIts messages.

Definition at line 113 of file catalogue.hpp.

◆ locales()

std::vector< std::string > morph::ui::MessageCatalogues::locales ( ) const
inlinenodiscard

The locales with a catalogue, sorted.

Returns
They.

Definition at line 121 of file catalogue.hpp.

◆ problems()

std::vector< std::string > const & morph::ui::MessageCatalogues::problems ( ) const
inlinenodiscardnoexcept

What went wrong while loading: a catalogue left out, or a pattern dropped. Each line names the file.

Returns
The lines.

Definition at line 133 of file catalogue.hpp.

◆ note()

void morph::ui::MessageCatalogues::note ( std::string line)
inline

Records a loading problem.

Parameters
lineWhat went wrong, naming the file.

Definition at line 137 of file catalogue.hpp.

◆ lookup()

std::optional< std::string > morph::ui::MessageCatalogues::lookup ( std::string_view key,
std::string_view locale ) const
inlinenodiscard

A message's pattern in a locale: the exact locale's catalogue, then its language's (de-AT, then de).

Parameters
keyThe message key.
localeThe BCP 47 locale.
Returns
The pattern, or nothing; t then shows the fallback.

Definition at line 144 of file catalogue.hpp.

◆ provider()

render::TranslationProvider morph::ui::MessageCatalogues::provider ( ) const
inlinenodiscard

A provider over the catalogues as they are now. It shares them, so it stays valid after this object is gone, and does not see a later add.

Returns
The provider, for FormatContext::translations (Session::setTranslations).

Definition at line 151 of file catalogue.hpp.


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