src/custom.c: Use status_ask_simplechoice()
This eases up i18n somewhat, since the various date format available are used on other places as well, and thus need to be translated only once. Note that this commit incidentally fixes a small bug introduced by 38912b36: the user was able to set the date input format to a number between 1 and 5, while there are only 4 such formats available. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
72995601e7
commit
7eb3abb08a
25
src/custom.c
25
src/custom.c
@ -714,12 +714,17 @@ void custom_general_config(void)
|
|||||||
const char *keys = _("(Press '^P' or '^N' to move up or down, 'Q' to quit)");
|
const char *keys = _("(Press '^P' or '^N' to move up or down, 'Q' to quit)");
|
||||||
const char *output_datefmt_str =
|
const char *output_datefmt_str =
|
||||||
_("Enter the date format (see 'man 3 strftime' for possible formats) ");
|
_("Enter the date format (see 'man 3 strftime' for possible formats) ");
|
||||||
const char *input_datefmt_str =
|
const char *input_datefmt_prefix = _("Enter the date format: ");
|
||||||
_("Enter the date format (1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd "
|
const char *input_datefmt_choices[] = {
|
||||||
"(4)yyyy-mm-dd");
|
_("mm/dd/yyyy"),
|
||||||
|
_("dd/mm/yyyy"),
|
||||||
|
_("yyyy/mm/dd"),
|
||||||
|
_("yyyy-mm-dd")
|
||||||
|
};
|
||||||
const char *periodic_save_str =
|
const char *periodic_save_str =
|
||||||
_("Enter the delay, in minutes, between automatic saves (0 to disable) ");
|
_("Enter the delay, in minutes, between automatic saves (0 to disable) ");
|
||||||
int ch;
|
int ch;
|
||||||
|
int val;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
@ -751,7 +756,7 @@ void custom_general_config(void)
|
|||||||
case '3':
|
case '3':
|
||||||
status_mesg(periodic_save_str, "");
|
status_mesg(periodic_save_str, "");
|
||||||
if (updatestring(win[STA].p, &buf, 0, 1) == 0) {
|
if (updatestring(win[STA].p, &buf, 0, 1) == 0) {
|
||||||
int val = atoi(buf);
|
val = atoi(buf);
|
||||||
if (val >= 0)
|
if (val >= 0)
|
||||||
conf.periodic_save = val;
|
conf.periodic_save = val;
|
||||||
if (conf.periodic_save > 0)
|
if (conf.periodic_save > 0)
|
||||||
@ -785,13 +790,11 @@ void custom_general_config(void)
|
|||||||
status_mesg(number_str, keys);
|
status_mesg(number_str, keys);
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
status_mesg(input_datefmt_str, "");
|
val = status_ask_simplechoice(input_datefmt_prefix,
|
||||||
if (updatestring(win[STA].p, &buf, 0, 1) == 0) {
|
input_datefmt_choices,
|
||||||
int val = atoi(buf);
|
DATE_FORMATS - 1);
|
||||||
if (val > 0 && val <= DATE_FORMATS)
|
if (val != -1)
|
||||||
conf.input_datefmt = val;
|
conf.input_datefmt = val;
|
||||||
}
|
|
||||||
status_mesg(number_str, keys);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user