Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-05-15 02:19:57 +0000
committerJudd Vinet <judd@archlinux.org>2006-05-15 02:19:57 +0000
commitbb787e26ee01f961c76fbe4e568275a66e80009f (patch)
tree6b16de3f1d21f018ea1f2a0e53fc38562c4e89b1 /src
parent3d3a29a80849f2aaa0baff93c1ae4478276e2b54 (diff)
first stage of i18n stuff from VMiklos
Diffstat (limited to 'src')
-rw-r--r--src/pacman/add.c28
-rw-r--r--src/pacman/conf.c81
-rw-r--r--src/pacman/deptest.c19
-rw-r--r--src/pacman/download.c59
-rw-r--r--src/pacman/list.c6
-rw-r--r--src/pacman/log.c17
-rw-r--r--src/pacman/package.c71
-rw-r--r--src/pacman/pacman.c157
-rw-r--r--src/pacman/query.c21
-rw-r--r--src/pacman/remove.c29
-rw-r--r--src/pacman/sync.c127
-rw-r--r--src/pacman/trans.c39
-rw-r--r--src/pacman/util.c5
-rw-r--r--src/pacman/util.h2
14 files changed, 339 insertions, 322 deletions
diff --git a/src/pacman/add.c b/src/pacman/add.c
index c63e14b5..04182df9 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -31,6 +32,7 @@
#include "trans.h"
#include "add.h"
#include "conf.h"
+#include "util.h"
extern config_t *config;
@@ -64,34 +66,34 @@ int pacman_add(list_t *targets)
config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
- MSG(NL, " if you're sure a package manager is not already running,\n"
- " you can remove %s\n", PM_LOCK);
+ MSG(NL, _(" if you're sure a package manager is not already running,\n"
+ " you can remove %s\n"), PM_LOCK);
}
return(1);
}
/* and add targets to it */
- MSG(NL, "loading package data... ");
+ MSG(NL, _("loading package data... "));
for(i = targets; i; i = i->next) {
if(alpm_trans_addtarget(i->data) == -1) {
- ERR(NL, "failed to add target '%s' (%s)\n", (char *)i->data, alpm_strerror(pm_errno));
+ ERR(NL, _("failed to add target '%s' (%s)\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
}
- MSG(CL, "done.");
+ MSG(CL, _("done."));
/* Step 2: "compute" the transaction based on targets and flags
*/
if(alpm_trans_prepare(&data) == -1) {
PM_LIST *i;
- ERR(NL, "failed to prepare transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
PM_DEPMISS *miss = alpm_list_getdata(i);
- MSG(NL, ":: %s: requires %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
+ MSG(NL, _(":: %s: requires %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -105,7 +107,7 @@ int pacman_add(list_t *targets)
case PM_ERR_CONFLICTING_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
PM_DEPMISS *miss = alpm_list_getdata(i);
- MSG(NL, ":: %s: conflicts with %s",
+ MSG(NL, _(":: %s: conflicts with %s"),
alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
}
alpm_list_free(data);
@@ -115,20 +117,20 @@ int pacman_add(list_t *targets)
PM_CONFLICT *conflict = alpm_list_getdata(i);
switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET:
- MSG(NL, "%s exists in \"%s\" (target) and \"%s\" (target)",
+ MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break;
case PM_CONFLICT_TYPE_FILE:
- MSG(NL, "%s: %s exists in filesystem",
+ MSG(NL, _("%s: %s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break;
}
}
alpm_list_free(data);
- MSG(NL, "\nerrors occurred, no packages were upgraded.\n");
+ MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
default:
break;
@@ -140,7 +142,7 @@ int pacman_add(list_t *targets)
/* Step 3: actually perform the installation
*/
if(alpm_trans_commit(NULL) == -1) {
- ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -149,7 +151,7 @@ int pacman_add(list_t *targets)
*/
cleanup:
if(alpm_trans_release() == -1) {
- ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
}
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 2a49fadc..1caefd32 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <limits.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -98,13 +99,13 @@ int parseconfig(char *file, config_t *config)
ptr++;
strncpy(section, ptr, min(255, strlen(ptr)-1));
section[min(255, strlen(ptr)-1)] = '\0';
- vprint("config: new section '%s'\n", section);
+ vprint(_("config: new section '%s'\n"), section);
if(!strlen(section)) {
- ERR(NL, "config: line %d: bad section name\n", linenum);
+ ERR(NL, _("config: line %d: bad section name\n"), linenum);
return(1);
}
if(!strcmp(section, "local")) {
- ERR(NL, "config: line %d: '%s' is reserved and cannot be used as a package tree\n",
+ ERR(NL, _("config: line %d: '%s' is reserved and cannot be used as a package tree\n"),
linenum, section);
return(1);
}
@@ -130,29 +131,29 @@ int parseconfig(char *file, config_t *config)
ptr = line;
key = strsep(&ptr, "=");
if(key == NULL) {
- ERR(NL, "config: line %d: syntax error\n", linenum);
+ ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1);
}
strtrim(key);
key = strtoupper(key);
if(!strlen(section) && strcmp(key, "INCLUDE")) {
- ERR(NL, "config: line %d: all directives must belong to a section\n", linenum);
+ ERR(NL, _("config: line %d: all directives must belong to a section\n"), linenum);
return(1);
}
if(ptr == NULL) {
if(!strcmp(key, "NOPASSIVEFTP")) {
config->nopassiveftp = 1;
- vprint("config: nopassiveftp\n");
+ vprint(_("config: nopassiveftp\n"));
} else if(!strcmp(key, "USESYSLOG")) {
if(alpm_set_option(PM_OPT_USESYSLOG, (long)1) == -1) {
- ERR(NL, "failed to set option USESYSLOG (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option USESYSLOG (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: usesyslog\n");
+ vprint(_("config: usesyslog\n"));
} else if(!strcmp(key, "ILOVECANDY")) {
config->chomp = 1;
} else {
- ERR(NL, "config: line %d: syntax error\n", linenum);
+ ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1);
}
} else {
@@ -160,7 +161,7 @@ int parseconfig(char *file, config_t *config)
if(!strcmp(key, "INCLUDE")) {
char conf[PATH_MAX];
strncpy(conf, ptr, PATH_MAX);
- vprint("config: including %s\n", conf);
+ vprint(_("config: including %s\n"), conf);
parseconfig(conf, config);
} else if(!strcmp(section, "options")) {
if(!strcmp(key, "NOUPGRADE")) {
@@ -169,66 +170,66 @@ int parseconfig(char *file, config_t *config)
while((q = strchr(p, ' '))) {
*q = '\0';
if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) {
- ERR(NL, "failed to set option NOUPGRADE (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option NOUPGRADE (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: noupgrade: %s\n", p);
+ vprint(_("config: noupgrade: %s\n"), p);
p = q;
p++;
}
if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) {
- ERR(NL, "failed to set option NOUPGRADE (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option NOUPGRADE (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: noupgrade: %s\n", p);
+ vprint(_("config: noupgrade: %s\n"), p);
} else if(!strcmp(key, "NOEXTRACT")) {
char *p = ptr;
char *q;
while((q = strchr(p, ' '))) {
*q = '\0';
if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) {
- ERR(NL, "failed to set option NOEXTRACT (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option NOEXTRACT (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: noextract: %s\n", p);
+ vprint(_("config: noextract: %s\n"), p);
p = q;
p++;
}
if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) {
- ERR(NL, "failed to set option NOEXTRACT (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option NOEXTRACT (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: noextract: %s\n", p);
+ vprint(_("config: noextract: %s\n"), p);
} else if(!strcmp(key, "IGNOREPKG")) {
char *p = ptr;
char *q;
while((q = strchr(p, ' '))) {
*q = '\0';
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) {
- ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: ignorepkg: %s\n", p);
+ vprint(_("config: ignorepkg: %s\n"), p);
p = q;
p++;
}
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) {
- ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: ignorepkg: %s\n", p);
+ vprint(_("config: ignorepkg: %s\n"), p);
} else if(!strcmp(key, "HOLDPKG")) {
char *p = ptr;
char *q;
while((q = strchr(p, ' '))) {
*q = '\0';
config->holdpkg = list_add(config->holdpkg, strdup(p));
- vprint("config: holdpkg: %s\n", p);
+ vprint(_("config: holdpkg: %s\n"), p);
p = q;
p++;
}
config->holdpkg = list_add(config->holdpkg, strdup(p));
- vprint("config: holdpkg: %s\n", p);
+ vprint(_("config: holdpkg: %s\n"), p);
} else if(!strcmp(key, "DBPATH")) {
/* shave off the leading slash, if there is one */
if(*ptr == '/') {
@@ -236,7 +237,7 @@ int parseconfig(char *file, config_t *config)
}
FREE(config->dbpath);
config->dbpath = strdup(ptr);
- vprint("config: dbpath: %s\n", ptr);
+ vprint(_("config: dbpath: %s\n"), ptr);
} else if(!strcmp(key, "CACHEDIR")) {
/* shave off the leading slash, if there is one */
if(*ptr == '/') {
@@ -244,17 +245,17 @@ int parseconfig(char *file, config_t *config)
}
FREE(config->cachedir);
config->cachedir = strdup(ptr);
- vprint("config: cachedir: %s\n", ptr);
+ vprint(_("config: cachedir: %s\n"), ptr);
} else if (!strcmp(key, "LOGFILE")) {
if(alpm_set_option(PM_OPT_LOGFILE, (long)ptr) == -1) {
- ERR(NL, "failed to set option LOGFILE (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option LOGFILE (%s)\n"), alpm_strerror(pm_errno));
return(1);
}
- vprint("config: log file: %s\n", ptr);
+ vprint(_("config: log file: %s\n"), ptr);
} else if (!strcmp(key, "XFERCOMMAND")) {
FREE(config->xfercommand);
config->xfercommand = strndup(ptr, PATH_MAX);
- vprint("config: xfercommand: %s\n", config->xfercommand);
+ vprint(_("config: xfercommand: %s\n"), config->xfercommand);
} else if (!strcmp(key, "PROXYSERVER")) {
char *p;
if(config->proxyhost) {
@@ -264,18 +265,18 @@ int parseconfig(char *file, config_t *config)
if(p) {
p += 3;
if(p == NULL || *p == '\0') {
- ERR(NL, "config: line %d: bad server location\n", linenum);
+ ERR(NL, _("config: line %d: bad server location\n"), linenum);
return(1);
}
ptr = p;
}
config->proxyhost = strndup(ptr, PATH_MAX);
- vprint("config: proxyserver: %s\n", config->proxyhost);
+ vprint(_("config: proxyserver: %s\n"), config->proxyhost);
} else if (!strcmp(key, "PROXYPORT")) {
config->proxyport = (unsigned short)atoi(ptr);
- vprint("config: proxyport: %u\n", config->proxyport);
+ vprint(_("config: proxyport: %u\n"), config->proxyport);
} else {
- ERR(NL, "config: line %d: syntax error\n", linenum);
+ ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1);
}
} else {
@@ -290,13 +291,13 @@ int parseconfig(char *file, config_t *config)
p = strstr(ptr, "://");
if(p == NULL) {
- ERR(NL, "config: line %d: bad server location\n", linenum);
+ ERR(NL, _("config: line %d: bad server location\n"), linenum);
return(1);
}
*p = '\0';
p++; p++; p++;
if(p == NULL || *p == '\0') {
- ERR(NL, "config: line %d: bad server location\n", linenum);
+ ERR(NL, _("config: line %d: bad server location\n"), linenum);
return(1);
}
server->protocol = strdup(ptr);
@@ -313,7 +314,7 @@ int parseconfig(char *file, config_t *config)
server->path = strdup(slash);
} else {
if((server->path = (char *)malloc(strlen(slash)+2)) == NULL) {
- ERR(NL, "could not allocate %d bytes\n", sizeof(strlen(slash+2)));
+ ERR(NL, _("could not allocate %d bytes\n"), sizeof(strlen(slash+2)));
return(1);
}
sprintf(server->path, "%s/", slash);
@@ -328,20 +329,20 @@ int parseconfig(char *file, config_t *config)
} else {
server->path = (char *)malloc(strlen(p)+2);
if(server->path == NULL) {
- ERR(NL, "could not allocate %d bytes\n", sizeof(strlen(p+2)));
+ ERR(NL, _("could not allocate %d bytes\n"), sizeof(strlen(p+2)));
return(1);
}
sprintf(server->path, "%s/", p);
}
} else {
- ERR(NL, "config: line %d: protocol %s is not supported\n", linenum, ptr);
+ ERR(NL, _("config: line %d: protocol %s is not supported\n"), linenum, ptr);
return(1);
}
/* add to the list */
- vprint("config: %s: server: %s %s %s\n", section, server->protocol, server->server, server->path);
+ vprint(_("config: %s: server: %s %s %s\n"), section, server->protocol, server->server, server->path);
sync->servers = list_add(sync->servers, server);
} else {
- ERR(NL, "config: line %d: syntax error\n", linenum);
+ ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1);
}
}
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 1ed11aa0..425bd1da 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
#include "util.h"
@@ -60,8 +61,8 @@ int pacman_deptest(list_t *targets)
if(alpm_trans_init(PM_TRANS_TYPE_ADD, 0, NULL, NULL) == -1) {
ERR(NL, "%s", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
- MSG(NL, " if you're sure a package manager is not already running,\n" \
- " you can remove %s\n", PM_LOCK);
+ MSG(NL, _(" if you're sure a package manager is not already running,\n"
+ " you can remove %s\n"), PM_LOCK);
}
return(1);
}
@@ -73,7 +74,7 @@ int pacman_deptest(list_t *targets)
*/
str = (char *)malloc(strlen("name=dummy|version=1.0-1")+1);
if(str == NULL) {
- ERR(NL, "memory allocation failure\n");
+ ERR(NL, _("memory allocation failure\n"));
retval = 1;
goto cleanup;
}
@@ -83,10 +84,10 @@ int pacman_deptest(list_t *targets)
strcat(str, "|depend=");
strcat(str, i->data);
}
- vprint("add target %s\n", str);
+ vprint(_("add target %s\n"), str);
if(alpm_trans_addtarget(str) == -1) {
FREE(str);
- ERR(NL, "could not add target (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("could not add target (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -106,7 +107,7 @@ int pacman_deptest(list_t *targets)
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
if(!config->op_d_resolve) {
- MSG(NL, "requires: %s", alpm_dep_getinfo(miss, PM_DEP_NAME));
+ MSG(NL, _("requires: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -122,7 +123,7 @@ int pacman_deptest(list_t *targets)
/* we can't auto-resolve conflicts */
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
- MSG(NL, "conflict: %s", alpm_dep_getinfo(miss, PM_DEP_NAME));
+ MSG(NL, _("conflict: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
}
retval = 127;
alpm_list_free(data);
@@ -136,7 +137,7 @@ int pacman_deptest(list_t *targets)
/* TODO: handle version comparators (eg, glibc>=2.2.5) */
if(retval == 126 && synctargs != NULL) {
if(alpm_trans_release() == -1) {
- ERR(NL, "could not release transaction (%s)", alpm_strerror(pm_errno));
+ ERR(NL, _("could not release transaction (%s)"), alpm_strerror(pm_errno));
FREELIST(synctargs);
return(1);
}
@@ -153,7 +154,7 @@ int pacman_deptest(list_t *targets)
cleanup:
if(alpm_trans_release() == -1) {
- ERR(NL, "could not release transaction (%s)", alpm_strerror(pm_errno));
+ ERR(NL, _("could not release transaction (%s)"), alpm_strerror(pm_errno));
retval = 1;
}
diff --git a/src/pacman/download.c b/src/pacman/download.c
index 9a80e29e..b59aeada 100644
--- a/src/pacman/download.c
+++ b/src/pacman/download.c
@@ -29,6 +29,7 @@
#include <time.h>
#include <sys/time.h>
#include <ftplib.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -204,27 +205,27 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!config->xfercommand && strcmp(server->protocol, "file")) {
if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
FtpInit();
- vprint("connecting to %s:21\n", server->server);
+ vprint(_("connecting to %s:21\n"), server->server);
if(!FtpConnect(server->server, &control)) {
- ERR(NL, "cannot connect to %s\n", server->server);
+ ERR(NL, _("cannot connect to %s\n"), server->server);
continue;
}
if(!FtpLogin("anonymous", "arch@guest", control)) {
- ERR(NL, "anonymous login failed\n");
+ ERR(NL, _("anonymous login failed\n"));
FtpQuit(control);
continue;
}
if(!FtpChdir(server->path, control)) {
- ERR(NL, "could not cwd to %s: %s\n", server->path, FtpLastResponse(control));
+ ERR(NL, _("could not cwd to %s: %s\n"), server->path, FtpLastResponse(control));
FtpQuit(control);
continue;
}
if(!config->nopassiveftp) {
if(!FtpOptions(FTPLIB_CONNMODE, FTPLIB_PASSIVE, control)) {
- WARN(NL, "failed to set passive mode\n");
+ WARN(NL, _("failed to set passive mode\n"));
}
} else {
- vprint("FTP passive mode not set\n");
+ vprint(_("FTP passive mode not set\n"));
}
} else if(config->proxyhost) {
char *host;
@@ -232,12 +233,12 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
host = (config->proxyhost) ? config->proxyhost : server->server;
port = (config->proxyport) ? config->proxyport : 80;
if(strchr(host, ':')) {
- vprint("connecting to %s\n", host);
+ vprint(_("connecting to %s\n"), host);
} else {
- vprint("connecting to %s:%u\n", host, port);
+ vprint(_("connecting to %s:%u\n"), host, port);
}
if(!HttpConnect(host, port, &control)) {
- ERR(NL, "cannot connect to %s\n", host);
+ ERR(NL, _("cannot connect to %s\n"), host);
continue;
}
}
@@ -296,18 +297,18 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
/* cwd to the download directory */
getcwd(cwd, PATH_MAX);
if(chdir(localpath)) {
- ERR(NL, "could not chdir to %s\n", localpath);
+ ERR(NL, _("could not chdir to %s\n"), localpath);
return(1);
}
/* execute the parsed command via /bin/sh -c */
- vprint("running command: %s\n", parsedCmd);
+ vprint(_("running command: %s\n"), parsedCmd);
ret = system(parsedCmd);
if(ret == -1) {
- ERR(NL, "running XferCommand: fork failed!\n");
+ ERR(NL, _("running XferCommand: fork failed!\n"));
return(1);
} else if(ret != 0) {
/* download failed */
- vprint("XferCommand command returned non-zero status code (%d)\n", ret);
+ vprint(_("XferCommand command returned non-zero status code (%d)\n"), ret);
} else {
/* download was successful */
complete = list_add(complete, fn);
@@ -352,18 +353,18 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) {
- WARN(NL, "failed to get filesize for %s\n", fn);
+ WARN(NL, _("failed to get filesize for %s\n"), fn);
}
/* check mtimes */
if(mtime1) {
char fmtime[64];
if(!FtpModDate(fn, fmtime, sizeof(fmtime)-1, control)) {
- WARN(NL, "failed to get mtime for %s\n", fn);
+ WARN(NL, _("failed to get mtime for %s\n"), fn);
} else {
strtrim(fmtime);
if(mtime1 && !strcmp(mtime1, fmtime)) {
/* mtimes are identical, skip this file */
- vprint("mtimes are identical, skipping %s\n", fn);
+ vprint(_("mtimes are identical, skipping %s\n"), fn);
filedone = -1;
complete = list_add(complete, fn);
} else {
@@ -378,14 +379,14 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!stat(output, &st)) {
offset = (int)st.st_size;
if(!FtpRestart(offset, control)) {
- WARN(NL, "failed to resume download -- restarting\n");
+ WARN(NL, _("failed to resume download -- restarting\n"));
/* can't resume: */
/* unlink the file in order to restart download from scratch */
unlink(output);
}
}
if(!FtpGet(output, fn, FTPLIB_IMAGE, control)) {
- ERR(NL, "\nfailed downloading %s from %s: %s\n", fn, server->server, FtpLastResponse(control));
+ ERR(NL, _("\nfailed downloading %s from %s: %s\n"), fn, server->server, FtpLastResponse(control));
/* we leave the partially downloaded file in place so it can be resumed later */
} else {
filedone = 1;
@@ -406,12 +407,12 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
host = (config->proxyhost) ? config->proxyhost : server->server;
port = (config->proxyhost) ? config->proxyport : 80;
if(strchr(host, ':')) {
- vprint("connecting to %s\n", host);
+ vprint(_("connecting to %s\n"), host);
} else {
- vprint("connecting to %s:%u\n", host, port);
+ vprint(_("connecting to %s:%u\n"), host, port);
}
if(!HttpConnect(host, port, &control)) {
- ERR(NL, "cannot connect to %s\n", host);
+ ERR(NL, _("cannot connect to %s\n"), host);
continue;
}
/* set up our progress bar's callback (and idle timeout) */
@@ -456,11 +457,11 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!HttpGet(server->server, output, src, &fsz, control, offset,
(mtime1) ? &fmtime1 : NULL, (mtime2) ? &fmtime2 : NULL)) {
if(strstr(FtpLastResponse(control), "304")) {
- vprint("mtimes are identical, skipping %s\n", fn);
+ vprint(_("mtimes are identical, skipping %s\n"), fn);
filedone = -1;
complete = list_add(complete, fn);
} else {
- ERR(NL, "\nfailed downloading %s from %s: %s\n", src, server->server, FtpLastResponse(control));
+ ERR(NL, _("\nfailed downloading %s from %s: %s\n"), src, server->server, FtpLastResponse(control));
/* we leave the partially downloaded file in place so it can be resumed later */
}
} else {
@@ -471,7 +472,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
fmtime2.tm_year+1900, fmtime2.tm_mon+1, fmtime2.tm_mday,
fmtime2.tm_hour, fmtime2.tm_min, fmtime2.tm_sec);
} else {
- WARN(NL, "failed to get mtime for %s\n", fn);
+ WARN(NL, _("failed to get mtime for %s\n"), fn);
}
}
filedone = 1;
@@ -479,10 +480,10 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
} else if(!strcmp(server->protocol, "file")) {
char src[PATH_MAX];
snprintf(src, PATH_MAX, "%s%s", server->path, fn);
- vprint("copying %s to %s/%s\n", src, localpath, fn);
+ vprint(_("copying %s to %s/%s\n"), src, localpath, fn);
/* local repository, just copy the file */
if(copyfile(src, output)) {
- ERR(NL, "failed copying %s\n", src);
+ ERR(NL, _("failed copying %s\n"), src);
} else {
filedone = 1;
}
@@ -498,7 +499,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
for(j = strlen(out); j < maxcols-64; j++) {
printf(" ");
}
- fputs("] 100% LOCAL ", stdout);
+ fputs(_("] 100% LOCAL "), stdout);
} else {
log_progress(control, fsz-offset, &fsz);
}
@@ -560,7 +561,7 @@ char *fetch_pkgurl(char *target)
/* do not download the file if it exists in the current dir
*/
if(stat(fn, &buf) == 0) {
- vprint(" %s is already in the current directory\n", fn);
+ vprint(_(" %s is already in the current directory\n"), fn);
} else {
server_t *server;
list_t *servers = NULL;
@@ -574,7 +575,7 @@ char *fetch_pkgurl(char *target)
files = list_add(NULL, fn);
if(downloadfiles(servers, ".", files)) {
- ERR(NL, "failed to download %s\n", target);
+ ERR(NL, _("failed to download %s\n"), target);
return(NULL);
}
FREELISTPTR(files);
diff --git a/src/pacman/list.c b/src/pacman/list.c
index a7e9ce13..0a080373 100644
--- a/src/pacman/list.c
+++ b/src/pacman/list.c
@@ -23,7 +23,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <libintl.h>
/* pacman */
+#include "util.h"
#include "list.h"
extern int maxcols;
@@ -138,7 +140,7 @@ void list_display(const char *title, list_t *list)
}
printf("\n");
} else {
- printf("None\n");
+ printf(_("None\n"));
}
}
@@ -166,7 +168,7 @@ void PM_LIST_display(const char *title, PM_LIST *list)
}
printf("\n");
} else {
- printf("None\n");
+ printf(_("None\n"));
}
}
diff --git a/src/pacman/log.c b/src/pacman/log.c
index f989a79c..35cef028 100644
--- a/src/pacman/log.c
+++ b/src/pacman/log.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -46,25 +47,25 @@ void cb_log(unsigned short level, char *msg)
switch(level) {
case PM_LOG_DEBUG:
- sprintf(str, "debug");
+ sprintf(str, _("debug"));
break;
case PM_LOG_ERROR:
- sprintf(str, "error");
+ sprintf(str, _("error"));
break;
case PM_LOG_WARNING:
- sprintf(str, "warning");
+ sprintf(str, _("warning"));
break;
case PM_LOG_FLOW1:
- sprintf(str, "flow1");
+ sprintf(str, _("flow1"));
break;
case PM_LOG_FLOW2:
- sprintf(str, "flow2");
+ sprintf(str, _("flow2"));
break;
case PM_LOG_FUNCTION:
- sprintf(str, "function");
+ sprintf(str, _("function"));
break;
default:
- sprintf(str, "???");
+ sprintf(str, _("???"));
break;
}
@@ -147,7 +148,7 @@ int yesno(char *fmt, ...)
*++pch = 0;
strtrim(response);
- if(!strcasecmp(response, "Y") || !strcasecmp(response, "YES") || !strlen(response)) {
+ if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || !strlen(response)) {
return(1);
}
}
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 3e2956c8..72cf3c83 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -42,43 +43,43 @@ void dump_pkg_full(PM_PKG *pkg, int level)
return;
}
- printf("Name : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME));
- printf("Version : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
+ printf(_("Name : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME));
+ printf(_("Version : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
- PM_LIST_display("Groups :", alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
+ PM_LIST_display(_("Groups :"), alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
- printf("Packager : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_PACKAGER));
- printf("URL : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_URL));
- PM_LIST_display("License :", alpm_pkg_getinfo(pkg, PM_PKG_LICENSE));
- printf("Architecture : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_ARCH));
- printf("Size : %ld\n", (long int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE));
+ printf(_("Packager : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_PACKAGER));
+ printf(_("URL : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_URL));
+ PM_LIST_display(_("License :"), alpm_pkg_getinfo(pkg, PM_PKG_LICENSE));
+ printf(_("Architecture : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_ARCH));
+ printf(_("Size : %ld\n"), (long int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE));
date = alpm_pkg_getinfo(pkg, PM_PKG_BUILDDATE);
- printf("Build Date : %s %s\n", date, strlen(date) ? "UTC" : "");
+ printf(_("Build Date : %s %s\n"), date, strlen(date) ? "UTC" : "");
date = alpm_pkg_getinfo(pkg, PM_PKG_INSTALLDATE);
- printf("Install Date : %s %s\n", date, strlen(date) ? "UTC" : "");
+ printf(_("Install Date : %s %s\n"), date, strlen(date) ? "UTC" : "");
- printf("Install Script : %s\n", alpm_pkg_getinfo(pkg, PM_PKG_SCRIPLET) ? "Yes" : "No");
+ printf(_("Install Script : %s\n"), alpm_pkg_getinfo(pkg, PM_PKG_SCRIPLET) ? "Yes" : "No");
- printf("Reason: : ");
+ printf(_("Reason: : "));
switch((int)alpm_pkg_getinfo(pkg, PM_PKG_REASON)) {
case PM_PKG_REASON_EXPLICIT:
- printf("Explicitly installed\n");
+ printf(_("Explicitly installed\n"));
break;
case PM_PKG_REASON_DEPEND:
- printf("Installed as a dependency for another package\n");
+ printf(_("Installed as a dependency for another package\n"));
break;
default:
- printf("Unknown\n");
+ printf(_("Unknown\n"));
break;
}
- PM_LIST_display("Provides :", alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES));
- PM_LIST_display("Depends On :", alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
- PM_LIST_display("Required By :", alpm_pkg_getinfo(pkg, PM_PKG_REQUIREDBY));
- PM_LIST_display("Conflicts With :", alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
+ PM_LIST_display(_("Provides :"), alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES));
+ PM_LIST_display(_("Depends On :"), alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
+ PM_LIST_display(_("Required By :"), alpm_pkg_getinfo(pkg, PM_PKG_REQUIREDBY));
+ PM_LIST_display(_("Conflicts With :"), alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
- printf("Description : ");
+ printf(_("Description : "));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 17);
printf("\n");
@@ -102,14 +103,14 @@ void dump_pkg_full(PM_PKG *pkg, int level)
if(!stat(path, &buf)) {
char *md5sum = alpm_get_md5sum(path);
if(md5sum == NULL) {
- ERR(NL, "error calculating md5sum for %s\n", path);
+ ERR(NL, _("error calculating md5sum for %s\n"), path);
FREE(str);
continue;
}
- printf("%sMODIFIED\t%s\n", strcmp(md5sum, ptr) ? "" : "NOT ", path);
+ printf(_("%sMODIFIED\t%s\n"), strcmp(md5sum, ptr) ? "" : "NOT ", path);
FREE(md5sum);
} else {
- printf("MISSING\t\t%s\n", path);
+ printf(_("MISSING\t\t%s\n"), path);
}
FREE(str);
}
@@ -127,20 +128,20 @@ void dump_pkg_sync(PM_PKG *pkg, char *treename)
return;
}
- printf("Repository : %s\n", treename);
- printf("Name : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME));
- printf("Version : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
+ printf(_("Repository : %s\n"), treename);
+ printf(_("Name : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME));
+ printf(_("Version : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
- PM_LIST_display("Groups :", alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
- PM_LIST_display("Provides :", alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES));
- PM_LIST_display("Depends On :", alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
- PM_LIST_display("Conflicts With :", alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
- PM_LIST_display("Replaces :", alpm_pkg_getinfo(pkg, PM_PKG_REPLACES));
+ PM_LIST_display(_("Groups :"), alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
+ PM_LIST_display(_("Provides :"), alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES));
+ PM_LIST_display(_("Depends On :"), alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
+ PM_LIST_display(_("Conflicts With :"), alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
+ PM_LIST_display(_("Replaces :"), alpm_pkg_getinfo(pkg, PM_PKG_REPLACES));
- printf("Size (compressed) : %ld\n", (long)alpm_pkg_getinfo(pkg, PM_PKG_SIZE));
- printf("Description : ");
+ printf(_("Size (compressed) : %ld\n"), (long)alpm_pkg_getinfo(pkg, PM_PKG_SIZE));
+ printf(_("Description : "));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 20);
- printf("\nMD5 Sum : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM));
+ printf(_("\nMD5 Sum : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM));
}
void dump_pkg_files(PM_PKG *pkg)
@@ -152,7 +153,7 @@ void dump_pkg_files(PM_PKG *pkg)
pkgfiles = alpm_pkg_getinfo(pkg, PM_PKG_FILES);
for(i = pkgfiles; i; i = alpm_list_next(i)) {
- fprintf(stdout, "%s %s\n", (char *)pkgname, (char *)alpm_list_getdata(i));
+ fprintf(stdout, _("%s %s\n"), (char *)pkgname, (char *)alpm_list_getdata(i));
}
fflush(stdout);
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index a2ff2604..3678f628 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <signal.h>
#include <unistd.h>
+#include <libintl.h>
#ifndef CYGWIN
#include <mcheck.h> /* debug */
#else
@@ -77,12 +78,12 @@ extern int neednl;
*/
static void version()
{
- printf("\n");
- printf(" .--. Pacman v%s - libalpm v%s\n", PACKAGE_VERSION, PM_VERSION);
- printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>\n");
- printf("\\ '-. '-' '-' '-' \n");
- printf(" '--' This program may be freely redistributed under\n");
- printf(" the terms of the GNU General Public License\n");
+ printf(_("\n"));
+ printf(_(" .--. Pacman v%s - libalpm v%s\n"), PACKAGE_VERSION, PM_VERSION);
+ printf(_("/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>\n"));
+ printf(_("\\ '-. '-' '-' '-' \n"));
+ printf(_(" '--' This program may be freely redistributed under\n"));
+ printf(_(" the terms of the GNU General Public License\n"));
printf("\n");
}
@@ -93,72 +94,72 @@ static void version()
static void usage(int op, char *myname)
{
if(op == PM_OP_MAIN) {
- printf("usage: %s {-h --help}\n", myname);
- printf(" %s {-V --version}\n", myname);
- printf(" %s {-A --add} [options] <file>\n", myname);
- printf(" %s {-R --remove} [options] <package>\n", myname);
- printf(" %s {-U --upgrade} [options] <file>\n", myname);
- printf(" %s {-F --freshen} [options] <file>\n", myname);
- printf(" %s {-Q --query} [options] [package]\n", myname);
- printf(" %s {-S --sync} [options] [package]\n", myname);
- printf("\nuse '%s --help' with other options for more syntax\n", myname);
+ printf(_("usage: %s {-h --help}\n"), myname);
+ printf(_(" %s {-V --version}\n"), myname);
+ printf(_(" %s {-A --add} [options] <file>\n"), myname);
+ printf(_(" %s {-R --remove} [options] <package>\n"), myname);
+ printf(_(" %s {-U --upgrade} [options] <file>\n"), myname);
+ printf(_(" %s {-F --freshen} [options] <file>\n"), myname);
+ printf(_(" %s {-Q --query} [options] [package]\n"), myname);
+ printf(_(" %s {-S --sync} [options] [package]\n"), myname);
+ printf(_("\nuse '%s --help' with other options for more syntax\n"), myname);
} else {
if(op == PM_OP_ADD) {
- printf("usage: %s {-A --add} [options] <file>\n", myname);
- printf("options:\n");
- printf(" -d, --nodeps skip dependency checks\n");
- printf(" -f, --force force install, overwrite conflicting files\n");
+ printf(_("usage: %s {-A --add} [options] <file>\n"), myname);
+ printf(_("options:\n"));
+ printf(_(" -d, --nodeps skip dependency checks\n"));
+ printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_REMOVE) {
- printf("usage: %s {-R --remove} [options] <package>\n", myname);
- printf("options:\n");
- printf(" -c, --cascade remove packages and all packages that depend on them\n");
- printf(" -d, --nodeps skip dependency checks\n");
- printf(" -k, --dbonly only remove database entry, do not remove files\n");
- printf(" -n, --nosave remove configuration files as well\n");
- printf(" -s, --recursive remove dependencies also (that won't break packages)\n");
+ printf(_("usage: %s {-R --remove} [options] <package>\n"), myname);
+ printf(_("options:\n"));
+ printf(_(" -c, --cascade remove packages and all packages that depend on them\n"));
+ printf(_(" -d, --nodeps skip dependency checks\n"));
+ printf(_(" -k, --dbonly only remove database entry, do not remove files\n"));
+ printf(_(" -n, --nosave remove configuration files as well\n"));
+ printf(_(" -s, --recursive remove dependencies also (that won't break packages)\n"));
} else if(op == PM_OP_UPGRADE) {
if(config->flags & PM_TRANS_FLAG_FRESHEN) {
- printf("usage: %s {-F --freshen} [options] <file>\n", myname);
+ printf(_("usage: %s {-F --freshen} [options] <file>\n"), myname);
} else {
- printf("usage: %s {-U --upgrade} [options] <file>\n", myname);
+ printf(_("usage: %s {-U --upgrade} [options] <file>\n"), myname);
}
- printf("options:\n");
- printf(" -d, --nodeps skip dependency checks\n");
- printf(" -f, --force force install, overwrite conflicting files\n");
+ printf(_("options:\n"));
+ printf(_(" -d, --nodeps skip dependency checks\n"));
+ printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_QUERY) {
- printf("usage: %s {-Q --query} [options] [package]\n", myname);
- printf("options:\n");
- printf(" -e, --orphans list all packages that were explicitly installed\n");
- printf(" and are not required by any other packages\n");
- printf(" -g, --groups view all members of a package group\n");
- printf(" -i, --info view package information\n");
- printf(" -l, --list list the contents of the queried package\n");
- printf(" -m, --foreign list all packages that were not found in the sync repos\n");
- printf(" -o, --owns <file> query the package that owns <file>\n");
- printf(" -p, --file pacman will query the package file [package] instead of\n");
- printf(" looking in the database\n");
- printf(" -s, --search search locally-installed packages for matching strings\n");
+ printf(_("usage: %s {-Q --query} [options] [package]\n"), myname);
+ printf(_("options:\n"));
+ printf(_(" -e, --orphans list all packages that were explicitly installed\n"));
+ printf(_(" and are not required by any other packages\n"));
+ printf(_(" -g, --groups view all members of a package group\n"));
+ printf(_(" -i, --info view package information\n"));
+ printf(_(" -l, --list list the contents of the queried package\n"));
+ printf(_(" -m, --foreign list all packages that were not found in the sync repos\n"));
+ printf(_(" -o, --owns <file> query the package that owns <file>\n"));
+ printf(_(" -p, --file pacman will query the package file [package] instead of\n"));
+ printf(_(" looking in the database\n"));
+ printf(_(" -s, --search search locally-installed packages for matching strings\n"));
} else if(op == PM_OP_SYNC) {
- printf("usage: %s {-S --sync} [options] [package]\n", myname);
- printf("options:\n");
- printf(" -c, --clean remove old packages from cache directory (use -cc for all)\n");
- printf(" -d, --nodeps skip dependency checks\n");
- printf(" -f, --force force install, overwrite conflicting files\n");
- printf(" -g, --groups view all members of a package group\n");
- printf(" -p, --print-uris print out URIs for given packages and their dependencies\n");
- printf(" -s, --search search remote repositories for matching strings\n");
- printf(" -u, --sysupgrade upgrade all packages that are out of date\n");
- printf(" -w, --downloadonly download packages but do not install/upgrade anything\n");
- printf(" -y, --refresh download fresh package databases from the server\n");
- printf(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n");
+ printf(_("usage: %s {-S --sync} [options] [package]\n"), myname);
+ printf(_("options:\n"));
+ printf(_(" -c, --clean remove old packages from cache directory (use -cc for all)\n"));
+ printf(_(" -d, --nodeps skip dependency checks\n"));
+ printf(_(" -f, --force force install, overwrite conflicting files\n"));
+ printf(_(" -g, --groups view all members of a package group\n"));
+ printf(_(" -p, --print-uris print out URIs for given packages and their dependencies\n"));
+ printf(_(" -s, --search search remote repositories for matching strings\n"));
+ printf(_(" -u, --sysupgrade upgrade all packages that are out of date\n"));
+ printf(_(" -w, --downloadonly download packages but do not install/upgrade anything\n"));
+ printf(_(" -y, --refresh download fresh package databases from the server\n"));
+ printf(_(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n"));
}
- printf(" --config <path> set an alternate configuration file\n");
- printf(" --noconfirm do not ask for anything confirmation\n");
- printf(" --noprogressbar do not show a progress bar when downloading files\n");
- printf(" --noscriptlet do not execute the install scriptlet if there is any\n");
- printf(" -v, --verbose be verbose\n");
- printf(" -r, --root <path> set an alternate installation root\n");
- printf(" -b, --dbpath <path> set an alternate database location\n");
+ printf(_(" --config <path> set an alternate configuration file\n"));
+ printf(_(" --noconfirm do not ask for anything confirmation\n"));
+ printf(_(" --noprogressbar do not show a progress bar when downloading files\n"));
+ printf(_(" --noscriptlet do not execute the install scriptlet if there is any\n"));
+ printf(_(" -v, --verbose be verbose\n"));
+ printf(_(" -r, --root <path> set an alternate installation root\n"));
+ printf(_(" -b, --dbpath <path> set an alternate database location\n"));
}
}
@@ -284,7 +285,7 @@ static int parseargs(int argc, char *argv[])
break;
case 'r':
if(realpath(optarg, root) == NULL) {
- perror("bad root path");
+ perror(_("bad root path"));
return(1);
}
if(config->root) {
@@ -310,7 +311,7 @@ static int parseargs(int argc, char *argv[])
}
if(config->op == 0) {
- ERR(NL, "only one operation may be used at a time\n");
+ ERR(NL, _("only one operation may be used at a time\n"));
return(1);
}
@@ -342,7 +343,7 @@ static void cleanup(int signum)
/* free alpm library resources */
if(alpm_release() == -1) {
- ERR(NL, "%s\n", alpm_strerror(pm_errno));
+ ERR(NL, _("%s\n"), alpm_strerror(pm_errno));
}
/* free memory */
@@ -432,7 +433,7 @@ int main(int argc, char *argv[])
config->op_q_info)) || (config->op == PM_OP_DEPTEST && !config->op_d_resolve)) {
/* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */
} else {
- ERR(NL, "you cannot perform this operation unless you are root.\n");
+ ERR(NL, _("you cannot perform this operation unless you are root.\n"));
config_free(config);
exit(1);
}
@@ -456,7 +457,7 @@ int main(int argc, char *argv[])
/* initialize pm library */
if(alpm_initialize(config->root) == -1) {
- ERR(NL, "failed to initilize alpm library (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to initilize alpm library (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
@@ -469,11 +470,11 @@ int main(int argc, char *argv[])
/* set library parameters */
if(alpm_set_option(PM_OPT_LOGMASK, (long)config->debug) == -1) {
- ERR(NL, "failed to set option LOGMASK (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option LOGMASK (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
if(alpm_set_option(PM_OPT_LOGCB, (long)cb_log) == -1) {
- ERR(NL, "failed to set option LOGCB (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option LOGCB (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
if(config->dbpath == NULL) {
@@ -481,39 +482,39 @@ int main(int argc, char *argv[])
} else {
/* dbpath has been set by parseargs or parseconfig */
if(alpm_set_option(PM_OPT_DBPATH, (long)config->dbpath) == -1) {
- ERR(NL, "failed to set option DBPATH (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option DBPATH (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
}
if(alpm_set_option(PM_OPT_CACHEDIR, (long)config->cachedir) == -1) {
- ERR(NL, "failed to set option CACHEDIR (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option CACHEDIR (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
for(lp = config->op_s_ignore; lp; lp = lp->next) {
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) {
- ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
}
if(config->verbose > 0) {
- printf("Root : %s\n", config->root);
- printf("DBPath: %s\n", config->dbpath);
- list_display("Targets:", pm_targets);
+ printf(_("Root : %s\n"), config->root);
+ printf(_("DBPath: %s\n"), config->dbpath);
+ list_display(_("Targets:"), pm_targets);
}
/* Opening local database */
db_local = alpm_db_register("local");
if(db_local == NULL) {
- ERR(NL, "could not register 'local' database (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("could not register 'local' database (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
if(list_count(pm_targets) == 0 && !(config->op == PM_OP_QUERY || (config->op == PM_OP_SYNC
&& (config->op_s_sync || config->op_s_upgrade || config->op_s_clean || config->group
|| config->op_q_list)))) {
- ERR(NL, "no targets specified (use -h for help)\n");
+ ERR(NL, _("no targets specified (use -h for help)\n"));
cleanup(1);
}
@@ -526,7 +527,7 @@ int main(int argc, char *argv[])
case PM_OP_SYNC: ret = pacman_sync(pm_targets); break;
case PM_OP_DEPTEST: ret = pacman_deptest(pm_targets); break;
default:
- ERR(NL, "no operation specified (use -h for help)\n");
+ ERR(NL, _("no operation specified (use -h for help)\n"));
ret = 1;
}
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 3981eedf..233e61e7 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -24,6 +24,7 @@
#include <limits.h>
#include <string.h>
#include <sys/stat.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -52,12 +53,12 @@ static int query_fileowner(PM_DB *db, char *filename)
return(0);
}
if(filename == NULL || strlen(filename) == 0) {
- ERR(NL, "no file was specified for --owns\n");
+ ERR(NL, _("no file was specified for --owns\n"));
return(1);
}
if(stat(filename, &buf) == -1 || S_ISDIR(buf.st_mode) || realpath(filename, rpath) == NULL) {
- ERR(NL, "%s is not a file.\n", filename);
+ ERR(NL, _("%s is not a file.\n"), filename);
return(1);
}
@@ -74,7 +75,7 @@ static int query_fileowner(PM_DB *db, char *filename)
snprintf(path, PATH_MAX, "%s%s", root, (char *)alpm_list_getdata(i));
if(!strcmp(path, rpath)) {
- printf("%s is owned by %s %s\n", filename, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
+ printf(_("%s is owned by %s %s\n"), filename, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(info, PM_PKG_VERSION));
gotcha = 1;
break;
@@ -82,7 +83,7 @@ static int query_fileowner(PM_DB *db, char *filename)
}
}
if(!gotcha) {
- ERR(NL, "No package owns %s\n", filename);
+ ERR(NL, _("No package owns %s\n"), filename);
return(1);
}
@@ -107,7 +108,7 @@ int pacman_query(list_t *targets)
if(config->op_q_foreign) {
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
- ERR(NL, "no usable package repositories configured.\n");
+ ERR(NL, _("no usable package repositories configured.\n"));
return(1);
}
@@ -156,7 +157,7 @@ int pacman_query(list_t *targets)
MSG(NL, "%s %s\n", package, (char *)alpm_list_getdata(i));
}
} else {
- ERR(NL, "group \"%s\" was not found\n", package);
+ ERR(NL, _("group \"%s\" was not found\n"), package);
return(2);
}
}
@@ -166,11 +167,11 @@ int pacman_query(list_t *targets)
/* output info for a .tar.gz package */
if(config->op_q_isfile) {
if(package == NULL) {
- ERR(NL, "no package file was specified for --file\n");
+ ERR(NL, _("no package file was specified for --file\n"));
return(1);
}
if(alpm_pkg_load(package, &info) == -1) {
- ERR(NL, "failed to load package '%s' (%s)\n", package, alpm_strerror(pm_errno));
+ ERR(NL, _("failed to load package '%s' (%s)\n"), package, alpm_strerror(pm_errno));
return(1);
}
if(config->op_q_info) {
@@ -208,7 +209,7 @@ int pacman_query(list_t *targets)
info = alpm_db_readpkg(db_local, pkgname);
if(info == NULL) {
/* something weird happened */
- ERR(NL, "package \"%s\" not found\n", pkgname);
+ ERR(NL, _("package \"%s\" not found\n"), pkgname);
return(1);
}
if(config->op_q_foreign) {
@@ -252,7 +253,7 @@ int pacman_query(list_t *targets)
info = alpm_db_readpkg(db_local, package);
if(info == NULL) {
- ERR(NL, "package \"%s\" not found\n", package);
+ ERR(NL, _("package \"%s\" not found\n"), package);
return(2);
}
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 5c8568ca..2092ccf0 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -60,11 +61,11 @@ int pacman_remove(list_t *targets)
pkgnames = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES);
- MSG(NL, ":: group %s:\n", alpm_grp_getinfo(grp, PM_GRP_NAME));
+ MSG(NL, _(":: group %s:\n"), alpm_grp_getinfo(grp, PM_GRP_NAME));
PM_LIST_display(" ", pkgnames);
- all = yesno(" Remove whole content? [Y/n] ");
+ all = yesno(_(" Remove whole content? [Y/n] "));
for(lp = alpm_list_first(pkgnames); lp; lp = alpm_list_next(lp)) {
- if(all || yesno(":: Remove %s from group %s? [Y/n] ", (char *)alpm_list_getdata(lp), i->data)) {
+ if(all || yesno(_(":: Remove %s from group %s? [Y/n] "), (char *)alpm_list_getdata(lp), i->data)) {
finaltargs = list_add(finaltargs, strdup(alpm_list_getdata(lp)));
}
}
@@ -77,10 +78,10 @@ int pacman_remove(list_t *targets)
/* Step 1: create a new transaction
*/
if(alpm_trans_init(PM_TRANS_TYPE_REMOVE, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
- ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
- MSG(NL, " if you're sure a package manager is not already running,\n"
- " you can remove %s\n", PM_LOCK);
+ MSG(NL, _(" if you're sure a package manager is not already running,\n"
+ " you can remove %s\n"), PM_LOCK);
}
FREELIST(finaltargs);
return(1);
@@ -90,12 +91,12 @@ int pacman_remove(list_t *targets)
/* check if the package is in the HoldPkg list. If so, ask
* confirmation first */
if(list_is_strin(i->data, config->holdpkg)) {
- if(!yesno(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] ", i->data)) {
+ if(!yesno(_(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "), i->data)) {
return(1);
}
}
if(alpm_trans_addtarget(i->data) == -1) {
- ERR(NL, "failed to add target '%s' (%s)\n", (char *)i->data, alpm_strerror(pm_errno));
+ ERR(NL, _("failed to add target '%s' (%s)\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -105,12 +106,12 @@ int pacman_remove(list_t *targets)
*/
if(alpm_trans_prepare(&data) == -1) {
PM_LIST *lp;
- ERR(NL, "failed to prepare transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
- MSG(NL, " %s: is required by %s\n", alpm_dep_getinfo(miss, PM_DEP_TARGET),
+ MSG(NL, _(" %s: is required by %s\n"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
alpm_dep_getinfo(miss, PM_DEP_NAME));
}
alpm_list_free(data);
@@ -132,10 +133,10 @@ int pacman_remove(list_t *targets)
PM_PKG *pkg = alpm_list_getdata(lp);
i = list_add(i, strdup(alpm_pkg_getinfo(pkg, PM_PKG_NAME)));
}
- list_display("\nTargets:", i);
+ list_display(_("\nTargets:"), i);
FREELIST(i);
/* get confirmation */
- if(yesno("\nDo you want to remove these packages? [Y/n] ") == 0) {
+ if(yesno(_("\nDo you want to remove these packages? [Y/n] ")) == 0) {
retval = 1;
goto cleanup;
}
@@ -145,7 +146,7 @@ int pacman_remove(list_t *targets)
/* Step 3: actually perform the removal
*/
if(alpm_trans_commit(NULL) == -1) {
- ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -156,7 +157,7 @@ cleanup:
FREELIST(finaltargs);
if(alpm_trans_release() == -1) {
- ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index fc1ccfe3..c25ef17f 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
+#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
@@ -64,10 +65,10 @@ static int sync_cleancache(int level)
list_t *clean = NULL;
list_t *i, *j;
- MSG(NL, "removing old packages from cache... ");
+ MSG(NL, _("removing old packages from cache... "));
dir = opendir(dirpath);
if(dir == NULL) {
- ERR(NL, "could not access cache directory\n");
+ ERR(NL, _("could not access cache directory\n"));
return(1);
}
rewinddir(dir);
@@ -127,20 +128,20 @@ static int sync_cleancache(int level)
FREELIST(clean);
} else {
/* full cleanup */
- MSG(NL, "removing all packages from cache... ");
+ MSG(NL, _("removing all packages from cache... "));
if(rmrf(dirpath)) {
- ERR(NL, "could not remove cache directory\n");
+ ERR(NL, _("could not remove cache directory\n"));
return(1);
}
if(makepath(dirpath)) {
- ERR(NL, "could not create new cache directory\n");
+ ERR(NL, _("could not create new cache directory\n"));
return(1);
}
}
- MSG(CL, "done.\n");
+ MSG(CL, _("done.\n"));
return(0);
}
@@ -164,7 +165,7 @@ static int sync_synctree(int level, list_t *syncs)
/* get the lastupdate time */
db_getlastupdate(sync->db, lastupdate);
if(strlen(lastupdate) == 0) {
- vprint("failed to get lastupdate time for %s (no big deal)\n", sync->treename);
+ vprint(_("failed to get lastupdate time for %s (no big deal)\n"), sync->treename);
}
}
@@ -177,18 +178,18 @@ static int sync_synctree(int level, list_t *syncs)
ret = downloadfiles_forreal(sync->servers, path, files, lastupdate, newmtime);
FREELIST(files);
if(ret > 0) {
- ERR(NL, "failed to synchronize %s\n", sync->treename);
+ ERR(NL, _("failed to synchronize %s\n"), sync->treename);
success--;
} else if(ret < 0) {
- MSG(NL, " %s is up to date\n", sync->treename);
+ MSG(NL, _(" %s is up to date\n"), sync->treename);
} else {
if(strlen(newmtime)) {
- vprint("sync: new mtime for %s: %s\n", sync->treename, newmtime);
+ vprint(_("sync: new mtime for %s: %s\n"), sync->treename, newmtime);
db_setlastupdate(sync->db, newmtime);
}
snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename);
if(alpm_db_update(sync->db, path) == -1) {
- ERR(NL, "failed to update %s (%s)\n", sync->treename, alpm_strerror(pm_errno));
+ ERR(NL, _("failed to update %s (%s)\n"), sync->treename, alpm_strerror(pm_errno));
}
/* remove the .tar.gz */
unlink(path);
@@ -214,7 +215,7 @@ static int sync_search(list_t *syncs, list_t *targets)
for(lp = alpm_db_getpkgcache(sync->db); lp; lp = alpm_list_next(lp)) {
PM_PKG *pkg = alpm_list_getdata(lp);
- MSG(NL, "%s/%s %s\n ", sync->treename, (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
+ MSG(NL, _("%s/%s %s\n "), sync->treename, (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 4);
MSG(NL, "\n");
}
@@ -282,7 +283,7 @@ static int sync_info(list_t *syncs, list_t *targets)
}
}
if(!found) {
- ERR(NL, "package \"%s\" was not found.\n", (char *)i->data);
+ ERR(NL, _("package \"%s\" was not found.\n"), (char *)i->data);
break;
}
}
@@ -320,7 +321,7 @@ static int sync_list(list_t *syncs, list_t *targets)
}
if(sync == NULL) {
- ERR(NL, "repository \"%s\" was not found.\n", (char *)i->data);
+ ERR(NL, _("repository \"%s\" was not found.\n"), (char *)i->data);
FREELISTPTR(ls);
return(1);
}
@@ -361,7 +362,7 @@ int pacman_sync(list_t *targets)
list_t *files = NULL;
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
- ERR(NL, "no usable package repositories configured.\n");
+ ERR(NL, _("no usable package repositories configured.\n"));
return(1);
}
@@ -381,8 +382,8 @@ int pacman_sync(list_t *targets)
if(config->op_s_sync) {
/* grab a fresh package list */
- MSG(NL, ":: Synchronizing package databases...\n");
- alpm_logaction("synchronizing package lists");
+ MSG(NL, _(":: Synchronizing package databases...\n"));
+ alpm_logaction(_("synchronizing package lists"));
if(sync_synctree(config->op_s_sync, pmc_syncs)) {
return(1);
}
@@ -407,17 +408,17 @@ int pacman_sync(list_t *targets)
/* Step 1: create a new transaction...
*/
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
- ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
- MSG(NL, " if you're sure a package manager is not already running,\n"
- " you can remove %s\n", PM_LOCK);
+ MSG(NL, _(" if you're sure a package manager is not already running,\n"
+ " you can remove %s\n"), PM_LOCK);
}
return(1);
}
if(config->op_s_upgrade) {
- MSG(NL, ":: Starting local database upgrade...\n");
- alpm_logaction("starting full system upgrade");
+ MSG(NL, _(":: Starting local database upgrade...\n"));
+ alpm_logaction(_("starting full system upgrade"));
if(alpm_trans_sysupgrade() == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno));
retval = 1;
@@ -435,26 +436,26 @@ int pacman_sync(list_t *targets)
PM_SYNCPKG *sync = alpm_list_getdata(lp);
PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
if(!strcmp("pacman", alpm_pkg_getinfo(spkg, PM_PKG_NAME)) && alpm_list_count(data) > 1) {
- MSG(NL, "\n:: pacman has detected a newer version of the \"pacman\" package.\n");
- MSG(NL, ":: It is recommended that you allow pacman to upgrade itself\n");
- MSG(NL, ":: first, then you can re-run the operation with the newer version.\n");
- MSG(NL, "::\n");
- if(yesno(":: Upgrade pacman first? [Y/n] ")) {
+ MSG(NL, _("\n:: pacman has detected a newer version of the \"pacman\" package.\n"));
+ MSG(NL, _(":: It is recommended that you allow pacman to upgrade itself\n"));
+ MSG(NL, _(":: first, then you can re-run the operation with the newer version.\n"));
+ MSG(NL, _("::\n"));
+ if(yesno(_(":: Upgrade pacman first? [Y/n] "))) {
if(alpm_trans_release() == -1) {
- ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
- ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
- MSG(NL, " if you're sure a package manager is not already running,\n"
- " you can remove %s\n", PM_LOCK);
+ MSG(NL, _(" if you're sure a package manager is not already running,\n"
+ " you can remove %s\n"), PM_LOCK);
}
return(1);
}
if(alpm_trans_addtarget("pacman") == -1) {
- ERR(NL, "could not add target '%s': %s\n", (char *)i->data, alpm_strerror(pm_errno));
+ ERR(NL, _("could not add target '%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -474,7 +475,7 @@ int pacman_sync(list_t *targets)
continue;
}
if(pm_errno != PM_ERR_PKG_NOT_FOUND) {
- ERR(NL, "could not add target '%s': %s\n", (char *)i->data, alpm_strerror(pm_errno));
+ ERR(NL, _("could not add target '%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -485,20 +486,20 @@ int pacman_sync(list_t *targets)
if(grp) {
PM_LIST *pmpkgs;
list_t *k, *pkgs;
- MSG(NL, ":: group %s:\n", targ);
+ MSG(NL, _(":: group %s:\n"), targ);
pmpkgs = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES);
/* remove dupe entries in case a package exists in multiple repos */
/* (the dupe function takes a PM_LIST* and returns a list_t*) */
pkgs = PM_LIST_remove_dupes(pmpkgs);
list_display(" ", pkgs);
- if(yesno(":: Install whole content? [Y/n] ")) {
+ if(yesno(_(":: Install whole content? [Y/n] "))) {
for(k = pkgs; k; k = k->next) {
targets = list_add(targets, strdup(k->data));
}
} else {
for(k = pkgs; k; k = k->next) {
char *pkgname = k->data;
- if(yesno(":: Install %s from group %s? [Y/n] ", pkgname, targ)) {
+ if(yesno(_(":: Install %s from group %s? [Y/n] "), pkgname, targ)) {
targets = list_add(targets, strdup(pkgname));
}
}
@@ -518,13 +519,13 @@ int pacman_sync(list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags
*/
if(alpm_trans_prepare(&data) == -1) {
- ERR(NL, "failed to prepare transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
- MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
- (int)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? "requires" : "is required by",
+ MSG(NL, _(":: %s: %s %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
+ (int)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -589,7 +590,7 @@ int pacman_sync(list_t *targets)
list_install = list_add(list_install, str);
}
if(list_remove) {
- MSG(NL, "\nRemove: ");
+ MSG(NL, _("\nRemove: "));
str = buildstring(list_remove);
indentprint(str, 9);
MSG(CL, "\n");
@@ -601,20 +602,20 @@ int pacman_sync(list_t *targets)
if(mb < 0.1) {
mb = 0.1;
}
- MSG(NL, "\nTargets: ");
+ MSG(NL, _("\nTargets: "));
str = buildstring(list_install);
indentprint(str, 9);
- MSG(NL, "\nTotal Package Size: %.1f MB\n", mb);
+ MSG(NL, _("\nTotal Package Size: %.1f MB\n"), mb);
FREELIST(list_install);
FREE(str);
if(config->op_s_downloadonly) {
if(config->noconfirm) {
- MSG(NL, "\nBeginning download...\n");
+ MSG(NL, _("\nBeginning download...\n"));
confirm = 1;
} else {
MSG(NL, "\n");
- confirm = yesno("Proceed with download? [Y/n] ");
+ confirm = yesno(_("Proceed with download? [Y/n] "));
}
} else {
/* don't get any confirmation if we're called from makepkg */
@@ -622,11 +623,11 @@ int pacman_sync(list_t *targets)
confirm = 1;
} else {
if(config->noconfirm) {
- MSG(NL, "\nBeginning upgrade process...\n");
+ MSG(NL, _("\nBeginning upgrade process...\n"));
confirm = 1;
} else {
MSG(NL, "\n");
- confirm = yesno("Proceed with upgrade? [Y/n] ");
+ confirm = yesno(_("Proceed with upgrade? [Y/n] "));
}
}
}
@@ -672,7 +673,7 @@ int pacman_sync(list_t *targets)
snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver);
files = list_add(files, strdup(path));
} else {
- vprint(" %s-%s" PM_EXT_PKG " is already in the cache\n", pkgname, pkgver);
+ vprint(_(" %s-%s" PM_EXT_PKG " is already in the cache\n"), pkgname, pkgver);
}
}
}
@@ -680,28 +681,28 @@ int pacman_sync(list_t *targets)
if(files) {
struct stat buf;
- MSG(NL, "\n:: Retrieving packages from %s...\n", current->treename);
+ MSG(NL, _("\n:: Retrieving packages from %s...\n"), current->treename);
fflush(stdout);
if(stat(ldir, &buf)) {
/* no cache directory.... try creating it */
- WARN(NL, "no %s cache exists. creating...\n", ldir);
- alpm_logaction("warning: no %s cache exists. creating...", ldir);
+ WARN(NL, _("no %s cache exists. creating...\n"), ldir);
+ alpm_logaction(_("warning: no %s cache exists. creating..."), ldir);
if(makepath(ldir)) {
/* couldn't mkdir the cache directory, so fall back to /tmp and unlink
* the package afterwards.
*/
- WARN(NL, "couldn't create package cache, using /tmp instead");
- alpm_logaction("warning: couldn't create package cache, using /tmp instead");
+ WARN(NL, _("couldn't create package cache, using /tmp instead"));
+ alpm_logaction(_("warning: couldn't create package cache, using /tmp instead"));
snprintf(ldir, PATH_MAX, "/tmp");
if(alpm_set_option(PM_OPT_CACHEDIR, (long)ldir) == -1) {
- ERR(NL, "failed to set option CACHEDIR (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to set option CACHEDIR (%s)\n"), alpm_strerror(pm_errno));
goto cleanup;
}
varcache = 0;
}
}
if(downloadfiles(current->servers, ldir, files)) {
- ERR(NL, "failed to retrieve some files from %s\n", current->treename);
+ ERR(NL, _("failed to retrieve some files from %s\n"), current->treename);
retval = 1;
goto cleanup;
}
@@ -714,16 +715,16 @@ int pacman_sync(list_t *targets)
MSG(NL, "\n");
/* Check integrity of files */
- MSG(NL, "checking package integrity... ");
+ MSG(NL, _("checking package integrity... "));
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
PM_SYNCPKG *sync = alpm_list_getdata(lp);
PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
if(alpm_pkg_checkmd5sum(spkg) == -1) {
if(pm_errno == PM_ERR_PKG_INVALID) {
- ERR(NL, "archive %s is corrupted\n", alpm_pkg_getinfo(spkg, PM_PKG_NAME));
+ ERR(NL, _("archive %s is corrupted\n"), alpm_pkg_getinfo(spkg, PM_PKG_NAME));
} else {
- ERR(NL, "could not get checksum for package %s (%s)\n",
+ ERR(NL, _("could not get checksum for package %s (%s)\n"),
alpm_pkg_getinfo(spkg, PM_PKG_NAME), alpm_strerror(pm_errno));
}
retval = 1;
@@ -732,7 +733,7 @@ int pacman_sync(list_t *targets)
if(retval) {
goto cleanup;
}
- MSG(CL, "done.\n");
+ MSG(CL, _("done.\n"));
if(config->op_s_downloadonly) {
goto cleanup;
@@ -741,27 +742,27 @@ int pacman_sync(list_t *targets)
/* Step 3: actually perform the installation
*/
if(alpm_trans_commit(&data) == -1) {
- ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_FILE_CONFLICTS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_CONFLICT *conflict = alpm_list_getdata(lp);
switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET:
- MSG(NL, "%s exists in \"%s\" (target) and \"%s\" (target)",
+ MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break;
case PM_CONFLICT_TYPE_FILE:
- MSG(NL, "%s: %s exists in filesystem",
+ MSG(NL, _("%s: %s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break;
}
}
alpm_list_free(data);
- MSG(NL, "\nerrors occurred, no packages were upgraded.\n");
+ MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
default:
break;
@@ -781,7 +782,7 @@ int pacman_sync(list_t *targets)
*/
cleanup:
if(alpm_trans_release() == -1) {
- ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
+ ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
}
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index 4f9f68e7..279d431a 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
+#include <libintl.h>
#include <alpm.h>
/* pacman */
@@ -47,49 +48,49 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START:
- MSG(NL, "checking dependencies... ");
+ MSG(NL, _("checking dependencies... "));
break;
case PM_TRANS_EVT_FILECONFLICTS_START:
- MSG(NL, "checking for file conflicts... ");
+ MSG(NL, _("checking for file conflicts... "));
break;
case PM_TRANS_EVT_RESOLVEDEPS_START:
- MSG(NL, "resolving dependencies... ");
+ MSG(NL, _("resolving dependencies... "));
break;
case PM_TRANS_EVT_INTERCONFLICTS_START:
- MSG(NL, "looking for inter-conflicts... ");
+ MSG(NL, _("looking for inter-conflicts... "));
break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
case PM_TRANS_EVT_FILECONFLICTS_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE:
case PM_TRANS_EVT_INTERCONFLICTS_DONE:
- MSG(CL, "done.\n");
+ MSG(CL, _("done.\n"));
break;
case PM_TRANS_EVT_ADD_START:
- MSG(NL, "installing %s... ", (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ MSG(NL, _("installing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
break;
case PM_TRANS_EVT_ADD_DONE:
- MSG(CL, "done.\n");
- snprintf(str, LOG_STR_LEN, "installed %s (%s)",
+ MSG(CL, _("done.\n"));
+ snprintf(str, LOG_STR_LEN, _("installed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str);
break;
case PM_TRANS_EVT_REMOVE_START:
- MSG(NL, "removing %s... ", (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ MSG(NL, _("removing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
break;
case PM_TRANS_EVT_REMOVE_DONE:
- MSG(CL, "done.\n");
- snprintf(str, LOG_STR_LEN, "removed %s (%s)",
+ MSG(CL, _("done.\n"));
+ snprintf(str, LOG_STR_LEN, _("removed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str);
break;
case PM_TRANS_EVT_UPGRADE_START:
- MSG(NL, "upgrading %s... ", (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ MSG(NL, _("upgrading %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
break;
case PM_TRANS_EVT_UPGRADE_DONE:
- MSG(CL, "done.\n");
- snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)",
+ MSG(CL, _("done.\n"));
+ snprintf(str, LOG_STR_LEN, _("upgraded %s (%s -> %s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
@@ -104,20 +105,20 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
switch(event) {
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
- snprintf(str, LOG_STR_LEN, ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] ",
+ snprintf(str, LOG_STR_LEN, _(":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
*response = yesno(str);
break;
case PM_TRANS_CONV_REPLACE_PKG:
- snprintf(str, LOG_STR_LEN, ":: Replace %s with %s/%s? [Y/n] ",
+ snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)data3,
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
*response = yesno(str);
break;
case PM_TRANS_CONV_CONFLICT_PKG:
- snprintf(str, LOG_STR_LEN, ":: %s conflicts with %s. Remove %s? [Y/n] ",
+ snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
(char *)data1,
(char *)data2,
(char *)data2);
@@ -125,7 +126,7 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
break;
case PM_TRANS_CONV_LOCAL_NEWER:
if(!config->op_s_downloadonly) {
- snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ",
+ snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
*response = yesno(str);
@@ -135,7 +136,7 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
break;
case PM_TRANS_CONV_LOCAL_UPTODATE:
if(!config->op_s_downloadonly) {
- snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] ",
+ snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
*response = yesno(str);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index ef6c0f82..aefdea9b 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -30,6 +30,7 @@
#include <dirent.h>
#include <unistd.h>
#include <regex.h>
+#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
@@ -168,7 +169,7 @@ char *buildstring(list_t *strlist)
}
str = (char *)malloc(size);
if(str == NULL) {
- ERR(NL, "failed to allocated %d bytes\n", size);
+ ERR(NL, _("failed to allocated %d bytes\n"), size);
}
str[0] = '\0';
for(lp = strlist; lp; lp = lp->next) {
@@ -222,7 +223,7 @@ int reg_match(char *string, char *pattern)
regex_t reg;
if(regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) {
- ERR(NL, "%s is not a valid regular expression.\n", pattern);
+ ERR(NL, _("%s is not a valid regular expression.\n"), pattern);
return(-1);
}
result = regexec(&reg, string, 0, 0, 0);
diff --git a/src/pacman/util.h b/src/pacman/util.h
index 96b38736..51e05fd3 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -42,6 +42,8 @@
s1[(len)-1] = 0; \
} while(0)
+#define _(str) gettext(str)
+
int makepath(char *path);
int rmrf(char *path);
void indentprint(char *str, int indent);