1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Ensure all localization stuff is correctly guarded

Anything dealing with libintl and localization should be correctly guarded
inside an ENABLE_NLS block on both the pacman and libalpm sides.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-10-22 23:52:55 -05:00
parent 0c4f7d821c
commit 8b1fb61df2
4 changed files with 14 additions and 6 deletions

View File

@ -52,7 +52,10 @@ int SYMEXPORT alpm_initialize(void)
if(handle == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
#ifdef ENABLE_NLS
bindtextdomain("libalpm", LOCALEDIR);
#endif
return(0);
}

View File

@ -25,6 +25,8 @@
#ifndef _ALPM_UTIL_H
#define _ALPM_UTIL_H
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <time.h>

View File

@ -30,7 +30,6 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/utsname.h> /* uname */
#include <libintl.h> /* bindtextdomain, textdomain */
#include <locale.h> /* setlocale */
#include <time.h> /* time_t */
#if defined(PACMAN_DEBUG) && defined(HAVE_MTRACE)
@ -168,6 +167,7 @@ static void version(void)
/** Sets up gettext localization. Safe to call multiple times.
*/
/* Inspired by the monotone function localize_monotone. */
#if defined(ENABLE_NLS)
static void localize(void)
{
static int init = 0;
@ -178,6 +178,7 @@ static void localize(void)
init = 1;
}
}
#endif
/** Set user agent environment variable.
*/
@ -730,7 +731,9 @@ int main(int argc, char *argv[])
signal(SIGSEGV, cleanup);
/* i18n init */
#if defined(ENABLE_NLS)
localize();
#endif
/* set user agent for downloading */
setuseragent();

View File

@ -24,20 +24,20 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <libintl.h> /* here so it doesn't need to be included elsewhere */
#include <alpm_list.h>
/* update speed for the fill_progress based functions */
#define UPDATE_SPEED_SEC 0.2f
/* define _() as shortcut for gettext() */
#ifdef ENABLE_NLS
#include <libintl.h> /* here so it doesn't need to be included elsewhere */
/* define _() as shortcut for gettext() */
#define _(str) gettext(str)
#else
#define _(str) str
#endif
/* update speed for the fill_progress based functions */
#define UPDATE_SPEED_SEC 0.2f
int needs_transaction();
int getcols();
int makepath(const char *path);