CText
- Module
- Arc
- Header
#include "Arc/Core/CText.h"- Namespace
Arcf
Constructors
| Signature | Name | Description |
|---|---|---|
CText() = default | CText |
Public functions
| Returns | Name | Description |
|---|---|---|
CText | FromKey | Namespace + key with no authored source. |
CText | FromStringTable | The LOCTEXT path: namespace, key and the English the key was authored from. |
CText | FromStringTablePlural | Plural form, chosen by the CLDR rule of the active locale from the key.one / key.few / key.many / key.other variants. |
CText | FromStringTableSelect | Gender or any other select form, chosen from the key.<form> variants with key.other as the catch-all. |
CText | FromString | Unlocalized literal — development only |
CText | Format | FText-grade formatting: "{0}", "{name}", "{0}|plural(one=..,other=..)", "{0}|ordinal(..)", "{0}|select(..)" (see Mowo::FText::FormatArgs). |
CText | Format | |
TArcNamedArgument<std::decay_t<T>> | Arg | A named argument for "{name}": CText::Format(pattern, CText::Arg("hp", 42)). |
CText | GetEmpty | |
const std::string& | ToString | |
bool | IsEmpty | |
bool | IsLocalized | |
const std::string& | GetNamespace | |
const std::string& | GetKey | |
const std::string& | GetSourceString | |
bool | operator== | |
bool | operator!= |
Function details
CText
CText() = defaultFromKey
static CText FromKey(const std::string& ns, const std::string& key)Namespace + key with no authored source. An unresolved key surfaces as the key itself, which is the long-standing behaviour of this overload and what makes a missing translation visible in the UI.
FromStringTable
static CText FromStringTable(const std::string& ns, const std::string& key, const std::string& source)The LOCTEXT path: namespace, key and the English the key was authored from. Resolution walks active locale → fallback locale → this source string, so the text reads correctly before a single table has been loaded.
FromStringTablePlural
static CText FromStringTablePlural(const std::string& ns, const std::string& key, int64_t count, const std::string& source)Plural form, chosen by the CLDR rule of the active locale from the key.one / key.few / key.many / key.other variants. "{n}" in the winning pattern becomes the count.
FromStringTableSelect
static CText FromStringTableSelect(const std::string& ns, const std::string& key, const std::string& form, const std::string& source)Gender or any other select form, chosen from the key.<form> variants with key.other as the catch-all.
FromString
static CText FromString(const std::string& literal)Unlocalized literal — development only
Format
template<typename... Args> static CText Format(const std::string& pattern, Args&&... args)FText-grade formatting: "{0}", "{name}", "{0}|plural(one=..,other=..)", "{0}|ordinal(..)", "{0}|select(..)" (see Mowo::FText::FormatArgs). The pattern and the arguments are kept, not the result, so the text re-formats when the culture changes: a localized pattern re-resolves, a CText argument re-resolves, and numbers re-format with the new culture's separators and digits. Substitution is one pass, so an argument's own text is never searched for placeholders.
Format
template<typename... Args> static CText Format(const CText& pattern, Args&&... args)Arg
template<typename T> static TArcNamedArgument<std::decay_t<T>> Arg(const std::string& name, T&& value)A named argument for "{name}": CText::Format(pattern, CText::Arg("hp", 42)).
GetEmpty
static CText GetEmpty()ToString
const std::string& ToString() constIsEmpty
bool IsEmpty() constIsLocalized
bool IsLocalized() constGetNamespace
const std::string& GetNamespace() constGetKey
const std::string& GetKey() constGetSourceString
const std::string& GetSourceString() constoperator==
bool operator==(const CText& other) constoperator!=
bool operator!=(const CText& other) const