From 2bf12a9a92abdfdc7d4379bddaec4a6c67488b32 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 22 Dec 2021 12:54:53 +0200 Subject: [PATCH] Fix CViewText always returning localization key --- nel/include/nel/gui/view_text.h | 5 +++-- nel/src/gui/view_text.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index c5b4ba197..0b6eed424 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -121,8 +121,8 @@ namespace NLGUI void setShadowInSelection(bool s) { m_DisableShadowInSelection = !s; } bool getShadowInSelection() const { return !m_DisableShadowInSelection; } - /// Get - std::string getText() const { return _HardText.empty() ? _Text : _HardText; } + /// Get displayed text + std::string getText() const { return _Text; } #ifdef RYZOM_LUA_UCSTRING ucstring getTextAsUtf16() const; // Compatibility ucstring getHardTextAsUtf16() const; // Compatibility @@ -190,6 +190,7 @@ namespace NLGUI /// From a line number, get the character at which it ends (not including any '\n' ), or -1 if invalid void getLineEndIndex(uint line, sint &index, bool &endOfPreviousLine) const; + /// If localized, return localization key (ie "uiLanguage"), else return displayed text. std::string getHardText() const { return _HardText.empty() ? _Text : _HardText; } void setHardText (const std::string &ht); //< Localizes strings starting with "ui" #ifdef RYZOM_LUA_UCSTRING diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 4ac79f9a8..118f23f4e 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -1468,7 +1468,7 @@ namespace NLGUI } } - nlassert(_Text.empty() || ((_Localized && (NLMISC::startsWith(getText(), "ui"))) == (_HardText.empty() == _Text.empty()))); + nlassert(_Text.empty() || ((_Localized && (NLMISC::startsWith(getHardText(), "ui"))) == (_HardText.empty() == _Text.empty()))); } // ***************************************************************************