Replace syntactical keywords in error/warning messages by printf directives. 20140222030507/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 21 Feb 2014 09:06:00 +0000 (10:06 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 21 Feb 2014 09:06:00 +0000 (10:06 +0100)
A number of translators are still making the mistake of translating syntax
keywords in messages (such as "REPEAT") into thier literal equivalents in
the target language.  This change avoids the posibility of that mistake,
by removing the keywords from the translatable string.

22 files changed:
src/data/file-name.c
src/language/command.c
src/language/control/do-if.c
src/language/control/repeat.c
src/language/data-io/data-list.c
src/language/data-io/data-reader.c
src/language/data-io/get-data.c
src/language/data-io/inpt-pgm.c
src/language/data-io/print-space.c
src/language/data-io/print.c
src/language/data-io/save-translate.c
src/language/expressions/parse.c
src/language/lexer/value-parser.c
src/language/stats/factor.c
src/language/stats/flip.c
src/language/stats/npar.c
src/language/stats/rank.c
src/language/stats/t-test-parser.c
src/language/utilities/date.c
src/language/utilities/host.c
src/language/utilities/permissions.c
src/language/xforms/recode.c

index 9eeb4b1cfc06309e45c0777ef1277aa0fbeb4894..fa0eb794010f75b9b2666334c08b827422ed04bd 100644 (file)
@@ -170,7 +170,7 @@ fn_getenv_default (const char *key, const char *def)
 static FILE *
 safety_violation (const char *fn)
 {
-  msg (SE, _("Not opening pipe file `%s' because SAFER option set."), fn);
+  msg (SE, _("Not opening pipe file `%s' because %s option set."), fn, "SAFER");
   errno = EPERM;
   return NULL;
 }
index 78fd5f00b00fe6cba1bd77806ac976c7fd2fedcd..76377035886b26e97dae5ad0222e660e91c411ef 100644 (file)
@@ -385,11 +385,11 @@ report_state_mismatch (const struct command *command, enum cmd_state state)
                      "been defined."), command->name);
           break;
         case S_INPUT_PROGRAM:
-          msg (SE, _("%s is allowed only inside INPUT PROGRAM."),
-               command->name);
+          msg (SE, _("%s is allowed only inside %s."),
+               command->name, "INPUT PROGRAM");
           break;
         case S_FILE_TYPE:
-          msg (SE, _("%s is allowed only inside FILE TYPE."), command->name);
+          msg (SE, _("%s is allowed only inside %s."), command->name, "FILE TYPE");
           break;
 
           /* Two allowed states. */
@@ -412,7 +412,8 @@ report_state_mismatch (const struct command *command, enum cmd_state state)
               command->name, "FILE TYPE");
           break;
         case S_INPUT_PROGRAM | S_FILE_TYPE:
-          msg (SE, _("%s is allowed only inside INPUT PROGRAM or inside FILE TYPE."), command->name);
+          msg (SE, _("%s is allowed only inside %s or inside %s."), command->name, 
+              "INPUT PROGRAM", "FILE TYPE");
           break;
 
           /* Three allowed states. */
@@ -525,7 +526,7 @@ cmd_erase (struct lexer *lexer, struct dataset *ds UNUSED)
 
   if (settings_get_safer_mode ())
     {
-      msg (SE, _("This command not allowed when the SAFER option is set."));
+      msg (SE, _("This command not allowed when the %s option is set."), "SAFER");
       return CMD_FAILURE;
     }
 
index a44f6e81896f2efb528eeb6c01e20f944c62f4d0..6b6dc16d4de600362035e9d39c35afa1f0e5e456 100644 (file)
@@ -174,7 +174,7 @@ must_not_have_else (struct do_if_trns *do_if)
 {
   if (has_else (do_if))
     {
-      msg (SE, _("This command may not follow ELSE in DO IF...END IF."));
+      msg (SE, _("This command may not follow %s in %s ... %s."), "ELSE", "DO IF", "END IF");
       return false;
     }
   else
index b2c2bb413e501bda41721c95b8ded972fd02950b..c2e136cf41af10762d5e8719e07593f28a4d006e 100644 (file)
@@ -439,6 +439,6 @@ parse_strings (struct lexer *lexer, struct dummy_var *dv)
 int
 cmd_end_repeat (struct lexer *lexer UNUSED, struct dataset *ds UNUSED)
 {
-  msg (SE, _("No matching DO REPEAT."));
+  msg (SE, _("No matching %s."), "DO REPEAT");
   return CMD_CASCADING_FAILURE;
 }
index 834a2f8d7f7a1fe72b9970ba99c470c1b64a443b..f68b2e1b4d058e2f71585b5742d8ad98e1baa8dc 100644 (file)
@@ -138,13 +138,12 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds)
        {
           if (!in_input_program ())
             {
-              msg (SE, _("The END subcommand may only be used within "
-                         "INPUT PROGRAM."));
+              msg (SE, _("The %s subcommand may only be used within %s."), "END", "INPUT PROGRAM");
               goto error;
             }
          if (end)
            {
-             msg (SE, _("The END subcommand may only be specified once."));
+             msg (SE, _("The %s subcommand may only be specified once."), "END");
              goto error;
            }
 
@@ -252,7 +251,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds)
 
   if (type != DP_FIXED && end != NULL)
     {
-      msg (SE, _("The END subcommand may be used only with DATA LIST FIXED."));
+      msg (SE, _("The %s subcommand may be used only with %s."), "END", "DATA LIST FIXED");
       goto error;
     }
 
index 14cb57d77a8597de6ac6d8cc7d420fd0d08e9f85..c28fa0700efbfd239a58cf64bc570938a45395ee 100644 (file)
@@ -236,11 +236,11 @@ read_inline_record (struct dfm_reader *r)
     {
       if (!lex_match_id (r->lexer, "END") || !lex_match_id (r->lexer, "DATA"))
         {
-          msg (SE, _("Missing END DATA while reading inline data.  "
+          msg (SE, _("Missing %s while reading inline data.  "
                      "This probably indicates a missing or incorrectly "
-                     "formatted END DATA command.  END DATA must appear "
+                     "formatted %s command.  %s must appear "
                      "by itself on a single line with exactly one space "
-                     "between words."));
+                     "between words."), "END DATA", "END DATA", "END DATA");
           lex_discard_rest_of_command (r->lexer);
         }
       return false;
@@ -573,7 +573,7 @@ dfm_eof (struct dfm_reader *r)
             msg (ME, _("Attempt to read beyond end-of-file on file %s."),
                  fh_get_name (r->fh));
           else
-            msg (ME, _("Attempt to read beyond END DATA."));
+            msg (ME, _("Attempt to read beyond %s."), "END DATA");
         }
     }
 
index 2738cb29f1a277bd73cacdeb427b303c27eb41b3..e6d5eac9f6ec12335fa63a51f66d41072e547414 100644 (file)
@@ -433,7 +433,7 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds)
             goto error;
           if (lex_integer (lexer) < 1)
             {
-              msg (SE, _("Value of FIRSTCASE must be 1 or greater."));
+              msg (SE, _("Value of %s must be 1 or greater."), "FIRSTCASE");
               goto error;
             }
           data_parser_set_skip (parser, lex_integer (lexer) - 1);
@@ -471,7 +471,7 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds)
             goto error;
           if (lex_integer (lexer) < 1)
             {
-              msg (SE, _("Value of FIXCASE must be at least 1."));
+              msg (SE, _("Value of %s must be 1 or greater."), "FIXCASE");
               goto error;
             }
           data_parser_set_records (parser, lex_integer (lexer));
@@ -491,7 +491,7 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds)
                 goto error;
               if (lex_integer (lexer) < 1)
                 {
-                  msg (SE, _("Value of FIRST must be at least 1."));
+                  msg (SE, _("Value of %s must be 1 or greater."), "FIRST");
                   goto error;
                 }
               data_parser_set_case_limit (parser, lex_integer (lexer));
@@ -503,7 +503,7 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds)
                 goto error;
               if (lex_integer (lexer) < 1 || lex_integer (lexer) > 100)
                 {
-                  msg (SE, _("Value of PERCENT must be between 1 and 100."));
+                  msg (SE, _("Value of %s must be between 1 and 100."), "PERCENT");
                   goto error;
                 }
               data_parser_set_case_percent (parser, lex_integer (lexer));
index 0301d7d057aa77ca000a36abc51937ab638d982e..b9488f17f47604bcfd92ac9c80c4a79dda9a132c 100644 (file)
@@ -130,7 +130,7 @@ cmd_input_program (struct lexer *lexer, struct dataset *ds)
               && lex_get_error_mode (lexer) != LEX_ERROR_TERMINAL)
             {
               if (result == CMD_EOF)
-                msg (SE, _("Unexpected end-of-file within INPUT PROGRAM."));
+                msg (SE, _("Unexpected end-of-file within %s."), "INPUT PROGRAM");
               inside_input_program = false;
               destroy_input_program (inp);
               return result;
@@ -143,7 +143,7 @@ cmd_input_program (struct lexer *lexer, struct dataset *ds)
 
   if (!saw_DATA_LIST && !saw_END_FILE)
     {
-      msg (SE, _("Input program must contain DATA LIST or END FILE."));
+      msg (SE, _("Input program must contain %s or %s."), "DATA LIST", "END FILE");
       destroy_input_program (inp);
       return CMD_FAILURE;
     }
index adeb92ba5b656f7391dd75bc1736469d59c00dd7..9f27da80f495b396bfebebab7c210de952a593cc 100644 (file)
@@ -124,10 +124,10 @@ print_space_trns_proc (void *t_, struct ccase **c,
     {
       double f = expr_evaluate_num (trns->expr, *c, case_num);
       if (f == SYSMIS)
-        msg (SW, _("The expression on PRINT SPACE evaluated to the "
-                   "system-missing value."));
+        msg (SW, _("The expression on %s evaluated to the "
+                   "system-missing value."), "PRINT SPACE");
       else if (f < 0 || f > INT_MAX)
-        msg (SW, _("The expression on PRINT SPACE evaluated to %g."), f);
+        msg (SW, _("The expression on %s evaluated to %g."), "PRINT SPACE", f);
       else
         n = f;
     }
index e2c5adc073168c8a2eb74b6cad19c1318157463d..7781a317b6a872fd2e15faf4062f7fad2f0ad1fa 100644 (file)
@@ -220,7 +220,7 @@ internal_cmd_print (struct lexer *lexer, struct dataset *ds,
     }
   if (binary && fh == NULL)
     {
-      msg (SE, _("OUTFILE is required when binary formats are specified."));
+      msg (SE, _("%s is required when binary formats are specified."), "OUTFILE");
       goto error;
     }
 
index 6601f30b1833a3aa129fa5507b8f3ec24422a945..54b769ddee26cff951111d130bc507498ed51adf 100644 (file)
@@ -249,8 +249,8 @@ cmd_save_translate (struct lexer *lexer, struct dataset *ds)
     }
   else if (!replace && fn_exists (fh_get_file_name (handle)))
     {
-      msg (SE, _("Output file `%s' exists but REPLACE was not specified."),
-           fh_get_file_name (handle));
+      msg (SE, _("Output file `%s' exists but %s was not specified."),
+           fh_get_file_name (handle), "REPLACE");
       goto error;
     }
 
index 7b845a8d369ebf6da4b736db7c7028cc1ad9814b..b2c2cf8e2fa751a7df30520b4f4d63a06571c35b 100644 (file)
@@ -1298,7 +1298,7 @@ parse_function (struct lexer *lexer, struct expression *e)
   if ((f->flags & OPF_PERM_ONLY) &&
       proc_in_temporary_transformations (e->ds))
     {
-      msg (SE, _("%s may not appear after TEMPORARY."), f->prototype);
+      msg (SE, _("%s may not appear after %s."), f->prototype, "TEMPORARY");
       goto fail;
     }
 
index 65e34a348b86b41904b8eee9ac851c243666ae18..39f5eb68a9ffc6c881db6e83d99b00b8e5dc8ff5 100644 (file)
@@ -79,7 +79,7 @@ parse_num_range (struct lexer *lexer,
     {
       if (*x == LOWEST)
         {
-          msg (SE, _("LO or LOWEST must be part of a range."));
+          msg (SE, _("%s or %s must be part of a range."), "LO", "LOWEEST");
           return false;
         }
       *y = *x;
index fa9987332fb93bdbdfad55a6f3b58e2750e114a6..1ab2618dfe95f509f246817a289334bdb606d367 100644 (file)
@@ -1923,13 +1923,15 @@ do_factor (const struct cmd_factor *factor, struct casereader *r)
 
   if (idata->n_extractions == 0)
     {
-      msg (MW, _("The FACTOR criteria result in zero factors extracted. Therefore no analysis will be performed."));
+      msg (MW, _("The %s criteria result in zero factors extracted. Therefore no analysis will be performed."), "FACTOR");
       goto finish;
     }
 
   if (idata->n_extractions > factor->n_vars)
     {
-      msg (MW, _("The FACTOR criteria result in more factors than variables, which is not meaningful. No analysis will be performed."));
+      msg (MW, 
+          _("The %s criteria result in more factors than variables, which is not meaningful. No analysis will be performed."), 
+          "FACTOR");
       goto finish;
     }
     
index e1ae9330dd89ac143b399509abcbfc505edb0353..68152b1b190b4c90d8754205279f45e623ab75c3 100644 (file)
@@ -97,8 +97,8 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
   bool ok;
 
   if (proc_make_temporary_transformations_permanent (ds))
-    msg (SW, _("FLIP ignores TEMPORARY.  "
-               "Temporary transformations will be made permanent."));
+    msg (SW, _("%s ignores %s.  "
+               "Temporary transformations will be made permanent."), "FLIP", "TEMPORARY");
 
   flip = pool_create_container (struct flip_pgm, pool);
   flip->n_vars = 0;
@@ -148,7 +148,7 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
   flip->file = pool_create_temp_file (flip->pool);
   if (flip->file == NULL)
     {
-      msg (SE, _("Could not create temporary file for FLIP."));
+      msg (SE, _("Could not create temporary file for %s."), "FLIP");
       goto error;
     }
 
@@ -330,14 +330,14 @@ flip_file (struct flip_pgm *flip)
   input_file = flip->file;
   if (fseeko (input_file, 0, SEEK_SET) != 0)
     {
-      msg (SE, _("Error rewinding FLIP file: %s."), strerror (errno));
+      msg (SE, _("Error rewinding %s file: %s."), "FLIP", strerror (errno));
       return false;
     }
 
   output_file = pool_create_temp_file (flip->pool);
   if (output_file == NULL)
     {
-      msg (SE, _("Error creating FLIP source file."));
+      msg (SE, _("Error creating %s source file."), "FLIP");
       return false;
     }
 
@@ -350,9 +350,9 @@ flip_file (struct flip_pgm *flip)
       if (read_cases != fread (input_buf, case_bytes, read_cases, input_file))
         {
           if (ferror (input_file))
-            msg (SE, _("Error reading FLIP file: %s."), strerror (errno));
+            msg (SE, _("Error reading %s file: %s."), "FLIP", strerror (errno));
           else
-            msg (SE, _("Unexpected end of file reading FLIP file."));
+            msg (SE, _("Unexpected end of file reading %s file."), "FLIP");
           return false;
         }
 
@@ -368,7 +368,7 @@ flip_file (struct flip_pgm *flip)
                                            + (off_t) i * flip->n_cases),
                       SEEK_SET) != 0)
             {
-              msg (SE, _("Error seeking FLIP source file: %s."),
+              msg (SE, _("Error seeking %s source file: %s."), "FLIP",
                    strerror (errno));
               return false;
             }
@@ -376,7 +376,7 @@ flip_file (struct flip_pgm *flip)
          if (fwrite (output_buf, sizeof *output_buf, read_cases, output_file)
              != read_cases)
             {
-              msg (SE, _("Error writing FLIP source file: %s."),
+              msg (SE, _("Error writing %s source file: %s."), "FLIP",
                    strerror (errno));
               return false;
             }
@@ -391,7 +391,7 @@ flip_file (struct flip_pgm *flip)
 
   if (fseeko (output_file, 0, SEEK_SET) != 0)
     {
-      msg (SE, _("Error rewinding FLIP source file: %s."), strerror (errno));
+      msg (SE, _("Error rewinding %s source file: %s."), "FLIP", strerror (errno));
       return false;
     }
   flip->file = output_file;
@@ -422,10 +422,10 @@ flip_casereader_read (struct casereader *reader, void *flip_)
         {
           case_unref (c);
           if (ferror (flip->file))
-            msg (SE, _("Error reading FLIP temporary file: %s."),
+            msg (SE, _("Error reading %s temporary file: %s."), "FLIP",
                  strerror (errno));
           else if (feof (flip->file))
-            msg (SE, _("Unexpected end of file reading FLIP temporary file."));
+            msg (SE, _("Unexpected end of file reading %s temporary file."), "FLIP");
           else
             NOT_REACHED ();
           flip->error = true;
index fbcdeae058e1dd1c47abc8cdcab01c905496598b..019e958cb20818ffcfd3a1277fac6e57643818e1 100644 (file)
@@ -534,7 +534,7 @@ npar_execute (struct casereader *input,
       const struct npar_test *test = specs->test[t];
       if ( NULL == test->execute )
        {
-         msg (SW, _("NPAR subcommand not currently implemented."));
+         msg (SW, _("%s subcommand not currently implemented."), "NPAR");
          continue;
        }
       test->execute (ds, casereader_clone (input), specs->filter, test, specs->exact, specs->timer);
@@ -688,7 +688,7 @@ npar_runs (struct lexer *lexer, struct dataset *ds,
        }
       else
        {
-         lex_error (lexer, _("Expecting MEAN, MEDIAN, MODE or number"));
+         lex_error (lexer, _("Expecting %s, %s, %s or a number."), "MEAN", "MEDIAN", "MODE");
          return 0;
        }
                  
index a29a3fd11f7870a746b1d26c06d8a63eaae96690..5a849b8cf889cce5b45b5af08dd8d190c5f54a8f 100644 (file)
@@ -318,7 +318,7 @@ parse_into (struct lexer *lexer, struct rank *cmd,
          const char *name = lex_tokcstr (lexer);
 
          if ( var_count >= subcase_get_n_fields (&cmd->sc) )
-            msg (SE, _("Too many variables in INTO clause."));
+            msg (SE, _("Too many variables in %s clause."), "INTO");
          else if ( dict_lookup_var (cmd->dict, name) != NULL )
             msg (SE, _("Variable %s already exists."), name);
           else if (string_set_contains (new_names, name))
@@ -820,7 +820,7 @@ cmd_rank (struct lexer *lexer, struct dataset *ds)
     {
       int v;
 
-      tab_output_text (0, _("Variables Created By RANK"));
+      tab_output_text_format (0, _("Variables Created By %s"), "RANK");
       tab_output_text (0, "");
 
       for (i = 0 ; i <  rank.n_rs ; ++i )
index 3ce1d028f9221eba42bca6119f8ffcb64c269ea3..9e134e2a72372f79f7d57f59df04a102f402771a 100644 (file)
@@ -120,8 +120,8 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
 
          if ( cut == true && var_is_alpha (gvar))
            {
-             msg (SE, _("When applying GROUPS to a string variable, two "
-                        "values must be specified."));
+             msg (SE, _("When applying %s to a string variable, two "
+                        "values must be specified."), "GROUPS");
              goto parse_failed;
            }
        }
@@ -132,7 +132,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
 
          if (tt.n_vars > 0)
            {
-             msg (SE, _("VARIABLES subcommand may not be used with PAIRS."));
+             msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
              goto parse_failed;
            }
 
@@ -228,7 +228,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
        {
          if ( tt.mode == MODE_PAIRED)
            {
-             msg (SE, _("VARIABLES subcommand may not be used with PAIRS."));
+             msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
              goto parse_failed;
            }
 
index 3b754b4980efa902ce155bc4708ce93c7358242f..8afbe6562d9dc1c8b2fb9ef0345b9d1f91891c41 100644 (file)
@@ -30,6 +30,6 @@ cmd_use (struct lexer *lexer, struct dataset *ds UNUSED)
   if (lex_match (lexer, T_ALL))
     return CMD_SUCCESS;
 
-  msg (SW, _("Only USE ALL is currently implemented."));
+  msg (SW, _("Only %s is currently implemented."), "USE ALL");
   return CMD_FAILURE;
 }
index fbc9d208be7a08a1b4c518894f0e317d1413be5b..b01e621bf14e9bf7133ec4249f72af5f99c5ca13 100644 (file)
@@ -127,7 +127,7 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED)
 {
   if (settings_get_safer_mode ())
     {
-      msg (SE, _("This command not allowed when the SAFER option is set."));
+      msg (SE, _("This command not allowed when the %s option is set."), "SAFER");
       return CMD_FAILURE;
     }
 
index 2ea91de1dcbac0ed27ce267fade61e32b8b6c983..a52cd198aa2c8aa15d8698806f677124d38c696e 100644 (file)
@@ -102,7 +102,7 @@ change_permissions (const char *file_name, enum PER per)
 
   if (settings_get_safer_mode ())
     {
-      msg (SE, _("This command not allowed when the SAFER option is set."));
+      msg (SE, _("This command not allowed when the %s option is set."), "SAFER");
       return 0;
     }
 
index a1c2f7a4493a9413fff250e8d2bddfda488ded48..275408de90e7d8a3dbd3fde47628d3ac540d3e27 100644 (file)
@@ -336,7 +336,7 @@ parse_map_in (struct lexer *lexer, struct map_in *in, struct pool *pool,
          if (lex_token (lexer) == T_ID
              && lex_id_match (ss_cstr ("THRU"), lex_tokss (lexer)))
            {
-             msg (SE, _("THRU is not allowed with string variables."));
+             msg (SE, _("%s is not allowed with string variables."), "THRU");
              return false;
            }
        }