@@ -66,12 +66,14 @@ typedef int parse_opt_ll_cb(struct parse_opt_ctx_t *ctx,
6666 *
6767 * `argh`::
6868 * token to explain the kind of argument this option wants. Keep it
69- * homogeneous across the repository.
69+ * homogeneous across the repository. Should be wrapped by N_() for
70+ * translation.
7071 *
7172 * `help`::
7273 * the short help associated to what the option does.
7374 * Must never be NULL (except for OPTION_END).
7475 * OPTION_GROUP uses this pointer to store the group header.
76+ * Should be wrapped by N_() for translation.
7577 *
7678 * `flags`::
7779 * mask of parse_opt_option_flags.
@@ -128,37 +130,38 @@ struct option {
128130#define OPT_BOOL (s , l , v , h ) OPT_SET_INT(s, l, v, h, 1)
129131#define OPT_SET_PTR (s , l , v , h , p ) { OPTION_SET_PTR, (s), (l), (v), NULL, \
130132 (h), PARSE_OPT_NOARG, NULL, (p) }
131- #define OPT_INTEGER (s , l , v , h ) { OPTION_INTEGER, (s), (l), (v), "n", (h) }
133+ #define OPT_INTEGER (s , l , v , h ) { OPTION_INTEGER, (s), (l), (v), N_( "n") , (h) }
132134#define OPT_STRING (s , l , v , a , h ) { OPTION_STRING, (s), (l), (v), (a), (h) }
133135#define OPT_STRING_LIST (s , l , v , a , h ) \
134136 { OPTION_CALLBACK, (s), (l), (v), (a), \
135137 (h), 0, &parse_opt_string_list }
136138#define OPT_UYN (s , l , v , h ) { OPTION_CALLBACK, (s), (l), (v), NULL, \
137139 (h), PARSE_OPT_NOARG, &parse_opt_tertiary }
138140#define OPT_DATE (s , l , v , h ) \
139- { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
141+ { OPTION_CALLBACK, (s), (l), (v), N_( "time") ,(h), 0, \
140142 parse_opt_approxidate_cb }
141143#define OPT_CALLBACK (s , l , v , a , h , f ) \
142144 { OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
143145#define OPT_NUMBER_CALLBACK (v , h , f ) \
144146 { OPTION_NUMBER, 0, NULL, (v), NULL, (h), \
145147 PARSE_OPT_NOARG | PARSE_OPT_NONEG, (f) }
146148#define OPT_FILENAME (s , l , v , h ) { OPTION_FILENAME, (s), (l), (v), \
147- "file", (h) }
149+ N_( "file") , (h) }
148150#define OPT_COLOR_FLAG (s , l , v , h ) \
149- { OPTION_CALLBACK, (s), (l), (v), "when", (h), PARSE_OPT_OPTARG, \
151+ { OPTION_CALLBACK, (s), (l), (v), N_( "when") , (h), PARSE_OPT_OPTARG, \
150152 parse_opt_color_flag_cb, (intptr_t)"always" }
151153
152154#define OPT_NOOP_NOARG (s , l ) \
153155 { OPTION_CALLBACK, (s), (l), NULL, NULL, \
154- "no-op (backward compatibility)", \
156+ N_( "no-op (backward compatibility)"), \
155157 PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, parse_opt_noop_cb }
156158
157159/* Deprecated synonym */
158160#define OPT_BOOLEAN OPT_COUNTUP
159161
160162/* parse_options() will filter out the processed options and leave the
161- * non-option arguments in argv[].
163+ * non-option arguments in argv[]. usagestr strings should be marked
164+ * for translation with N_().
162165 * Returns the number of arguments left in argv[].
163166 */
164167extern int parse_options (int argc , const char * * argv , const char * prefix ,
@@ -222,15 +225,15 @@ extern int parse_opt_noop_cb(const struct option *, const char *, int);
222225#define OPT__VERBOSE (var , h ) OPT_BOOLEAN('v', "verbose", (var), (h))
223226#define OPT__QUIET (var , h ) OPT_BOOLEAN('q', "quiet", (var), (h))
224227#define OPT__VERBOSITY (var ) \
225- { OPTION_CALLBACK, 'v', "verbose", (var), NULL, "be more verbose", \
228+ { OPTION_CALLBACK, 'v', "verbose", (var), NULL, N_( "be more verbose") , \
226229 PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }, \
227- { OPTION_CALLBACK, 'q', "quiet", (var), NULL, "be more quiet", \
230+ { OPTION_CALLBACK, 'q', "quiet", (var), NULL, N_( "be more quiet") , \
228231 PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }
229232#define OPT__DRY_RUN (var , h ) OPT_BOOLEAN('n', "dry-run", (var), (h))
230233#define OPT__FORCE (var , h ) OPT_BOOLEAN('f', "force", (var), (h))
231234#define OPT__ABBREV (var ) \
232- { OPTION_CALLBACK, 0, "abbrev", (var), "n", \
233- "use <n> digits to display SHA-1s", \
235+ { OPTION_CALLBACK, 0, "abbrev", (var), N_( "n"), \
236+ N_( "use <n> digits to display SHA-1s"), \
234237 PARSE_OPT_OPTARG, &parse_opt_abbrev_cb, 0 }
235238#define OPT__COLOR (var , h ) \
236239 OPT_COLOR_FLAG(0, "color", (var), (h))
0 commit comments