From ba4f3a70b688a5d1358d2b0a0a4744580aaec9c3 Mon Sep 17 00:00:00 2001 From: Steve Cotton Date: Tue, 27 Aug 2019 06:40:27 +0200 Subject: [PATCH] Use multiple lines for help, and add translation notes This removes all of the "do not translate part^string part" strings, replacing them with more help in English and a place for translators to explain what the untranslatable "all" means. For commands where the usage has notes about the arguments, this embeds the \n in the strings passed to register_command; that seems a reasonable balance between usability and effort to implement it. Cherry-picking between 1.14 and 1.15: In 1.14.x, the "droid" command only has options "on" and "off". The "full" option was only added in 1.15. --- changelog.md | 2 ++ src/map_command_handler.hpp | 19 ++++++++++++++----- src/menu_events.cpp | 12 +++++++++--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index 9ce9e096a402..61c307512eac 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,8 @@ ### Language and i18n * Updated translations: French, Portuguese (Brazil) * Set up for translating the Wings of Victory campaign (PR#4265) + * Changed the :help command's output to split over multiple lines + * Added translatable explanations of :droid, :help and :idle's arguments ## Version 1.15.1 ### Editor diff --git a/src/map_command_handler.hpp b/src/map_command_handler.hpp index b41798731f40..02f601404fb4 100644 --- a/src/map_command_handler.hpp +++ b/src/map_command_handler.hpp @@ -215,7 +215,10 @@ class map_command_handler register_command("help", &map_command_handler::help, _("Available commands list and command-specific help. " "Use \"help all\" to include currently unavailable commands."), - _("do not translate the 'all'^[all|]")); + // TRANSLATORS: These are the arguments accepted by the "help" command, + // which are either "all" or the name of another command. + // As with the command's name, "all" is hardcoded, and shouldn't change in the translation. + _("[all|]\n“all” = overview of all commands, = name of a specific command (provides more detail)")); } //derived classes initialize the map overriding this function virtual void init_map() = 0; @@ -323,15 +326,21 @@ class map_command_handler ss << _(" No help available."); } else { - ss << " - " << c->help; + ss << " - " << c->help << "\n"; } if (!c->usage.empty()) { - ss << " " << _("Usage:") << " " << cmd_prefix_ << cmd << " " << c->usage; + ss << _("Usage:") << " " << cmd_prefix_ << cmd << " " << c->usage << "\n"; + } + const auto flags_description = get_command_flags_description(*c); + if (!flags_description.empty()) { + // This shares the objectives dialog's translation of "Notes:" + ss << _("Notes:") << " " << get_command_flags_description(*c) << "\n"; } - ss << get_command_flags_description(*c); const std::vector l = get_aliases(cmd); if (!l.empty()) { - ss << " (" << _("aliases:") << " " << utils::join(l, " ") << ")"; + // TRANSLATORS: alternative names for command-line commands, only shown if + // there is at least one of them. + ss << _n("command^Alias:", "Aliases:", l.size()) << " " << utils::join(l, " ") << "\n"; } print(_("help"), ss.str()); } diff --git a/src/menu_events.cpp b/src/menu_events.cpp index 7b04530fea61..37adb38161dd 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -1188,9 +1188,15 @@ class console_handler : public map_command_handler, private cha register_command("refresh", &console_handler::do_refresh, _("Refresh gui.")); register_command("droid", &console_handler::do_droid, _("Switch a side to/from AI control."), - _("do not translate the on/off/full^[ [on/off/full]]")); + // TRANSLATORS: These are the arguments accepted by the "droid" command, + // which must be a side-number and then optionally one of "on", "off" or "full". + // As with the command's name, "on", "off" and "full" are hardcoded, and shouldn't change in the translation. + _("[ [on/off/full]]\n“on” = enable but retain vision, “full” = as if it’s controlled by another player")); register_command("idle", &console_handler::do_idle, _("Switch a side to/from idle state."), - _("do not translate the on/off^[ [on/off]]")); + // TRANSLATORS: These are the arguments accepted by the "idle" command, + // which must be a side-number and then optionally "on" or "off". + // As with the command's name, "on" and "off" are hardcoded, and shouldn't change in the translation. + _("command_idle^[ [on/off]]")); register_command("theme", &console_handler::do_theme); register_command("control", &console_handler::do_control, _("Assign control of a side to a different player or observer."), _(" "), "N"); @@ -1200,7 +1206,7 @@ class console_handler : public map_command_handler, private cha register_command("foreground", &console_handler::do_foreground, _("Debug foreground terrain."), "", "D"); register_command( "layers", &console_handler::do_layers, _("Debug layers from terrain under the mouse."), "", "D"); - register_command("fps", &console_handler::do_fps, _("Show fps.")); + register_command("fps", &console_handler::do_fps, _("Show fps (Frames Per Second).")); register_command("benchmark", &console_handler::do_benchmark); register_command("save", &console_handler::do_save, _("Save game.")); register_alias("save", "w");