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