wmtime: Fixed Debian bug #661843. Applied a patch by Milan Cermak.

Package: wmtime
Version: 1.0b3-2
Severity: normal
Tags: upstream patch l10n

Hi,
the package wmtime claims that it supports localization. Looking into the code,
it seems more like date customization.
When claiming "localization", it should work as such - respecting LANG, LC_ALL,
etc. environment variables and use locales for the day and month abbreviations.

Please see my patch which adds such support.
Regards,
Milan Cermak

-- System Information:
Debian Release: 6.0.4
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37.6 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages wmtime depends on:
ii  libc6                         2.11.3-2   Embedded GNU C Library: Shared lib
ii  libx11-6                      2:1.3.3-4  X11 client-side library
ii  libxext6                      2:1.1.2-1  X11 miscellaneous extension librar
ii  libxpm4                       1:3.5.8-1  X11 pixmap library

wmtime recommends no packages.

wmtime suggests no packages.

-- no debconf information
This commit is contained in:
Doug Torrance 2012-10-30 13:56:52 -07:00 committed by Carlos R. Mafra
parent 2295cacec4
commit 13243aa489

View file

@ -65,6 +65,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <math.h> #include <math.h>
#include <locale.h>
#include <langinfo.h>
#include <iconv.h>
#include <ctype.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/param.h> #include <sys/param.h>
@ -148,7 +152,10 @@ int main(int argc, char *argv[]) {
} }
} }
} }
get_lang();
if (setlocale(LC_ALL, "") != NULL)
get_lang();
wmtime_routine(argc, argv); wmtime_routine(argc, argv);
return 0; return 0;
} }
@ -156,26 +163,44 @@ int main(int argc, char *argv[]) {
/************/ /************/
/* get_lang */ /* get_lang */
/************/ /************/
void get_lang(){ void get_lang(void)
FILE *fp; {
int i; char langbuf[10], outbuf[10];
const int line_size = 5; char *inp, *outp;
char line[line_size]; iconv_t icd;
int i, ret;
size_t insize, outsize;
fp=fopen("language","r"); icd = iconv_open("ASCII//TRANSLIT", nl_langinfo(CODESET));
if (fp) { if (icd < 0)
/* Grab the days of the week */ return;
for (i=0;i<7;i++){
fgets(line, line_size, fp); for (i = 0; i < 7; i++) {
strncpy(day_of_week[i], line, 2); strncpy(langbuf, nl_langinfo(ABDAY_1 + i), 10);
}; insize = outsize = 10;
/* Grab the names of the months */ inp = langbuf;
for (i=0;i<12;i++){ outp = outbuf;
fgets(line, line_size, fp); do {
strncpy(mon_of_year[i], line, 3); ret = iconv(icd, &inp, &insize, &outp, &outsize);
}; } while (outsize > 0 && ret > 0);
fclose(fp); for (outp = outbuf, outsize = 0; *outp != 0 && outsize < 2;
}; outp++, outsize++)
day_of_week[i][outsize] = toupper(*outp);
}
for (i = 0; i < 12; i++) {
strncpy(langbuf, nl_langinfo(ABMON_1 + i), 10);
insize = outsize = 10;
inp = langbuf;
outp = outbuf;
do {
ret = iconv(icd, &inp, &insize, &outp, &outsize);
} while (outsize > 0 && ret > 0);
for (outp = outbuf, outsize = 0; *outp != 0 && outsize < 3;
outp++, outsize++)
mon_of_year[i][outsize] = toupper(*outp);
}
iconv_close(icd);
} }
/*******************************************************************************\ /*******************************************************************************\