From 72daec4e1bca9d9d13ca280e312b21b903c54d94 Mon Sep 17 00:00:00 2001 From: josteph Date: Fri, 15 Jun 2018 18:01:14 +0000 Subject: [PATCH] help: Prevent line breaks within the "Required XP: 80" block by using non-breaking spaces. --- src/font/constants.cpp | 1 + src/font/constants.hpp | 1 + src/help/help_topic_generators.cpp | 17 ++++++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/font/constants.cpp b/src/font/constants.cpp index d6f03b3facf2..a05c37087d0e 100644 --- a/src/font/constants.cpp +++ b/src/font/constants.cpp @@ -33,6 +33,7 @@ const std::size_t max_text_line_width = 4096; const std::string ellipsis = "...", + nbsp = " ", // non-breaking space; unicode u00a0 unicode_minus = "-", unicode_en_dash = "–", // unicode u2013 diff --git a/src/font/constants.hpp b/src/font/constants.hpp index 5560fb6b38ec..55126263ac0f 100644 --- a/src/font/constants.hpp +++ b/src/font/constants.hpp @@ -37,6 +37,7 @@ extern const std::size_t max_text_line_width; // String constants extern const std::string ellipsis, + nbsp, unicode_minus, unicode_en_dash, diff --git a/src/help/help_topic_generators.cpp b/src/help/help_topic_generators.cpp index e7b7cb1eb5cb..b870346eda04 100644 --- a/src/help/help_topic_generators.cpp +++ b/src/help/help_topic_generators.cpp @@ -505,20 +505,23 @@ std::string unit_topic_generator::operator()() const { // Print some basic information such as HP and movement points. // TODO: Make this info update according to musthave traits, similar to movetype below. - ss << _("HP: ") << type_.hitpoints() << jump(30) - << _("Moves: ") << type_.movement() << jump(30); + ss << _("HP:") << font::nbsp << type_.hitpoints() << jump(30) + << _("Moves:") << font::nbsp << type_.movement() << jump(30); if (type_.vision() != type_.movement()) { - ss << _("Vision: ") << type_.vision() << jump(30); + ss << _("Vision:") << font::nbsp << type_.vision() << jump(30); } if (type_.jamming() > 0) { - ss << _("Jamming: ") << type_.jamming() << jump(30); + ss << _("Jamming:") << font::nbsp << type_.jamming() << jump(30); } - ss << _("Cost: ") << type_.cost() << jump(30) - << _("Alignment: ") + ss << _("Cost:") << font::nbsp << type_.cost() << jump(30) + << _("Alignment:") << font::nbsp << make_link(type_.alignment_description(type_.alignment(), type_.genders().front()), "time_of_day") << jump(30); if (type_.can_advance()) { - ss << _("Required XP: ") << type_.experience_needed(); + // TRANSLATORS: This string is used in the help page of a single unit. It uses + // non-breaking spaces to prevent unpleasant line breaks (issue #3256). In the + // translation use non-breaking spaces as appropriate for the target language. + ss << _("Required\u00a0XP:") << font::nbsp << type_.experience_needed(); } // Print the detailed description about the unit.