Getting rid of gettext, moved some _(..) texts to themes and left some error

messages hard coded.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1503 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-05-17 20:13:59 +00:00 committed by cras
commit c2b2d45bd6
28 changed files with 61 additions and 950 deletions

View file

@ -11,7 +11,6 @@ PERLDIR=perl
endif
noinst_HEADERS = \
nls.h \
common.h
SUBDIRS = lib-popt lib-config core irc fe-common $(PERLDIR) $(TEXTUI) $(BOTUI)

View file

@ -44,7 +44,6 @@
#endif
#include "core/memdebug.h"
#include "nls.h"
#define g_free_not_null(a) \
G_STMT_START { \

View file

@ -52,12 +52,10 @@ void args_execute(int argc, char *argv[])
while ((nextopt = poptGetNextOpt(con)) > 0) ;
if (nextopt != -1) {
printf(_("Error on option %s: %s.\n"
"Run '%s --help' to see a full list of "
"available command line options.\n"),
poptBadOption(con, 0),
poptStrerror(nextopt),
argv[0]);
printf("Error on option %s: %s.\n"
"Run '%s --help' to see a full list of "
"available command line options.\n",
poptBadOption(con, 0), poptStrerror(nextopt), argv[0]);
exit(1);
}

View file

@ -147,8 +147,8 @@ void net_disconnect_deinit(void)
} else if (first) {
/* Display the text when we have already waited
for a while */
printf(_("Please wait, waiting for servers to close "
"connections..\n"));
printf("Please wait, waiting for servers to close "
"connections..\n");
fflush(stdout);
first = 0;

View file

@ -540,13 +540,13 @@ const char *net_gethosterror(int error)
#else
switch (error) {
case HOST_NOT_FOUND:
return _("Host not found");
return "Host not found";
case NO_ADDRESS:
return _("No IP address found for name");
return "No IP address found for name";
case NO_RECOVERY:
return _("A non-recovable name server error occurred");
return "A non-recovable name server error occurred";
case TRY_AGAIN:
return _("A temporary error on an authoritative name server");
return "A temporary error on an authoritative name server";
}
/* unknown error */

View file

@ -367,8 +367,8 @@ void settings_check_module(const char *module)
if (node == NULL) return;
errors = g_string_new(NULL);
g_string_sprintf(errors, _("Unknown settings in configuration "
"file for module %s:"), module);
g_string_sprintf(errors, "Unknown settings in configuration "
"file for module %s:", module);
count = 0;
for (tmp = node->value; tmp != NULL; tmp = tmp->next) {
@ -511,7 +511,7 @@ static CONFIG_REC *parse_configfile(const char *fname)
config = config_open(path, -1);
if (config == NULL) {
last_config_error_msg =
g_strdup_printf(_("Error opening configuration file %s: %s"),
g_strdup_printf("Error opening configuration file %s: %s",
path, g_strerror(errno));
config = config_open(NULL, -1);
}
@ -536,12 +536,11 @@ static void init_configfile(void)
if (stat(str, &statbuf) != 0) {
/* ~/.irssi not found, create it. */
if (mkpath(str, 0700) != 0) {
g_error(_("Couldn't create %s directory"), str);
g_error("Couldn't create %s directory", str);
}
} else if (!S_ISDIR(statbuf.st_mode)) {
g_error(_("%s is not a directory.\n"
"You should remove it with command: rm ~/.irssi"),
str);
g_error("%s is not a directory.\n"
"You should remove it with command: rm ~/.irssi", str);
}
g_free(str);
@ -551,8 +550,8 @@ static void init_configfile(void)
/* any errors? */
if (config_last_error(mainconfig) != NULL) {
last_config_error_msg =
g_strdup_printf(_("Ignored errors in configuration "
"file:\n%s"),
g_strdup_printf("Ignored errors in configuration "
"file:\n%s",
config_last_error(mainconfig));
}
@ -576,7 +575,7 @@ int settings_reread(const char *fname)
}
if (config_last_error(tempconfig) != NULL) {
str = g_strdup_printf(_("Errors in configuration file:\n%s"),
str = g_strdup_printf("Errors in configuration file:\n%s",
config_last_error(tempconfig));
signal_emit("gui dialog", 2, "error", str);
g_free(str);
@ -606,8 +605,7 @@ int settings_save(const char *fname)
irssi_config_save_state(fname);
config_last_modifycounter = mainconfig->modifycounter;
if (error) {
str = g_strdup_printf(_("Couldn't save "
"configuration file: %s"),
str = g_strdup_printf("Couldn't save configuration file: %s",
config_last_error(mainconfig));
signal_emit("gui dialog", 2, "error", str);
g_free(str);
@ -627,12 +625,11 @@ static void sig_autosave(void)
settings_save(NULL);
else {
fname = g_strconcat(mainconfig->fname, ".autosave", NULL);
str = g_strdup_printf(_("Configuration file was modified "
"while irssi was running. Saving "
"configuration to file '%s' instead. "
"Use /SAVE or /RELOAD to get rid of "
"this message."),
fname);
str = g_strdup_printf("Configuration file was modified "
"while irssi was running. Saving "
"configuration to file '%s' instead. "
"Use /SAVE or /RELOAD to get rid of "
"this message.", fname);
signal_emit("gui dialog", 2, "warning", str);
g_free(str);

View file

@ -119,12 +119,12 @@ static void sig_channel_destroyed(CHANNEL_REC *channel)
void fe_common_core_init(void)
{
static struct poptOption options[] = {
{ "connect", 'c', POPT_ARG_STRING, &autocon_server, 0, N_("Automatically connect to server/ircnet"), N_("SERVER") },
{ "password", 'w', POPT_ARG_STRING, &autocon_password, 0, N_("Autoconnect password"), N_("SERVER") },
{ "port", 'p', POPT_ARG_INT, &autocon_port, 0, N_("Autoconnect port"), N_("PORT") },
{ "noconnect", '!', POPT_ARG_NONE, &no_autoconnect, 0, N_("Disable autoconnecting"), NULL },
{ "nick", 'n', POPT_ARG_STRING, &cmdline_nick, 0, N_("Specify nick to use"), NULL },
{ "hostname", 'h', POPT_ARG_STRING, &cmdline_hostname, 0, N_("Specify host name to use"), NULL },
{ "connect", 'c', POPT_ARG_STRING, &autocon_server, 0, "Automatically connect to server/ircnet", "SERVER" },
{ "password", 'w', POPT_ARG_STRING, &autocon_password, 0, "Autoconnect password", "SERVER" },
{ "port", 'p', POPT_ARG_INT, &autocon_port, 0, "Autoconnect port", "PORT" },
{ "noconnect", '!', POPT_ARG_NONE, &no_autoconnect, 0, "Disable autoconnecting", NULL },
{ "nick", 'n', POPT_ARG_STRING, &cmdline_nick, 0, "Specify nick to use", NULL },
{ "hostname", 'h', POPT_ARG_STRING, &cmdline_hostname, 0, "Specify host name to use", NULL },
{ NULL, '\0', 0, NULL }
};

View file

@ -262,7 +262,7 @@ static void settings_save_fe(const char *fname)
static void settings_save_confirm(const char *line, char *fname)
{
if (g_strncasecmp(line, _("Y"), 1) == 0)
if (line[0] == 'Y')
settings_save_fe(fname);
g_free(fname);
}
@ -270,6 +270,8 @@ static void settings_save_confirm(const char *line, char *fname)
/* SYNTAX: SAVE [<file>] */
static void cmd_save(const char *data)
{
char *format;
if (*data == '\0')
data = mainconfig->fname;
@ -280,14 +282,17 @@ static void cmd_save(const char *data)
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_CONFIG_MODIFIED, data);
format = format_get_text(MODULE_NAME, NULL, NULL, NULL,
TXT_OVERWRITE_CONFIG);
keyboard_entry_redirect((SIGNAL_FUNC) settings_save_confirm,
_("Overwrite config (y/N)?"),
0, g_strdup(data));
format, 0, g_strdup(data));
g_free(format);
}
static void settings_clean_confirm(const char *line)
{
if (g_strncasecmp(line, _("Y"), 1) == 0)
if (line[0] == 'Y')
settings_clean_invalid();
}
@ -295,7 +300,7 @@ static void sig_settings_errors(const char *msg)
{
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "%s", msg);
keyboard_entry_redirect((SIGNAL_FUNC) settings_clean_confirm,
_("Remove unknown settings from config file (Y/n)?"),
"Remove unknown settings from config file (Y/n)?",
0, NULL);
}

View file

@ -222,6 +222,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ "config_reloaded", "Reloaded configuration", 1, { 0 } },
{ "config_modified", "Configuration file was modified since irssi was last started - do you want to overwrite the possible changes?", 1, { 0 } },
{ "glib_error", "{error GLib $0} $1", 2, { 0, 0 } },
{ "overwrite_config", "Overwrite config (y/N)?", 0 },
{ NULL, NULL, 0 }
};

View file

@ -187,7 +187,8 @@ enum {
TXT_CONFIG_SAVED,
TXT_CONFIG_RELOADED,
TXT_CONFIG_MODIFIED,
TXT_GLIB_ERROR
TXT_GLIB_ERROR,
TXT_OVERWRITE_CONFIG
};
extern FORMAT_REC fecommon_core_formats[];

View file

@ -414,9 +414,9 @@ static void sig_gui_dialog(const char *type, const char *text)
char *format;
if (g_strcasecmp(type, "warning") == 0)
format = _("%_Warning:%_ %s");
format = "%_Warning:%_ %s";
else if (g_strcasecmp(type, "error") == 0)
format = _("%_Error:%_ %s");
format = "%_Error:%_ %s";
else
format = "%s";

View file

@ -788,7 +788,7 @@ static int theme_read(THEME_REC *theme, const char *path, const char *data)
config_parse(config);
if (config_last_error(config) != NULL) {
str = g_strdup_printf(_("Ignored errors in theme %s:\n%s"),
str = g_strdup_printf("Ignored errors in theme %s:\n%s",
theme->name, config_last_error(config));
read_error(str);
g_free(str);

View file

@ -396,7 +396,7 @@ static void cmd_oper_got_pass(const char *password, OPER_PASS_REC *rec)
/* SYNTAX: OPER [<nick> [<password>]] */
static void cmd_oper(const char *data, IRC_SERVER_REC *server)
{
char *nick, *password;
char *nick, *password, *format;
void *free_arg;
g_return_if_fail(data != NULL);
@ -414,9 +414,13 @@ static void cmd_oper(const char *data, IRC_SERVER_REC *server)
rec->server = server;
rec->nick = g_strdup(*nick != '\0' ? nick : server->nick);
format = format_get_text(MODULE_NAME, NULL, server, NULL,
IRCTXT_ASK_OPER_PASS);
keyboard_entry_redirect((SIGNAL_FUNC) cmd_oper_got_pass,
_("Operator password:"),
format,
ENTRY_REDIRECT_FLAG_HIDDEN, rec);
g_free(format);
signal_stop();
}

View file

@ -161,6 +161,7 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "silenced", "Silenced {nick $0}", 1, { 0 } },
{ "unsilenced", "Unsilenced {nick $0}", 1, { 0 } },
{ "silence_line", "{nick $0}: silence {ban $1}", 2, { 0, 0 } },
{ "ask_oper_pass", "Operator password:", 0 },
{ NULL, NULL, 0 }
};

View file

@ -130,7 +130,8 @@ enum {
IRCTXT_SILENCED,
IRCTXT_UNSILENCED,
IRCTXT_SILENCE_LINE
IRCTXT_SILENCE_LINE,
IRCTXT_ASK_OPER_PASS
};
extern FORMAT_REC fecommon_irc_formats[];

View file

@ -282,7 +282,7 @@ int main(int argc, char **argv)
args_execute(argc, argv);
if (!init_screen())
g_error(_("Can't initialize screen handling, quitting.\n"));
g_error("Can't initialize screen handling, quitting.\n");
textui_finish_init();
main_loop = g_main_new(TRUE);

View file

@ -21,8 +21,8 @@ static void displayArgs(poptContext con, enum poptCallbackReason foo,
struct poptOption poptHelpOptions[] = {
{ NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL },
{ "help", '?', 0, NULL, '?', N_("Show this help message") },
{ "usage", '\0', 0, NULL, 'u', N_("Display brief usage message") },
{ "help", '?', 0, NULL, '?', "Show this help message" },
{ "usage", '\0', 0, NULL, 'u', "Display brief usage message" },
{ NULL, '\0', 0, NULL, 0 }
} ;

View file

@ -1,24 +0,0 @@
#ifdef ENABLE_NLS
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# else
# include "../intl/libgettext.h"
# endif
# define _(String) gettext (String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
/* Stubs that do something close enough. */
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
#endif