wmtime: Add -l option to specify locale.
Based on a similar patch for wmitime [1].
[1] cc801880a5
This commit is contained in:
parent
ad27c973c1
commit
ea19c5c3ca
|
@ -16,10 +16,10 @@ Installation
|
|||
use Latin alphabet characters, then WMTime defaults to
|
||||
US/English.
|
||||
|
||||
You may change this behavior by setting the LANG
|
||||
environment variable, e.g.,
|
||||
You may change this behavior by using the '-l' command line
|
||||
option, e.g.,
|
||||
|
||||
% LANG=es_MX.UTF-8 wmtime
|
||||
% wmtime -l es_MX.utf8
|
||||
|
||||
Be sure to read the HINTS and TODO files too!
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
.\" USA.
|
||||
.\"
|
||||
.TH WMTIME 1 "October 2013" "WMTIME 1.1"
|
||||
.TH WMTIME 1 "January 2015" "WMTIME 1.1"
|
||||
|
||||
.SH NAME
|
||||
wmtime \- Window Maker dockapp that displays the time and date
|
||||
|
@ -69,6 +69,10 @@ This option specifies the preferred position of clock; see
|
|||
.BR \-n , \ \-noseconds
|
||||
Disables the second hand.
|
||||
|
||||
.TP
|
||||
.BI \-l \ locale
|
||||
Specify locale.
|
||||
|
||||
.TP
|
||||
.B \-h
|
||||
Show help information.
|
||||
|
|
|
@ -114,6 +114,9 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
int i;
|
||||
char *name = argv[0];
|
||||
char locale[256];
|
||||
|
||||
locale[0] = 0;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
char *arg = argv[i];
|
||||
|
@ -146,6 +149,12 @@ int main(int argc, char *argv[]) {
|
|||
case 'v' :
|
||||
printversion();
|
||||
return 0;
|
||||
case 'l':
|
||||
if (argc > i+1) {
|
||||
strcpy(locale, argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage(name);
|
||||
return 1;
|
||||
|
@ -153,7 +162,10 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
if (setlocale(LC_ALL, "") != NULL)
|
||||
if (setlocale(LC_ALL, locale) == NULL)
|
||||
fprintf(stderr,
|
||||
"warning: locale '%s' not recognized; defaulting to '%s'.",
|
||||
locale, setlocale(LC_ALL, NULL));
|
||||
get_lang();
|
||||
|
||||
wmtime_routine(argc, argv);
|
||||
|
@ -675,6 +687,7 @@ void usage(char *name) {
|
|||
printf(" -display DISPLAY contact the DISPLAY X server\n");
|
||||
printf(" -geometry GEOMETRY position the clock at GEOMETRY\n");
|
||||
printf(" -n, -noseconds disables the second hand\n");
|
||||
printf(" -l LOCALE set locale to LOCALE\n");
|
||||
printf(" -h display this help and exit\n");
|
||||
printf(" -v output version information and exit\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue