3#include <NDEVR/String.h>
4#include <NDEVR/Buffer.h>
179 void calculateEnglishString();
185 mutable String m_translation;
186 UUID m_translation_id = Constant<UUID>::Invalid;
193 template<
class t_type>
212 struct hash<
NDEVR::TranslatedString>
221 return static_cast<size_t>(s.translationID().hash());
The equivelent of std::vector but with a bit more control.
static void toDisplayString(const t_type &value, TranslatedString &string)
Logic for converting an object to an NDEVR API translated, user facing string.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
static TranslatedString DisplayString(const t_type &value)
Converts an object into a TranslatedString.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
String englishTranslation() const
Returns the English translation of this string.
void replaceVals(String &value) const
Applies all stored replacement values to the given string, substituting placeholders.
bool hasReplacements() const
Checks whether this string has any placeholder replacements applied.
String internalValue() const
Returns the internal representation of this translated string, including replacement markers.
TranslatedString(const TranslatedString &translation)
Copy constructor.
TranslatedString(TranslatedString &&translation) noexcept
Move constructor.
TranslatedString & replace(const StringView &sub_string, const StringView &replacement)
Replaces occurrences of a placeholder substring with a raw string replacement.
bool operator>(const TranslatedString &value) const
Greater-than comparison operator, compares by English translation.
TranslatedString(const StringView &raw_string)
Constructs a TranslatedString from a raw string, computing a translation ID from the content.
const String readableID() const
Returns a human-readable identifier for this translated string, useful for debugging.
bool operator==(const TranslatedString &translation) const
Equality comparison operator.
bool isTranslatable() const
Checks whether this string has a translation ID and can be translated.
String translation(const String &language) const
Returns the translation of this string for a specific language.
~TranslatedString()
Destructor.
bool isEmpty() const
Checks whether this translated string is empty (has no English text or translation).
const String & englishDefine() const
Returns the original English definition string.
bool canReplaceInTranslation(const StringView &id) const
Checks whether the given identifier exists as a replaceable placeholder in this translation.
static TranslatedString DirectString(const StringView &sub_string)
If a string does not have a translation (EG: reading from an already translated string) this operatio...
TranslatedString & operator=(const TranslatedString &translation) noexcept
Copy assignment operator.
void retranslate()
Forces a retranslation of the cached translated string using the current language setting.
StringView translation() const
Returns the translated string for the current application language.
TranslatedString & replace(const StringView &sub_string, const TranslatedString &replacement)
Replaces occurrences of a placeholder substring with a translated replacement.
TranslatedString & operator=(TranslatedString &&translation) noexcept
Move assignment operator.
const UUID & translationID() const
Returns the UUID that identifies this translatable string in the translation database.
bool operator<(const TranslatedString &value) const
Less-than comparison operator, compares by English translation.
TranslatedString(const UUID &translation_id, const StringView &english)
Constructs a TranslatedString with an explicit translation ID and English text.
bool operator!=(const TranslatedString &translation) const
Inequality comparison operator.
static void AppendTranslated(const StringView &raw_string, String &string)
Appends the translated version of a raw string to an existing string.
TranslatedString()
Constructs an empty TranslatedString with no translation or English text.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
The primary namespace for the NDEVR SDK.