Mark localized string literals constant

Translated strings returned by gettext() are statically allocated and
shouldn't be modified.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2012-04-05 21:36:54 +02:00
parent 516a793375
commit 80f7e8ead5
12 changed files with 89 additions and 89 deletions

View File

@ -155,16 +155,16 @@ apoint_add (void)
{ {
#define LTIME 6 #define LTIME 6
#define LDUR 12 #define LDUR 12
char *mesg_1 = const char *mesg_1 =
_("Enter start time ([hh:mm]), leave blank for an all-day event : "); _("Enter start time ([hh:mm]), leave blank for an all-day event : ");
char *mesg_2 = const char *mesg_2 =
_("Enter end time ([hh:mm]) or duration ([+hh:mm], [+xxxdxxhxxm] or [+mm]) : "); _("Enter end time ([hh:mm]) or duration ([+hh:mm], [+xxxdxxhxxm] or [+mm]) : ");
char *mesg_3 = _("Enter description :"); const char *mesg_3 = _("Enter description :");
char *format_message_1 = const char *format_message_1 =
_("You entered an invalid start time, should be [hh:mm]"); _("You entered an invalid start time, should be [hh:mm]");
char *format_message_2 = const char *format_message_2 =
_("Invalid end time/duration, should be [hh:mm], [+hh:mm], [+xxxdxxhxxm] or [+mm]"); _("Invalid end time/duration, should be [hh:mm], [+hh:mm], [+xxxdxxhxxm] or [+mm]");
char *enter_str = _("Press [Enter] to continue"); const char *enter_str = _("Press [Enter] to continue");
int Id = 1; int Id = 1;
char item_time[LDUR] = ""; char item_time[LDUR] = "";
char item_mesg[BUFSIZ] = ""; char item_mesg[BUFSIZ] = "";
@ -265,7 +265,7 @@ void
apoint_delete (unsigned *nb_events, unsigned *nb_apoints) apoint_delete (unsigned *nb_events, unsigned *nb_apoints)
{ {
char *choices = "[y/n] "; char *choices = "[y/n] ";
char *del_app_str = _("Do you really want to delete this item ?"); const char *del_app_str = _("Do you really want to delete this item ?");
long date; long date;
int nb_items = *nb_apoints + *nb_events; int nb_items = *nb_apoints + *nb_events;
int to_be_removed = 0; int to_be_removed = 0;

View File

@ -205,8 +205,8 @@ todo_arg (int priority, const char *format, regex_t *regex)
llist_item_t *i; llist_item_t *i;
int title = 1; int title = 1;
char *titlestr; char *titlestr;
char *all_todos_title = _("to do:\n"); const char *all_todos_title = _("to do:\n");
char *completed_title = _("completed tasks:\n"); const char *completed_title = _("completed tasks:\n");
titlestr = priority == 0 ? completed_title : all_todos_title; titlestr = priority == 0 ? completed_title : all_todos_title;

View File

@ -68,7 +68,7 @@ main (int argc, char **argv)
int non_interactive; int non_interactive;
int no_data_file = 1; int no_data_file = 1;
int cut_item = 0; int cut_item = 0;
char *quit_message = _("Do you really want to quit ?"); const char *quit_message = _("Do you really want to quit ?");
char choices[] = "[y/n] "; char choices[] = "[y/n] ";
int count; int count;

View File

@ -628,10 +628,10 @@ calendar_change_day (int datefmt)
char outstr[BUFSIZ]; char outstr[BUFSIZ];
int dday, dmonth, dyear; int dday, dmonth, dyear;
int wrong_day = 1; int wrong_day = 1;
char *mesg_line1 = const char *mesg_line1 =
_("The day you entered is not valid " _("The day you entered is not valid "
"(should be between 01/01/1902 and 12/31/2037)"); "(should be between 01/01/1902 and 12/31/2037)");
char *mesg_line2 = _("Press [ENTER] to continue"); const char *mesg_line2 = _("Press [ENTER] to continue");
char *request_date = "Enter the day to go to [ENTER for today] : %s"; char *request_date = "Enter the day to go to [ENTER for today] : %s";
while (wrong_day) while (wrong_day)

View File

@ -216,7 +216,7 @@ custom_layout_config (void)
struct window conf_win; struct window conf_win;
int ch, mark, cursor, need_reset; int ch, mark, cursor, need_reset;
const char *label = _("layout configuration"); const char *label = _("layout configuration");
char *help_text = const char *help_text =
_("With this configuration menu, one can choose where panels will be\n" _("With this configuration menu, one can choose where panels will be\n"
"displayed inside calcurse screen. \n" "displayed inside calcurse screen. \n"
"It is possible to choose between eight different configurations.\n" "It is possible to choose between eight different configurations.\n"
@ -303,7 +303,7 @@ custom_sidebar_config (void)
struct binding *bindings[] = { struct binding *bindings[] = {
&inc, &dec, &help, &quit &inc, &dec, &help, &quit
}; };
char *help_text = const char *help_text =
_("This configuration screen is used to change the width of the side bar.\n" _("This configuration screen is used to change the width of the side bar.\n"
"The side bar is the part of the screen which contains two panels:\n" "The side bar is the part of the screen which contains two panels:\n"
"the calendar and, depending on the chosen layout, either the todo list\n" "the calendar and, depending on the chosen layout, either the todo list\n"
@ -431,9 +431,9 @@ display_color_config (struct window *cwin, int *mark_fore, int *mark_back,
#define CURSOR (32 | A_REVERSE) #define CURSOR (32 | A_REVERSE)
#define MARK 88 #define MARK 88
char *fore_txt = _("Foreground"); const char *fore_txt = _("Foreground");
char *back_txt = _("Background"); const char *back_txt = _("Background");
char *default_txt = _("(terminal's default)"); const char *default_txt = _("(terminal's default)");
char *bar = " "; char *bar = " ";
char *box = "[ ]"; char *box = "[ ]";
const unsigned Y = 3; const unsigned Y = 3;
@ -746,16 +746,16 @@ void
custom_general_config (void) custom_general_config (void)
{ {
struct scrollwin cwin; struct scrollwin cwin;
char *number_str = const char *number_str =
_("Enter an option number to change its value"); _("Enter an option number to change its value");
char *keys = const char *keys =
_("(Press '^P' or '^N' to move up or down, 'Q' to quit)"); _("(Press '^P' or '^N' to move up or down, 'Q' to quit)");
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) ");
char *input_datefmt_str = const char *input_datefmt_str =
_("Enter the date format (1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd " _("Enter the date format (1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd "
"(4)yyyy-mm-dd"); "(4)yyyy-mm-dd");
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;
char *buf; char *buf;
@ -1098,7 +1098,7 @@ custom_keys_config (void)
void void
custom_config_main (void) custom_config_main (void)
{ {
char *no_color_support = const char *no_color_support =
_("Sorry, colors are not supported by your terminal\n" _("Sorry, colors are not supported by your terminal\n"
"(Press [ENTER] to continue)"); "(Press [ENTER] to continue)");
int ch; int ch;

View File

@ -577,9 +577,9 @@ static int
day_edit_time (int time, unsigned *new_hour, unsigned *new_minute) day_edit_time (int time, unsigned *new_hour, unsigned *new_minute)
{ {
char *timestr = date_sec2date_str (time, "%H:%M"); char *timestr = date_sec2date_str (time, "%H:%M");
char *msg_time = _("Enter the new time ([hh:mm]) : "); const char *msg_time = _("Enter the new time ([hh:mm]) : ");
char *enter_str = _("Press [Enter] to continue"); const char *enter_str = _("Press [Enter] to continue");
char *fmt_msg = _("You entered an invalid time, should be [hh:mm]"); const char *fmt_msg = _("You entered an invalid time, should be [hh:mm]");
for (;;) for (;;)
{ {
@ -607,9 +607,9 @@ static int
day_edit_duration (int start, int dur, unsigned *new_duration) day_edit_duration (int start, int dur, unsigned *new_duration)
{ {
char *timestr = date_sec2date_str (start + dur, "%H:%M"); char *timestr = date_sec2date_str (start + dur, "%H:%M");
char *msg_time = _("Enter the new time ([hh:mm]) or duration ([+hh:mm]): "); const char *msg_time = _("Enter the new time ([hh:mm]) or duration ([+hh:mm]): ");
char *enter_str = _("Press [Enter] to continue"); const char *enter_str = _("Press [Enter] to continue");
char *fmt_msg = _("You entered an invalid time, should be [hh:mm]"); const char *fmt_msg = _("You entered an invalid time, should be [hh:mm]");
long newtime; long newtime;
unsigned hr, mn; unsigned hr, mn;
@ -652,8 +652,8 @@ update_start_time (long *start, long *dur)
long newtime; long newtime;
unsigned hr, mn; unsigned hr, mn;
int valid_date; int valid_date;
char *msg_wrong_time = _("Invalid time: start time must be before end time!"); const char *msg_wrong_time = _("Invalid time: start time must be before end time!");
char *msg_enter = _("Press [Enter] to continue"); const char *msg_enter = _("Press [Enter] to continue");
do do
{ {
@ -699,15 +699,15 @@ update_rept (struct rpt **rpt, const long start)
long newuntil; long newuntil;
char outstr[BUFSIZ]; char outstr[BUFSIZ];
char *typstr, *freqstr, *timstr; char *typstr, *freqstr, *timstr;
char *msg_rpt_type = _("Enter the new repetition type: (D)aily, (W)eekly, " const char *msg_rpt_type = _("Enter the new repetition type: (D)aily, (W)eekly, "
"(M)onthly, (Y)early"); "(M)onthly, (Y)early");
char *msg_rpt_ans = _("[D/W/M/Y] "); const char *msg_rpt_ans = _("[D/W/M/Y] ");
char *msg_wrong_freq = _("The frequence you entered is not valid."); const char *msg_wrong_freq = _("The frequence you entered is not valid.");
char *msg_wrong_time = _("Invalid time: start time must be before end time!"); const char *msg_wrong_time = _("Invalid time: start time must be before end time!");
char *msg_wrong_date = _("The entered date is not valid."); const char *msg_wrong_date = _("The entered date is not valid.");
char *msg_fmts = char *msg_fmts =
"Possible formats are [%s] or '0' for an endless repetetition"; "Possible formats are [%s] or '0' for an endless repetetition";
char *msg_enter = _("Press [Enter] to continue"); const char *msg_enter = _("Press [Enter] to continue");
do do
{ {
@ -925,14 +925,14 @@ int
day_erase_item (long date, int item_number, enum eraseflg flag) day_erase_item (long date, int item_number, enum eraseflg flag)
{ {
struct day_item *p; struct day_item *p;
char *erase_warning = const char *erase_warning =
_("This item is recurrent. " _("This item is recurrent. "
"Delete (a)ll occurences or just this (o)ne ?"); "Delete (a)ll occurences or just this (o)ne ?");
char *note_warning = const char *note_warning =
_("This item has a note attached to it. " _("This item has a note attached to it. "
"Delete (i)tem or just its (n)ote ?"); "Delete (i)tem or just its (n)ote ?");
char *note_choice = _("[i/n] "); const char *note_choice = _("[i/n] ");
char *erase_choice = _("[a/o] "); const char *erase_choice = _("[a/o] ");
int ch, ans; int ch, ans;
unsigned delete_whole; unsigned delete_whole;

View File

@ -89,10 +89,10 @@ progress_bar (progress_bar_t type, int progress)
#define NBEXPORTED 3 #define NBEXPORTED 3
#define LABELENGTH 15 #define LABELENGTH 15
int i, step, steps; int i, step, steps;
char *mesg_sav = _("Saving..."); const char *mesg_sav = _("Saving...");
char *mesg_load = _("Loading..."); const char *mesg_load = _("Loading...");
char *mesg_export = _("Exporting..."); const char *mesg_export = _("Exporting...");
char *error_msg = _("Internal error while displaying progress bar"); const char *error_msg = _("Internal error while displaying progress bar");
char *barchar = "|"; char *barchar = "|";
char *file[NBFILES] = { char *file[NBFILES] = {
"[ conf ]", "[ conf ]",
@ -154,10 +154,10 @@ get_export_stream (enum export_type type)
FILE *stream; FILE *stream;
int cancel; int cancel;
char *home, *stream_name; char *home, *stream_name;
char *question = _("Choose the file used to export calcurse data:"); const char *question = _("Choose the file used to export calcurse data:");
char *wrong_name = const char *wrong_name =
_("The file cannot be accessed, please enter another file name."); _("The file cannot be accessed, please enter another file name.");
char *press_enter = _("Press [ENTER] to continue."); const char *press_enter = _("Press [ENTER] to continue.");
const char *file_ext[IO_EXPORT_NBTYPES] = {"ical", "txt"}; const char *file_ext[IO_EXPORT_NBTYPES] = {"ical", "txt"};
stream = NULL; stream = NULL;
@ -428,9 +428,9 @@ io_save_keys (void)
void void
io_save_cal (enum save_display display) io_save_cal (enum save_display display)
{ {
char *access_pb = _("Problems accessing data file ..."); const char *access_pb = _("Problems accessing data file ...");
char *save_success = _("The data files were successfully saved"); const char *save_success = _("The data files were successfully saved");
char *enter = _("Press [ENTER] to continue"); const char *enter = _("Press [ENTER] to continue");
int show_bar; int show_bar;
if (read_only) if (read_only)
@ -794,7 +794,7 @@ io_load_keys (char *pager)
line++; line++;
if (skipped > MAX_ERRORS) if (skipped > MAX_ERRORS)
{ {
char *too_many = const char *too_many =
_("\nToo many errors while reading configuration file!\n" _("\nToo many errors while reading configuration file!\n"
"Please backup your keys file, remove it from directory, " "Please backup your keys file, remove it from directory, "
"and launch calcurse again.\n"); "and launch calcurse again.\n");
@ -876,7 +876,7 @@ io_load_keys (char *pager)
file_close (log->fd, __FILE_POS__); file_close (log->fd, __FILE_POS__);
if (skipped > 0) if (skipped > 0)
{ {
char *view_log = const char *view_log =
_("There were some errors when loading keys file, see log file ?"); _("There were some errors when loading keys file, see log file ?");
io_log_display (log, view_log, pager); io_log_display (log, view_log, pager);
@ -990,10 +990,10 @@ io_check_data_files (void)
void void
io_startup_screen (unsigned show_dialogs, int no_data_file) io_startup_screen (unsigned show_dialogs, int no_data_file)
{ {
char *welcome_mesg = const char *welcome_mesg =
_("Welcome to Calcurse. Missing data files were created."); _("Welcome to Calcurse. Missing data files were created.");
char *data_mesg = _("Data files found. Data will be loaded now."); const char *data_mesg = _("Data files found. Data will be loaded now.");
char *enter = _("Press [ENTER] to continue"); const char *enter = _("Press [ENTER] to continue");
if (no_data_file != 0) if (no_data_file != 0)
{ {
@ -1012,8 +1012,8 @@ void
io_export_data (enum export_type type) io_export_data (enum export_type type)
{ {
FILE *stream; FILE *stream;
char *success = _("The data were successfully exported"); const char *success = _("The data were successfully exported");
char *enter = _("Press [ENTER] to continue"); const char *enter = _("Press [ENTER] to continue");
if (type < IO_EXPORT_ICAL || type >= IO_EXPORT_NBTYPES) if (type < IO_EXPORT_ICAL || type >= IO_EXPORT_NBTYPES)
EXIT (_("unknown export type")); EXIT (_("unknown export type"));
@ -1076,10 +1076,10 @@ get_import_stream (enum export_type type)
{ {
FILE *stream; FILE *stream;
char *stream_name; char *stream_name;
char *ask_fname = _("Enter the file name to import data from:"); const char *ask_fname = _("Enter the file name to import data from:");
char *wrong_file = const char *wrong_file =
_("The file cannot be accessed, please enter another file name."); _("The file cannot be accessed, please enter another file name.");
char *press_enter = _("Press [ENTER] to continue."); const char *press_enter = _("Press [ENTER] to continue.");
int cancel; int cancel;
stream = NULL; stream = NULL;
@ -1115,7 +1115,7 @@ get_import_stream (enum export_type type)
void void
io_import_data (enum import_type type, char *stream_name) io_import_data (enum import_type type, char *stream_name)
{ {
char *proc_report = _("Import process report: %04d lines read "); const char *proc_report = _("Import process report: %04d lines read ");
char stats_str[4][BUFSIZ]; char stats_str[4][BUFSIZ];
FILE *stream = NULL; FILE *stream = NULL;
struct io_file *log; struct io_file *log;
@ -1195,7 +1195,7 @@ io_import_data (enum import_type type, char *stream_name)
file_close (log->fd, __FILE_POS__); file_close (log->fd, __FILE_POS__);
if (stats.skipped > 0) if (stats.skipped > 0)
{ {
char *view_log = _("Some items could not be imported, see log file ?"); const char *view_log = _("Some items could not be imported, see log file ?");
io_log_display (log, view_log, conf.pager); io_log_display (log, view_log, conf.pager);
} }

View File

@ -103,7 +103,7 @@ static struct keydef_s keydef[NBKEYS] = {
static void static void
dump_intro (FILE *fd) dump_intro (FILE *fd)
{ {
char *intro = const char *intro =
_("#\n" _("#\n"
"# Calcurse keys configuration file\n#\n" "# Calcurse keys configuration file\n#\n"
"# This file sets the keybindings used by Calcurse.\n" "# This file sets the keybindings used by Calcurse.\n"

View File

@ -714,17 +714,17 @@ notify_config_bar (void)
{ {
struct scrollwin cwin; struct scrollwin cwin;
char *buf; char *buf;
char *number_str = const char *number_str =
_("Enter an option number to change its value"); _("Enter an option number to change its value");
char *keys = const char *keys =
_("(Press '^P' or '^N' to move up or down, 'Q' to quit)"); _("(Press '^P' or '^N' to move up or down, 'Q' to quit)");
char *date_str = const char *date_str =
_("Enter the date format (see 'man 3 strftime' for possible formats) "); _("Enter the date format (see 'man 3 strftime' for possible formats) ");
char *time_str = const char *time_str =
_("Enter the time format (see 'man 3 strftime' for possible formats) "); _("Enter the time format (see 'man 3 strftime' for possible formats) ");
char *count_str = const char *count_str =
_("Enter the number of seconds (0 not to be warned before an appointment)"); _("Enter the number of seconds (0 not to be warned before an appointment)");
char *cmd_str = _("Enter the notification command "); const char *cmd_str = _("Enter the notification command ");
int ch; int ch;
clear (); clear ();

View File

@ -874,19 +874,19 @@ recur_repeat_item (void)
struct date until_date; struct date until_date;
char outstr[BUFSIZ]; char outstr[BUFSIZ];
char user_input[BUFSIZ] = ""; char user_input[BUFSIZ] = "";
char *mesg_type_1 = const char *mesg_type_1 =
_("Enter the repetition type: (D)aily, (W)eekly, (M)onthly, (Y)early"); _("Enter the repetition type: (D)aily, (W)eekly, (M)onthly, (Y)early");
char *mesg_type_2 = _("[D/W/M/Y] "); const char *mesg_type_2 = _("[D/W/M/Y] ");
char *mesg_freq_1 = _("Enter the repetition frequence:"); const char *mesg_freq_1 = _("Enter the repetition frequence:");
char *mesg_wrong_freq = _("The frequence you entered is not valid."); const char *mesg_wrong_freq = _("The frequence you entered is not valid.");
char *mesg_until_1 = const char *mesg_until_1 =
_("Enter the ending date: [%s] or '0' for an endless repetition"); _("Enter the ending date: [%s] or '0' for an endless repetition");
char *mesg_wrong_1 = _("The entered date is not valid."); const char *mesg_wrong_1 = _("The entered date is not valid.");
char *mesg_wrong_2 = const char *mesg_wrong_2 =
_("Possible formats are [%s] or '0' for an endless repetition"); _("Possible formats are [%s] or '0' for an endless repetition");
char *wrong_type_1 = _("This item is already a repeated one."); const char *wrong_type_1 = _("This item is already a repeated one.");
char *wrong_type_2 = _("Press [ENTER] to continue."); const char *wrong_type_2 = _("Press [ENTER] to continue.");
char *mesg_older = const char *mesg_older =
_("Sorry, the date you entered is older than the item start time."); _("Sorry, the date you entered is older than the item start time.");
int type = 0, freq = 0; int type = 0, freq = 0;
int item_nb; int item_nb;

View File

@ -134,8 +134,8 @@ void
todo_new_item (void) todo_new_item (void)
{ {
int ch = 0; int ch = 0;
char *mesg = _("Enter the new ToDo item : "); const char *mesg = _("Enter the new ToDo item : ");
char *mesg_id = _("Enter the ToDo priority [1 (highest) - 9 (lowest)] :"); const char *mesg_id = _("Enter the ToDo priority [1 (highest) - 9 (lowest)] :");
char todo_input[BUFSIZ] = ""; char todo_input[BUFSIZ] = "";
status_mesg (mesg, ""); status_mesg (mesg, "");
@ -243,11 +243,11 @@ void
todo_delete (void) todo_delete (void)
{ {
char *choices = "[y/n] "; char *choices = "[y/n] ";
char *del_todo_str = _("Do you really want to delete this task ?"); const char *del_todo_str = _("Do you really want to delete this task ?");
char *erase_warning = const char *erase_warning =
_("This item has a note attached to it. " _("This item has a note attached to it. "
"Delete (t)odo or just its (n)ote ?"); "Delete (t)odo or just its (n)ote ?");
char *erase_choice = _("[t/n] "); const char *erase_choice = _("[t/n] ");
int answer, has_note; int answer, has_note;
if (conf.confirm_delete) if (conf.confirm_delete)
@ -364,7 +364,7 @@ void
todo_edit_item (void) todo_edit_item (void)
{ {
struct todo *i; struct todo *i;
char *mesg = _("Enter the new ToDo description :"); const char *mesg = _("Enter the new ToDo description :");
status_mesg (mesg, ""); status_mesg (mesg, "");
i = todo_get_item (hilt); i = todo_get_item (hilt);

View File

@ -105,8 +105,8 @@ void
fatalbox (const char *errmsg) fatalbox (const char *errmsg)
{ {
WINDOW *errwin; WINDOW *errwin;
char *label = _("/!\\ INTERNAL ERROR /!\\"); const char *label = _("/!\\ INTERNAL ERROR /!\\");
char *reportmsg = _("Please report the following bug:"); const char *reportmsg = _("Please report the following bug:");
const int WINROW = 10; const int WINROW = 10;
const int WINCOL = col - 2; const int WINCOL = col - 2;
const int MSGLEN = WINCOL - 2; const int MSGLEN = WINCOL - 2;
@ -188,7 +188,7 @@ WINDOW *
popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg, popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg,
int hint) int hint)
{ {
char *any_key = _("Press any key to continue..."); const char *any_key = _("Press any key to continue...");
char label[BUFSIZ]; char label[BUFSIZ];
WINDOW *popup_win; WINDOW *popup_win;
const int MSGXPOS = 5; const int MSGXPOS = 5;