diff options
author | Dan McGee <dan@archlinux.org> | 2007-02-13 01:50:18 +0000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-02-13 01:50:18 +0000 |
commit | 3da9fb537a0711ee12f66421703e5529ea5fca6a (patch) | |
tree | c2d0118c42a38e87953fc514090b6e260566f010 | |
parent | af48c695eb154410cf6f69c7aa9baf92a33a752c (diff) |
Fixed locale setting issues in the frontend, and fixed description of --cachedir.
-rw-r--r-- | src/pacman/pacman.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index eebbdaaa..31cd75a8 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -155,7 +155,7 @@ static void usage(int op, char *myname) 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(_(" --cachedir <dir> set an alternate database location\n")); + printf(_(" --cachedir <dir> set an alternate package cache location\n")); } } @@ -435,13 +435,15 @@ int main(int argc, char *argv[]) signal(SIGSEGV, cleanup); /* i18n init */ - lang=getenv("LC_ALL"); - if(lang==NULL || lang[0]=='\0') - lang=getenv("LC_MESSAGES"); - if (lang==NULL || lang[0]=='\0') - lang=getenv("LANG"); + lang = setlocale(LC_ALL, ""); + /* if setlocale returns null, the locale was invalid- override it */ + if (lang == NULL) { + lang = "C"; + setlocale(LC_ALL, "C"); + setenv("LC_ALL", lang, 1); + MSG(NL, _("warning: default locale is invalid; using default \"C\" locale")); + } - setlocale(LC_ALL, lang); /* workaround for tr_TR */ if(lang && !strcmp(lang, "tr_TR")) setlocale(LC_CTYPE, "C"); |