Skip to content

Commit

Permalink
Fix loading from gettext if menu did not have a description
Browse files Browse the repository at this point in the history
  • Loading branch information
Code7R committed Sep 27, 2024
1 parent 5d735df commit 8cbfd30
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/fdomenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,15 @@ struct DesktopFile : public tLintRefcounted {

/// Translate with built-in l10n if needed, and cache it
string &GetTranslatedName() {
if (NameLoc.empty()) {
if (NameLoc.empty() && !Name.empty())
NameLoc = gettext(Name.c_str());
}
return NameLoc;
}

string &GetTranslatedGenericName() {
if (GenericNameLoc.empty()) {
if (GenericNameLoc.empty() && !GenericName.empty())
GenericNameLoc = gettext(GenericName.c_str());
}

return GenericNameLoc;
}

Expand Down Expand Up @@ -822,15 +821,17 @@ void MenuNode::print(std::ostream &prt_strm) {
}
for (auto &m : sorted) {
auto &name = m.first;
prt_strm << indent_hint << "menu \""
<< (m.second.second->deco
? m.second.second->deco->GetTranslatedName()
: name)
<< "\" " <<

((m.second.second->deco && !m.second.second->deco->Icon.empty())
? m.second.second->deco->Icon
: ICON_FOLDER)
prt_strm << indent_hint << "menu \"";
if (m.second.second->deco)
prt_strm << m.second.second->deco->GetTranslatedName();
else
prt_strm << gettext(name.c_str());

prt_strm << "\" "
<< ((m.second.second->deco &&
!m.second.second->deco->Icon.empty())
? m.second.second->deco->Icon
: ICON_FOLDER)
<< " {\n";

indent_hint += "\t";
Expand Down

0 comments on commit 8cbfd30

Please sign in to comment.