@@ -54,7 +54,7 @@ static enum help_format parse_help_format(const char *format)
54
54
return HELP_FORMAT_INFO ;
55
55
if (!strcmp (format , "web" ) || !strcmp (format , "html" ))
56
56
return HELP_FORMAT_WEB ;
57
- die ("unrecognized help format '%s'" , format );
57
+ die (_ ( "unrecognized help format '%s'" ) , format );
58
58
}
59
59
60
60
static const char * get_man_viewer_info (const char * name )
@@ -82,7 +82,7 @@ static int check_emacsclient_version(void)
82
82
ec_process .err = -1 ;
83
83
ec_process .stdout_to_stderr = 1 ;
84
84
if (start_command (& ec_process ))
85
- return error ("Failed to start emacsclient." );
85
+ return error (_ ( "Failed to start emacsclient." ) );
86
86
87
87
strbuf_read (& buffer , ec_process .err , 20 );
88
88
close (ec_process .err );
@@ -95,15 +95,15 @@ static int check_emacsclient_version(void)
95
95
96
96
if (prefixcmp (buffer .buf , "emacsclient" )) {
97
97
strbuf_release (& buffer );
98
- return error ("Failed to parse emacsclient version." );
98
+ return error (_ ( "Failed to parse emacsclient version." ) );
99
99
}
100
100
101
101
strbuf_remove (& buffer , 0 , strlen ("emacsclient" ));
102
102
version = atoi (buffer .buf );
103
103
104
104
if (version < 22 ) {
105
105
strbuf_release (& buffer );
106
- return error ("emacsclient version '%d' too old (< 22)." ,
106
+ return error (_ ( "emacsclient version '%d' too old (< 22)." ) ,
107
107
version );
108
108
}
109
109
@@ -121,7 +121,7 @@ static void exec_woman_emacs(const char *path, const char *page)
121
121
path = "emacsclient" ;
122
122
strbuf_addf (& man_page , "(woman \"%s\")" , page );
123
123
execlp (path , "emacsclient" , "-e" , man_page .buf , (char * )NULL );
124
- warning ("failed to exec '%s': %s" , path , strerror (errno ));
124
+ warning (_ ( "failed to exec '%s': %s" ) , path , strerror (errno ));
125
125
}
126
126
}
127
127
@@ -149,7 +149,7 @@ static void exec_man_konqueror(const char *path, const char *page)
149
149
path = "kfmclient" ;
150
150
strbuf_addf (& man_page , "man:%s(1)" , page );
151
151
execlp (path , filename , "newTab" , man_page .buf , (char * )NULL );
152
- warning ("failed to exec '%s': %s" , path , strerror (errno ));
152
+ warning (_ ( "failed to exec '%s': %s" ) , path , strerror (errno ));
153
153
}
154
154
}
155
155
@@ -158,15 +158,15 @@ static void exec_man_man(const char *path, const char *page)
158
158
if (!path )
159
159
path = "man" ;
160
160
execlp (path , "man" , page , (char * )NULL );
161
- warning ("failed to exec '%s': %s" , path , strerror (errno ));
161
+ warning (_ ( "failed to exec '%s': %s" ) , path , strerror (errno ));
162
162
}
163
163
164
164
static void exec_man_cmd (const char * cmd , const char * page )
165
165
{
166
166
struct strbuf shell_cmd = STRBUF_INIT ;
167
167
strbuf_addf (& shell_cmd , "%s %s" , cmd , page );
168
168
execl ("/bin/sh" , "sh" , "-c" , shell_cmd .buf , (char * )NULL );
169
- warning ("failed to exec '%s': %s" , cmd , strerror (errno ));
169
+ warning (_ ( "failed to exec '%s': %s" ) , cmd , strerror (errno ));
170
170
}
171
171
172
172
static void add_man_viewer (const char * name )
@@ -206,8 +206,8 @@ static int add_man_viewer_path(const char *name,
206
206
if (supported_man_viewer (name , len ))
207
207
do_add_man_viewer_info (name , len , value );
208
208
else
209
- warning ("'%s': path for unsupported man viewer.\n"
210
- "Please consider using 'man.<tool>.cmd' instead." ,
209
+ warning (_ ( "'%s': path for unsupported man viewer.\n"
210
+ "Please consider using 'man.<tool>.cmd' instead." ) ,
211
211
name );
212
212
213
213
return 0 ;
@@ -218,8 +218,8 @@ static int add_man_viewer_cmd(const char *name,
218
218
const char * value )
219
219
{
220
220
if (supported_man_viewer (name , len ))
221
- warning ("'%s': cmd for supported man viewer.\n"
222
- "Please consider using 'man.<tool>.path' instead." ,
221
+ warning (_ ( "'%s': cmd for supported man viewer.\n"
222
+ "Please consider using 'man.<tool>.path' instead." ) ,
223
223
name );
224
224
else
225
225
do_add_man_viewer_info (name , len , value );
@@ -280,11 +280,11 @@ void list_common_cmds_help(void)
280
280
longest = strlen (common_cmds [i ].name );
281
281
}
282
282
283
- puts ("The most commonly used git commands are:" );
283
+ puts (_ ( "The most commonly used git commands are:" ) );
284
284
for (i = 0 ; i < ARRAY_SIZE (common_cmds ); i ++ ) {
285
285
printf (" %s " , common_cmds [i ].name );
286
286
mput_char (' ' , longest - strlen (common_cmds [i ].name ));
287
- puts (common_cmds [i ].help );
287
+ puts (_ ( common_cmds [i ].help ) );
288
288
}
289
289
}
290
290
@@ -348,7 +348,7 @@ static void exec_viewer(const char *name, const char *page)
348
348
else if (info )
349
349
exec_man_cmd (info , page );
350
350
else
351
- warning ("'%s': unknown man viewer." , name );
351
+ warning (_ ( "'%s': unknown man viewer." ) , name );
352
352
}
353
353
354
354
static void show_man_page (const char * git_cmd )
@@ -365,15 +365,15 @@ static void show_man_page(const char *git_cmd)
365
365
if (fallback )
366
366
exec_viewer (fallback , page );
367
367
exec_viewer ("man" , page );
368
- die ("no man viewer handled the request" );
368
+ die (_ ( "no man viewer handled the request" ) );
369
369
}
370
370
371
371
static void show_info_page (const char * git_cmd )
372
372
{
373
373
const char * page = cmd_to_page (git_cmd );
374
374
setenv ("INFOPATH" , system_path (GIT_INFO_PATH ), 1 );
375
375
execlp ("info" , "info" , "gitman" , page , (char * )NULL );
376
- die ("no info viewer handled the request" );
376
+ die (_ ( "no info viewer handled the request" ) );
377
377
}
378
378
379
379
static void get_html_page_path (struct strbuf * page_path , const char * page )
@@ -384,7 +384,7 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
384
384
/* Check that we have a git documentation directory. */
385
385
if (stat (mkpath ("%s/git.html" , html_path ), & st )
386
386
|| !S_ISREG (st .st_mode ))
387
- die ("'%s': not a documentation directory." , html_path );
387
+ die (_ ( "'%s': not a documentation directory." ) , html_path );
388
388
389
389
strbuf_init (page_path , 0 );
390
390
strbuf_addf (page_path , "%s/%s.html" , html_path , page );
@@ -424,16 +424,16 @@ int cmd_help(int argc, const char **argv, const char *prefix)
424
424
parsed_help_format = help_format ;
425
425
426
426
if (show_all ) {
427
- printf ("usage: %s\n\n" , git_usage_string );
428
- list_commands ("git commands" , & main_cmds , & other_cmds );
429
- printf ("%s\n" , git_more_info_string );
427
+ printf (_ ( "usage: %s%s" ), _ ( git_usage_string ), " \n\n" );
428
+ list_commands (_ ( "git commands" ) , & main_cmds , & other_cmds );
429
+ printf ("%s\n" , _ ( git_more_info_string ) );
430
430
return 0 ;
431
431
}
432
432
433
433
if (!argv [0 ]) {
434
- printf ("usage: %s\n\n" , git_usage_string );
434
+ printf (_ ( "usage: %s%s" ), _ ( git_usage_string ), " \n\n" );
435
435
list_common_cmds_help ();
436
- printf ("\n%s\n" , git_more_info_string );
436
+ printf ("\n%s\n" , _ ( git_more_info_string ) );
437
437
return 0 ;
438
438
}
439
439
@@ -445,7 +445,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
445
445
446
446
alias = alias_lookup (argv [0 ]);
447
447
if (alias && !is_git_command (argv [0 ])) {
448
- printf ( "`git %s' is aliased to `%s'\n" , argv [0 ], alias );
448
+ printf_ln ( _ ( "`git %s' is aliased to `%s'" ) , argv [0 ], alias );
449
449
return 0 ;
450
450
}
451
451
0 commit comments