From 62343fbb9c2ff9d0dce2c43e2f8a2cb88106d5ac Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Thu, 3 Jul 2025 07:53:57 -0500 Subject: [PATCH] `Units::getReadableName`: do not add commas to histfigs with no profession fixes #5474 --- docs/changelog.txt | 1 + library/modules/Units.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 539b2c2240..25e4e639b3 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -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 diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 744a3979af..90fb8b593a 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -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) {