xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::i18n Namespace Reference

Internationalization facilities. More...

Namespaces

namespace  tparam
 

Classes

class  Context
 A context that uses a certain context string. More...
 
struct  SortAscending
 A predicate for sorting strings in ascending order using the comparison rules of the current locale. More...
 
struct  SortDescending
 A predicate for sorting strings in descending order using the comparison rules of the current locale. More...
 
struct  SortOrdering
 A predicate that compares two strings using the comparison rules of the current locale. More...
 
struct  Translate
 A translated string that can be used as a template parameter. More...
 

Functions

auto translate (std::string_view context, std::string_view text) -> ui::String
 Function to translate a string to the system language.
 
auto convert (std::string_view text) -> auto
 Converts a string to a UI string.
 
template<typename... Arguments>
auto make_format_args (Arguments &...arguments) -> decltype(auto)
 Function to create format arguments for use in std::vformat and std::vformat_to.
 
template<typename... Arguments>
auto format (std::string_view context, std::string_view format, Arguments &&...arguments) -> ui::String
 Function to format a string and translate it to the system language.
 
template<typename OutputIterator , typename... Arguments>
auto format_to (std::string_view context, OutputIterator output, std::string_view format, Arguments &&...arguments) -> OutputIterator
 Function to format a string to an output sequence and translate it to the system language.
 

Variables

constexpr SortOrdering kSortOrdering
 A predicate that compares two strings using the comparison rules of the current locale.
 
constexpr SortAscending kSortAscending
 A predicate for sorting strings in ascending order using the comparison rules of the current locale.
 
constexpr SortDescending kSortDescending
 A predicate for sorting strings in descending order using the comparison rules of the current locale.
 

Detailed Description

Internationalization facilities.

This namespace contains functionality for internationalizing user facing text, so that it can be localized to different languages.

Function Documentation

◆ convert()

auto xentara::workbench::i18n::convert ( std::string_view  text) -> auto

Converts a string to a UI string.

Include file
#include <xentara/workbench/i18n/Context.hpp>
Parameters
textThe text to translate
Returns
The untranslated string in the correct encoding

◆ format()

template<typename... Arguments>
auto xentara::workbench::i18n::format ( std::string_view  context,
std::string_view  format,
Arguments &&...  arguments 
) -> ui::String

Function to format a string and translate it to the system language.

Include file
#include <xentara/workbench/i18n/Context.hpp>
Parameters
contextThe context
formatThe format string (will be translated)
argumentsThe format arguments (will not be translated)
Returns
The formatted string
See also
Context::format()

◆ format_to()

template<typename OutputIterator , typename... Arguments>
auto xentara::workbench::i18n::format_to ( std::string_view  context,
OutputIterator  output,
std::string_view  format,
Arguments &&...  arguments 
) -> OutputIterator

Function to format a string to an output sequence and translate it to the system language.

Include file
#include <xentara/workbench/i18n/Context.hpp>
Parameters
contextThe context
outputThe iterator that the translated text should be written to.
formatThe format string (will be translated)
argumentsThe format arguments (will not be translated)
Returns
An iterator past the end of the output range.
See also
Context::format_to()

◆ make_format_args()

template<typename... Arguments>
auto xentara::workbench::i18n::make_format_args ( Arguments &...  arguments) -> decltype(auto)

Function to create format arguments for use in std::vformat and std::vformat_to.

Include file
#include <xentara/workbench/i18n/Context.hpp>
Parameters
argumentsThe format arguments
Returns
The arguments, packaged for use in std::vformat or std::vformat_to.

◆ translate()

auto xentara::workbench::i18n::translate ( std::string_view  context,
std::string_view  text 
) -> ui::String

Function to translate a string to the system language.

Include file
#include <xentara/workbench/i18n/Context.hpp>
Parameters
contextThe context
textThe text to translate
Returns
The translated string
See also
Context::translate()

Variable Documentation

◆ kSortAscending

constexpr SortAscending xentara::workbench::i18n::kSortAscending
constexpr

A predicate for sorting strings in ascending order using the comparison rules of the current locale.

◆ kSortDescending

constexpr SortDescending xentara::workbench::i18n::kSortDescending
constexpr

A predicate for sorting strings in descending order using the comparison rules of the current locale.

◆ kSortOrdering

constexpr SortOrdering xentara::workbench::i18n::kSortOrdering
constexpr

A predicate that compares two strings using the comparison rules of the current locale.