summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2023-10-06 09:00:18 (EDT)
committer P. J. McDermott <pj@pehjota.net>2023-10-06 11:33:29 (EDT)
commit20377a29d1f274802fce5c728d1a5d7f5a7e8c2a (patch)
treeeb7748ced4f23471f07fdb0c16a56f32e8a91176 /src/main.c
parent4c487f3f0a377f15636a3041a0dda9b04d851c77 (diff)
downloadatsign-20377a29d1f274802fce5c728d1a5d7f5a7e8c2a.zip
atsign-20377a29d1f274802fce5c728d1a5d7f5a7e8c2a.tar.gz
atsign-20377a29d1f274802fce5c728d1a5d7f5a7e8c2a.tar.bz2
datetime, main: Translate strings
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/main.c b/src/main.c
index 51a8a58..ce02c1f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,6 +26,7 @@
#include <unistd.h>
#include "config.h"
#include "datetime.h"
+#include "i18n.h"
#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
#include <getopt.h>
@@ -59,7 +60,7 @@ static const struct option LONGOPTS_[] = {
static void
_print_usage(FILE *stream, const char *program_name)
{
- fprintf(stream, "Usage: %s [date]time\n", program_name);
+ fprintf(stream, _("Usage: %s [date]time\n"), program_name);
}
static void
@@ -111,44 +112,44 @@ _list_formats(const struct tm *tm)
char *buf;
size_t i;
- puts("Time formats:");
+ puts(_("Time formats:"));
i = 0;
while (datetime_strftime_time(tm, &out, &buf_sz, &buf, &i) > 0) {
if (out[0] == '\0') {
continue;
}
- printf(" * %s\n", out);
+ printf(_(" * %s\n"), out);
}
- puts("Date formats:");
+ puts(_("Date formats:"));
i = 0;
while (datetime_strftime_date(tm, &out, &buf_sz, &buf, &i) > 0) {
if (out[0] == '\0') {
continue;
}
- printf(" * %s\n", out);
+ printf(_(" * %s\n"), out);
}
- puts("Additional formats:");
+ puts(_("Additional formats:"));
i = 0;
while (datetime_strftime_misc(tm, &out, &buf_sz, &buf, &i) > 0) {
if (out[0] == '\0') {
continue;
}
- printf(" * %s\n", out);
+ printf(_(" * %s\n"), out);
}
}
static void
_print_version(void)
{
- printf("@ (atsign) %s%s\n", PACKAGE_VERSION, PACKAGE_VERSION_GIT);
- puts("Copyright (C) 2021, 2022 P. J. McDermott\n"
+ printf(_("@ (atsign) %s%s\n"), PACKAGE_VERSION, PACKAGE_VERSION_GIT);
+ puts(_("Copyright (C) 2021, 2022 P. J. McDermott\n"
"License GPLv3+: GNU GPL version 3 or later "
"<http://gnu.org/licenses/gpl.html>.\n"
"This is free software: you are free to change and redistribute it.\n"
- "There is NO WARRANTY, to the extent permitted by law.\n");
- printf("Please report bugs to <%s>.\n", PACKAGE_BUGREPORT);
+ "There is NO WARRANTY, to the extent permitted by law.\n"));
+ printf(_("Please report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
static char *
@@ -167,7 +168,7 @@ _concat_args(int argc, char * const argv[])
buf = calloc(buf_l, sizeof(*buf));
if (buf == NULL) {
- fprintf(stderr, "Failed to allocate buffer: %s\n",
+ fprintf(stderr, _("Failed to allocate buffer: %s\n"),
strerror(errno));
return NULL;
}
@@ -243,11 +244,11 @@ main(int argc, char * const argv[])
default:
_print_usage(stderr, argv[0]);
#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
- fprintf(stderr, "Try '%s --help' for more "
- "information.\n", argv[0]);
+ fprintf(stderr, _("Try '%s --help' for more "
+ "information.\n"), argv[0]);
#else
- fprintf(stderr, "Try '%s -h' for more "
- "information.\n", argv[0]);
+ fprintf(stderr, _("Try '%s -h' for more "
+ "information.\n"), argv[0]);
#endif
return EXIT_FAILURE;
}
@@ -287,7 +288,7 @@ main(int argc, char * const argv[])
now = time(NULL);
dif = difftime(arg, now);
if (dif >= 1000 * 24 * 60 * 60) {
- fputs("Date too far in the future\n", stderr);
+ fputs(_("Date too far in the future\n"), stderr);
return EXIT_FAILURE;
}