@@ -66,12 +66,14 @@ typedef int parse_opt_ll_cb(struct parse_opt_ctx_t *ctx,
66
66
*
67
67
* `argh`::
68
68
* 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.
70
71
*
71
72
* `help`::
72
73
* the short help associated to what the option does.
73
74
* Must never be NULL (except for OPTION_END).
74
75
* OPTION_GROUP uses this pointer to store the group header.
76
+ * Should be wrapped by N_() for translation.
75
77
*
76
78
* `flags`::
77
79
* mask of parse_opt_option_flags.
@@ -128,37 +130,38 @@ struct option {
128
130
#define OPT_BOOL (s , l , v , h ) OPT_SET_INT(s, l, v, h, 1)
129
131
#define OPT_SET_PTR (s , l , v , h , p ) { OPTION_SET_PTR, (s), (l), (v), NULL, \
130
132
(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) }
132
134
#define OPT_STRING (s , l , v , a , h ) { OPTION_STRING, (s), (l), (v), (a), (h) }
133
135
#define OPT_STRING_LIST (s , l , v , a , h ) \
134
136
{ OPTION_CALLBACK, (s), (l), (v), (a), \
135
137
(h), 0, &parse_opt_string_list }
136
138
#define OPT_UYN (s , l , v , h ) { OPTION_CALLBACK, (s), (l), (v), NULL, \
137
139
(h), PARSE_OPT_NOARG, &parse_opt_tertiary }
138
140
#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, \
140
142
parse_opt_approxidate_cb }
141
143
#define OPT_CALLBACK (s , l , v , a , h , f ) \
142
144
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
143
145
#define OPT_NUMBER_CALLBACK (v , h , f ) \
144
146
{ OPTION_NUMBER, 0, NULL, (v), NULL, (h), \
145
147
PARSE_OPT_NOARG | PARSE_OPT_NONEG, (f) }
146
148
#define OPT_FILENAME (s , l , v , h ) { OPTION_FILENAME, (s), (l), (v), \
147
- "file", (h) }
149
+ N_( "file") , (h) }
148
150
#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, \
150
152
parse_opt_color_flag_cb, (intptr_t)"always" }
151
153
152
154
#define OPT_NOOP_NOARG (s , l ) \
153
155
{ OPTION_CALLBACK, (s), (l), NULL, NULL, \
154
- "no-op (backward compatibility)", \
156
+ N_( "no-op (backward compatibility)"), \
155
157
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, parse_opt_noop_cb }
156
158
157
159
/* Deprecated synonym */
158
160
#define OPT_BOOLEAN OPT_COUNTUP
159
161
160
162
/* 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_().
162
165
* Returns the number of arguments left in argv[].
163
166
*/
164
167
extern 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);
222
225
#define OPT__VERBOSE (var , h ) OPT_BOOLEAN('v', "verbose", (var), (h))
223
226
#define OPT__QUIET (var , h ) OPT_BOOLEAN('q', "quiet", (var), (h))
224
227
#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") , \
226
229
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") , \
228
231
PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }
229
232
#define OPT__DRY_RUN (var , h ) OPT_BOOLEAN('n', "dry-run", (var), (h))
230
233
#define OPT__FORCE (var , h ) OPT_BOOLEAN('f', "force", (var), (h))
231
234
#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"), \
234
237
PARSE_OPT_OPTARG, &parse_opt_abbrev_cb, 0 }
235
238
#define OPT__COLOR (var , h ) \
236
239
OPT_COLOR_FLAG(0, "color", (var), (h))
0 commit comments