Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Template for new versions:
## New Features

## Fixes
- ``Units::getReadableName`` will no longer append a comma to the names of histfigs with no profession

## Misc Improvements

Expand Down
8 changes: 5 additions & 3 deletions library/modules/Units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,14 +1161,16 @@ static string formatReadableName(T *unit_or_hf, const string &prof_name, bool sk
if (native_name.empty())
return prof_name;

std::string prof_suffix{ (prof_name.size() > 0) ? (", " + prof_name) : "" };

if (skip_english)
return native_name + ", " + prof_name;
return native_name + prof_suffix;

string english_name = Translation::translateName(visible_name, true, true);
if (english_name.empty())
return native_name + ", " + prof_name;
return native_name + prof_suffix;

return native_name + " \"" + english_name + "\", " + prof_name;
return native_name + " \"" + english_name + "\"" + prof_suffix;
}

string Units::getReadableName(df::historical_figure *hf, bool skip_english) {
Expand Down