]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ja/i18n-common-messages'
authorJunio C Hamano <gitster@pobox.com>
Fri, 25 Feb 2022 23:47:35 +0000 (15:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Feb 2022 23:47:35 +0000 (15:47 -0800)
Unify more messages to help l10n.

* ja/i18n-common-messages:
  i18n: fix some misformated placeholders in command synopsis
  i18n: remove from i18n strings that do not hold translatable parts
  i18n: factorize "invalid value" messages
  i18n: factorize more 'incompatible options' messages

17 files changed:
1  2 
builtin/am.c
builtin/blame.c
builtin/fetch.c
builtin/hash-object.c
builtin/log.c
builtin/pack-objects.c
builtin/pull.c
builtin/rebase.c
builtin/reflog.c
builtin/sparse-checkout.c
builtin/submodule--helper.c
diff-merges.c
gpg-interface.c
parse-options.c
parse-options.h
sequencer.c
submodule-config.c

diff --cc builtin/am.c
Simple merge
diff --cc builtin/blame.c
Simple merge
diff --cc builtin/fetch.c
Simple merge
Simple merge
diff --cc builtin/log.c
Simple merge
Simple merge
diff --cc builtin/pull.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc diff-merges.c
Simple merge
diff --cc gpg-interface.c
Simple merge
diff --cc parse-options.c
index 2437ad3bcdd5b6ff06bf3f46fb00a1106958cca3,276e3911a743cf74bdb4cf86b451b24cb869408f..6e57744fd22eeab78a71b915e9d0be3becd8e152
@@@ -1080,15 -1080,36 +1080,49 @@@ void NORETURN usage_msg_opt(const char 
        usage_with_options(usagestr, options);
  }
  
 +void NORETURN usage_msg_optf(const char * const fmt,
 +                           const char * const *usagestr,
 +                           const struct option *options, ...)
 +{
 +      struct strbuf msg = STRBUF_INIT;
 +      va_list ap;
 +      va_start(ap, options);
 +      strbuf_vaddf(&msg, fmt, ap);
 +      va_end(ap);
 +
 +      usage_msg_opt(msg.buf, usagestr, options);
 +}
++
+ void die_for_incompatible_opt4(int opt1, const char *opt1_name,
+                              int opt2, const char *opt2_name,
+                              int opt3, const char *opt3_name,
+                              int opt4, const char *opt4_name)
+ {
+       int count = 0;
+       const char *options[4];
+       if (opt1)
+               options[count++] = opt1_name;
+       if (opt2)
+               options[count++] = opt2_name;
+       if (opt3)
+               options[count++] = opt3_name;
+       if (opt4)
+               options[count++] = opt4_name;
+       switch (count) {
+       case 4:
+               die(_("options '%s', '%s', '%s', and '%s' cannot be used together"),
+                   opt1_name, opt2_name, opt3_name, opt4_name);
+               break;
+       case 3:
+               die(_("options '%s', '%s', and '%s' cannot be used together"),
+                   options[0], options[1], options[2]);
+               break;
+       case 2:
+               die(_("options '%s' and '%s' cannot be used together"),
+                   options[0], options[1]);
+               break;
+       default:
+               break;
+       }
+ }
diff --cc parse-options.h
index 659a4c28b2d2afa515a1efb0a75843b538fad498,f773cc7859faad929a3fd6ba99aca39303c57186..685fccac137fc23884f0e816d53b7be549506441
@@@ -230,16 -225,22 +230,32 @@@ NORETURN void usage_msg_opt(const char 
                            const char * const *usagestr,
                            const struct option *options);
  
 +/**
 + * usage_msg_optf() is like usage_msg_opt() except that the first
 + * argument is a format string, and optional format arguments follow
 + * after the 3rd option.
 + */
 +__attribute__((format (printf,1,4)))
 +void NORETURN usage_msg_optf(const char *fmt,
 +                           const char * const *usagestr,
 +                           const struct option *options, ...);
 +
+ void die_for_incompatible_opt4(int opt1, const char *opt1_name,
+                              int opt2, const char *opt2_name,
+                              int opt3, const char *opt3_name,
+                              int opt4, const char *opt4_name);
+ static inline void die_for_incompatible_opt3(int opt1, const char *opt1_name,
+                                            int opt2, const char *opt2_name,
+                                            int opt3, const char *opt3_name)
+ {
+       die_for_incompatible_opt4(opt1, opt1_name,
+                                 opt2, opt2_name,
+                                 opt3, opt3_name,
+                                 0, "");
+ }
  /*
   * Use these assertions for callbacks that expect to be called with NONEG and
   * NOARG respectively, and do not otherwise handle the "unset" and "arg"
diff --cc sequencer.c
Simple merge
Simple merge