void Text::HandleChangeLanguage(StringHash eventType, VariantMap& eventData) { auto* l10n = GetSubsystem<Localization>(); text_ = l10n->Get(stringId_); DecodeToUnicode(); ValidateSelection(); UpdateText(); }
void Text::ApplyAttributes() { UIElement::ApplyAttributes(); DecodeToUnicode(); fontSize_ = Max(fontSize_, 1); ValidateSelection(); UpdateText(); }
void Text::SetText(const ea::string& text) { if (autoLocalizable_) { stringId_ = text; auto* l10n = GetSubsystem<Localization>(); text_ = l10n->Get(stringId_); } else { text_ = text; } DecodeToUnicode(); ValidateSelection(); UpdateText(); }
void Text::ApplyAttributes() { UISelectable::ApplyAttributes(); // Localize now if attributes were loaded out-of-order if (autoLocalizable_ && stringId_.length()) { auto* l10n = GetSubsystem<Localization>(); text_ = l10n->Get(stringId_); } DecodeToUnicode(); fontSize_ = Max(fontSize_, 1); strokeThickness_ = Abs(strokeThickness_); ValidateSelection(); UpdateText(); }
void Text::SetAutoLocalizable(bool enable) { if (enable != autoLocalizable_) { autoLocalizable_ = enable; if (enable) { stringId_ = text_; auto* l10n = GetSubsystem<Localization>(); text_ = l10n->Get(stringId_); SubscribeToEvent(E_CHANGELANGUAGE, URHO3D_HANDLER(Text, HandleChangeLanguage)); } else { text_ = stringId_; stringId_ = ""; UnsubscribeFromEvent(E_CHANGELANGUAGE); } DecodeToUnicode(); ValidateSelection(); UpdateText(); } }