diff --git a/nel/include/nel/gui/html_element.h b/nel/include/nel/gui/html_element.h index b7bceb4ab..22f037cd4 100644 --- a/nel/include/nel/gui/html_element.h +++ b/nel/include/nel/gui/html_element.h @@ -84,6 +84,9 @@ namespace NLGUI TStyle getPseudo(const std::string &key) const; void setPseudo(const std::string &key, const TStyle &style); + // return lang property for css :lang() pseudo class + std::string getInheritedLanguage() const; + private: // pseudo elements like ":before" and ":after" std::map _Pseudo; diff --git a/nel/src/gui/html_element.cpp b/nel/src/gui/html_element.cpp index f0b764640..8735cc56e 100644 --- a/nel/src/gui/html_element.cpp +++ b/nel/src/gui/html_element.cpp @@ -122,6 +122,21 @@ namespace NLGUI } } + // *************************************************************************** + std::string CHtmlElement::getInheritedLanguage() const + { + const CHtmlElement *node = this; + while(node) + { + if (node->hasAttribute("lang")) + return node->getAttribute("lang"); + + node = node->parent; + } + + return ""; + } + // *************************************************************************** std::string CHtmlElement::toString(bool tree, uint depth) const {