From cdde4ea4dcd08b8cbe0da7f6360f0412debf51d5 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 20 Apr 2023 13:35:39 -0400 Subject: main, opk: Translate strings --- (limited to 'src/opk.c') diff --git a/src/opk.c b/src/opk.c index 578f85b..ddcacea 100644 --- a/src/opk.c +++ b/src/opk.c @@ -24,6 +24,7 @@ #include #include "defs.h" #include "gzip.h" +#include "i18n.h" #include "opk.h" #include "ustar.h" @@ -69,7 +70,7 @@ opkg_opk_opk_init(const char *file_name) /* Open outer archive. */ opk->file = fopen(file_name, "rb"); if (opk->file == NULL) { - fprintf(stderr, "Error: Failed to open file \"%s\"\n", + fprintf(stderr, _("Error: Failed to open file \"%s\"\n"), file_name); goto error1; } @@ -77,34 +78,34 @@ opkg_opk_opk_init(const char *file_name) /* Initialize outer gzip decompressor. */ opk->outer_gzip = opkg_opk_gzip_init(&_opkg_opk_opk_file_read, opk); if (opk->outer_gzip == NULL) { - fputs("Error: Failed to initialize\n", stderr); + fputs(_("Error: Failed to initialize\n"), stderr); goto error2; } /* Initialize outer ustar unarchiver. */ opk->outer_ustar = opkg_opk_ustar_init(opk->outer_gzip); if (opk->outer_ustar == NULL) { - fputs("Error: Failed to initialize\n", stderr); + fputs(_("Error: Failed to initialize\n"), stderr); goto error3; } /* Check package version. */ if (opkg_opk_ustar_seek_one(opk->outer_ustar, "debian-binary") != OPKG_OPK_OK) { - fputs("Error: Failed to find \"debian-binary\" in archive\n", + fputs(_("Error: Failed to find \"debian-binary\" in archive\n"), stderr); goto error4; } if (opkg_opk_ustar_read(opk->outer_ustar, &opk->version_buffer, &opk->version_size) != OPKG_OPK_OK) { - fputs("Error: Failed to read \"debian-binary\" in archive\n", + fputs(_("Error: Failed to read \"debian-binary\" in archive\n"), stderr); goto error4; } if (opk->version_size < 4 || strncmp(opk->version_buffer, "2.", 2) != 0) { - fputs("Error: Unsupported package version\n", stderr); + fputs(_("Error: Unsupported package version\n"), stderr); goto error4; } @@ -133,13 +134,13 @@ _opkg_opk_opk_init_inner(struct opkg_opk_opk *opk, const char *member) while ((ret = opkg_opk_ustar_read(opk->outer_ustar, NULL, NULL)) == OPKG_OPK_OK); if (ret == OPKG_OPK_ERROR) { - fputs("Error: Failed to read archive\n", stderr); + fputs(_("Error: Failed to read archive\n"), stderr); return OPKG_OPK_ERROR; } /* Find requested inner archive. */ if (opkg_opk_ustar_seek_one(opk->outer_ustar, member) != OPKG_OPK_OK) { - fprintf(stderr, "Error: Failed to find \"%s\" in archive\n", + fprintf(stderr, _("Error: Failed to find \"%s\" in archive\n"), member); return OPKG_OPK_ERROR; } @@ -149,14 +150,14 @@ _opkg_opk_opk_init_inner(struct opkg_opk_opk *opk, const char *member) (opkg_opk_gzip_read_func *) &opkg_opk_ustar_read, opk->outer_ustar); if (opk->inner_gzip == NULL) { - fputs("Error: Failed to initialize\n", stderr); + fputs(_("Error: Failed to initialize\n"), stderr); return OPKG_OPK_ERROR; } /* Initialize inner ustar unarchiver. */ opk->inner_ustar = opkg_opk_ustar_init(opk->inner_gzip); if (opk->inner_ustar == NULL) { - fputs("Error: Failed to initialize\n", stderr); + fputs(_("Error: Failed to initialize\n"), stderr); opkg_opk_gzip_free(opk->inner_gzip); return OPKG_OPK_ERROR; } @@ -193,14 +194,15 @@ opkg_opk_opk_read_control(struct opkg_opk_opk *opk, &buffer, &size)) == OPKG_OPK_OK) { if (fwrite(buffer, 1, size, stdout) != size) { - fputs("Error: Failed to print control file\n", - stderr); + fputs(_("Error: Failed to print control file\n") + , stderr); _opkg_opk_opk_free_inner(opk); return OPKG_OPK_ERROR; } } if (ret_read == OPKG_OPK_ERROR) { - fputs("Error: Failed to read control file\n", stderr); + fputs(_("Error: Failed to read control file\n"), + stderr); _opkg_opk_opk_free_inner(opk); return OPKG_OPK_ERROR; } @@ -210,7 +212,7 @@ opkg_opk_opk_read_control(struct opkg_opk_opk *opk, } } if (ret_seek == OPKG_OPK_ERROR) { - fputs("Error: Failed to find control file\n", stderr); + fputs(_("Error: Failed to find control file\n"), stderr); _opkg_opk_opk_free_inner(opk); return OPKG_OPK_ERROR; } @@ -273,7 +275,7 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk) } } if (ret == OPKG_OPK_ERROR) { - fputs("Error: Failed to list data files\n", stderr); + fputs(_("Error: Failed to list data files\n"), stderr); _opkg_opk_opk_free_inner(opk); return OPKG_OPK_ERROR; } -- cgit v0.9.1