<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40043 >

This removes wordwrap_string() in command line handling, adding a TRANS
comment tell translators the width.

It was amusing to discover that civmanual used it for html.  That's silly.
By definition, html always handles localized wrapping itself!

Still to do, specific clients....

Index: server/stdinhand.c
===================================================================
--- server/stdinhand.c  (revision 14283)
+++ server/stdinhand.c  (working copy)
@@ -29,7 +29,6 @@
 #endif
 #endif
 
-#include "astring.h"
 #include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
@@ -1518,22 +1517,23 @@
 
   if (op->short_help) {
     cmd_reply(help_cmd, caller, C_COMMENT,
-             "%s %s  -  %s", _("Option:"), op->name, _(op->short_help));
+             /* TRANS: <untranslated name> - translated short help */
+             "Option: %s  -  %s",
+             op->name,
+             _(op->short_help));
   } else {
     cmd_reply(help_cmd, caller, C_COMMENT,
-             "%s %s", _("Option:"), op->name);
+             /* TRANS: <untranslated name> */
+             "Option: %s",
+             op->name);
   }
 
   if(op->extra_help && strcmp(op->extra_help,"")!=0) {
-    static struct astring abuf = ASTRING_INIT;
     const char *help = _(op->extra_help);
 
-    astr_minsize(&abuf, strlen(help)+1);
-    strcpy(abuf.str, help);
-    wordwrap_string(abuf.str, 76);
     cmd_reply(help_cmd, caller, C_COMMENT, _("Description:"));
     cmd_reply_prefix(help_cmd, caller, C_COMMENT,
-                    "  ", "  %s", abuf.str);
+                    "  ", "  %s", help);
   }
   cmd_reply(help_cmd, caller, C_COMMENT,
            _("Status: %s"), (setting_is_changeable(id)
@@ -3832,6 +3832,7 @@
 {
   /* This is formated like extra_help entries for settings and commands: */
   const char *help =
+    /* TRANS: line break width 68 */
     _("Welcome - this is the introductory help text for the Freeciv 
server.\n\n"
       "Two important server concepts are Commands and Options.\n"
       "Commands, such as 'help', are used to interact with the server.\n"
@@ -3847,12 +3848,7 @@
       "  save   -  to save the current game\n"
       "  quit   -  to exit");
 
-  static struct astring abuf = ASTRING_INIT;
-      
-  astr_minsize(&abuf, strlen(help)+1);
-  strcpy(abuf.str, help);
-  wordwrap_string(abuf.str, 78);
-  cmd_reply(help_cmd, caller, C_COMMENT, abuf.str);
+  cmd_reply(help_cmd, caller, C_COMMENT, help);
 }
 
 /**************************************************************************
@@ -3867,10 +3863,15 @@
   
   if (cmd->short_help) {
     cmd_reply(help_cmd, caller, C_COMMENT,
-             "%s %s  -  %s", _("Command:"), cmd->name, _(cmd->short_help));
+             /* TRANS: <untranslated name> - translated short help */
+             "Command: %s  -  %s",
+             cmd->name,
+             _(cmd->short_help));
   } else {
     cmd_reply(help_cmd, caller, C_COMMENT,
-             "%s %s", _("Command:"), cmd->name);
+             /* TRANS: <untranslated name> */
+             "Command: %s",
+             cmd->name);
   }
   if (cmd->synopsis) {
     /* line up the synopsis lines: */
@@ -3885,15 +3886,11 @@
   cmd_reply(help_cmd, caller, C_COMMENT,
            _("Level: %s"), cmdlevel_name(cmd->level));
   if (cmd->extra_help) {
-    static struct astring abuf = ASTRING_INIT;
     const char *help = _(cmd->extra_help);
       
-    astr_minsize(&abuf, strlen(help)+1);
-    strcpy(abuf.str, help);
-    wordwrap_string(abuf.str, 76);
     cmd_reply(help_cmd, caller, C_COMMENT, _("Description:"));
     cmd_reply_prefix(help_cmd, caller, C_COMMENT, "  ",
-                    "  %s", abuf.str);
+                    "  %s", help);
   }
 }
 
Index: manual/civmanual.c
===================================================================
--- manual/civmanual.c  (revision 14283)
+++ manual/civmanual.c  (working copy)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "astring.h"
 #include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
@@ -128,17 +127,13 @@
       fprintf(doc, _("<h1>Freeciv %s server options</h1>\n\n"), 
VERSION_STRING);
       for (i = 0; settings[i].name; i++) {
         struct settings_s *op = &settings[i];
-        static struct astring abuf = ASTRING_INIT;
         const char *help = _(op->extra_help);
 
-        astr_minsize(&abuf, strlen(help) + 10);
-        strcpy(abuf.str, help);
-        wordwrap_string(abuf.str, 76);
         fprintf(doc, SEPARATOR);
         fprintf(doc, "%s%s - %s%s\n\n", SECTION_BEGIN, op->name,
                 _(op->short_help), SECTION_END);
         if (strlen(op->extra_help) > 0) {
-          fprintf(doc, "<pre>%s</pre>\n\n", abuf.str);
+          fprintf(doc, "<pre>%s</pre>\n\n", help);
         }
         fprintf(doc, "<p class=\"misc\">");
         fprintf(doc, _("Level: %s.<br>"), _(sset_level_names[op->slevel]));
@@ -202,14 +197,10 @@
         fprintf(doc, _("<p class=\"level\">Level: %s</p>\n\n"),
                 cmdlevel_name(cmd->level));
         if (cmd->extra_help) {
-          static struct astring abuf = ASTRING_INIT;
           const char *help = _(cmd->extra_help);
 
-          astr_minsize(&abuf, strlen(help)+1);
-          strcpy(abuf.str, help);
-          wordwrap_string(abuf.str, 76);
           fprintf(doc, _("<p>Description:</p>\n\n"));
-          fprintf(doc, "<pre>%s</pre>\n\n", abuf.str);
+          fprintf(doc, "<pre>%s</pre>\n\n", help);
         }
       }
       break;
Index: client/helpdata.c
===================================================================
--- client/helpdata.c   (revision 14283)
+++ client/helpdata.c   (working copy)
@@ -426,7 +426,6 @@
            /* TRANS: preserve single space at beginning */
            pitem->topic = mystrdup(_(" Rivers"));
            sz_strlcpy(long_buffer, _(terrain_control.river_help_text));
-           wordwrap_string(long_buffer, 68);
            pitem->text = mystrdup(long_buffer);
            help_list_append(category_nodes, pitem);
          }
@@ -495,7 +494,6 @@
     }
     free(paras);
     paras = NULL;
-    wordwrap_string(long_buffer, 68);
     pitem->text=mystrdup(long_buffer);
     help_list_append(help_nodes, pitem);
   }
@@ -707,8 +705,6 @@
   if (user_text && user_text[0] != '\0') {
     cat_snprintf(buf, bufsz, "\n\n%s", user_text);
   }
-
-  wordwrap_string(buf, 68);
   return buf;
 }
 
@@ -1108,7 +1104,6 @@
     cat_snprintf(buf, bufsz, "%s\n\n", _(utype->helptext));
   }
   CATLSTR(buf, bufsz, user_text);
-  wordwrap_string(buf, 68);
   return buf;
 }
 
@@ -1255,7 +1250,6 @@
     CATLSTR(buf, bufsz, "\n\n");
     CATLSTR(buf, bufsz, user_text);
   }
-  wordwrap_string(buf, 68);
 }
 
 /****************************************************************
@@ -1655,7 +1649,6 @@
   } unit_type_iterate_end;
 
   CATLSTR(buf, bufsz, user_text);
-  wordwrap_string(buf, 68);
 }
 
 /****************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to