Commit a28569fe authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

use GETTEXT_PACKAGE

Mon Jan 21 19:14:28 2002  George Lebl <jirka@5z.com>

	* acconfig.h, configure.in: use GETTEXT_PACKAGE

	* daemon/gdm.c, daemon/misc.[ch], daemon/verify-pam.c,
	  daemon/server.c, daemon/slave.c, daemon/display.c:
	  When displaying something on a console display it only
	  when the console is UTF-8, which is only true if
	  "gdmopen vt-is-UTF8 -q" returns 0 status.  Else don't
	  actually translate anything and just print out the english/ASCII
	  version.

	* daemon/verify-pam.c:  Better check for existance of the pam
	  gdm configuration

	* daemon/gdm.c, gui/gdmXnestchooser.c, gui/gdmchooser.c,
	  gui/gdmconfig.c, gui/gdmflexiserver.c, gui/gdmlogin.c,
	  gui/gdmphotosetup.c:  property bind gettext stuff and make
	  sure we correctly set it up for UTF-8
parent 6d507ba5
Mon Jan 21 19:14:28 2002 George Lebl <jirka@5z.com>
* acconfig.h, configure.in: use GETTEXT_PACKAGE
* daemon/gdm.c, daemon/misc.[ch], daemon/verify-pam.c,
daemon/server.c, daemon/slave.c, daemon/display.c:
When displaying something on a console display it only
when the console is UTF-8, which is only true if
"gdmopen vt-is-UTF8 -q" returns 0 status. Else don't
actually translate anything and just print out the english/ASCII
version.
* daemon/verify-pam.c: Better check for existance of the pam
gdm configuration
* daemon/gdm.c, gui/gdmXnestchooser.c, gui/gdmchooser.c,
gui/gdmconfig.c, gui/gdmflexiserver.c, gui/gdmlogin.c,
gui/gdmphotosetup.c: property bind gettext stuff and make
sure we correctly set it up for UTF-8
2002-01-20 Alexander Larsson <alla@lysator.liu.se>
* gui/greeter/greeter_item.[ch]:
......
......@@ -24,3 +24,4 @@
#undef EXPANDED_AUTHDIR
#undef EXPANDED_SYSCONFDIR
#undef EXPANDED_SESSDIR
#undef GETTEXT_PACKAGE
......@@ -148,10 +148,13 @@ AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
dnl ## Language Support
GETTEXT_PACKAGE=gdm-2.4
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE")
AC_SUBST(GETTEXT_PACKAGE)
dnl ## internationalization support
ALL_LINGUAS="az ca cs da de el es et eu fi fr ga gl hu it ja ko lt lv ms nl nn no pl pt_BR pt ro ru sk sl sv ta tr uk zh_CN.GB2312 zh_TW"
dnl AM_GNOME_GETTEXT
dnl AM_GNU_GETTEXT
AM_GLIB_GNU_GETTEXT
# TCP Wrappers for XDMCP access control
......
......@@ -98,8 +98,14 @@ gdm_display_check_loop (GdmDisplay *disp)
"disabling display %s"), disp->name);
/* only display a dialog box if this is a local display */
if (disp->type == TYPE_LOCAL ||
disp->type == TYPE_FLEXI)
gdm_text_message_dialog (s);
disp->type == TYPE_FLEXI) {
char *ls = g_strdup_printf
(gdm_cons_i18n (N_("Failed to start the display server "
"several times in a short time period; "
"disabling display %s")), disp->name);
gdm_text_message_dialog (ls);
g_free (ls);
}
gdm_error ("%s", s);
g_free (s);
......
......@@ -336,7 +336,8 @@ gdm_config_parse (void)
}
if (ve_string_empty (GdmServAuthDir)) {
gdm_text_message_dialog (_("No daemon/ServAuthDir specified in the configuration file"));
gdm_text_message_dialog
(gdm_cons_i18n (N_("No daemon/ServAuthDir specified in the configuration file")));
gdm_fail (_("gdm_config_parse: No authdir specified."));
}
......@@ -463,12 +464,13 @@ gdm_config_parse (void)
g_free (GdmTimedLogin);
GdmTimedLogin = NULL;
} else {
char *s = g_strdup_printf (_("Xdmcp is disabled and gdm "
"cannot find any local server "
"to start. Aborting! Please "
"correct the configuration %s "
"and restart gdm."),
GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("Xdmcp is disabled and gdm "
"cannot find any local server "
"to start. Aborting! Please "
"correct the configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Xdmcp disabled and no local servers defined. Aborting!"));
}
......@@ -485,10 +487,11 @@ gdm_config_parse (void)
}
if (pwent == NULL) {
char *s = g_strdup_printf (_("The gdm user does not exist. "
"Please correct gdm configuration %s "
"and restart gdm."),
GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("The gdm user does not exist. "
"Please correct gdm configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Can't find the gdm user (%s). Aborting!"), GdmUser);
} else {
......@@ -496,11 +499,12 @@ gdm_config_parse (void)
}
if (GdmUserId == 0) {
char *s = g_strdup_printf (_("The gdm user is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm."), GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("The gdm user is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm.")), GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: The gdm user should not be root. Aborting!"));
}
......@@ -515,10 +519,11 @@ gdm_config_parse (void)
}
if (grent == NULL) {
char *s = g_strdup_printf (_("The gdm group does not exist. "
"Please correct gdm configuration %s "
"and restart gdm."),
GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("The gdm group does not exist. "
"Please correct gdm configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Can't find the gdm group (%s). Aborting!"), GdmGroup);
} else {
......@@ -526,11 +531,12 @@ gdm_config_parse (void)
}
if (GdmGroupId == 0) {
char *s = g_strdup_printf (_("The gdm group is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm."), GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("The gdm group is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm.")), GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: The gdm group should not be root. Aborting!"));
}
......@@ -563,50 +569,54 @@ gdm_config_parse (void)
/* Enter paranoia mode */
if (stat (GdmServAuthDir, &statbuf) == -1) {
char *s = g_strdup_printf (_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this does not exist. Please "
"correct gdm configuration %s and "
"restart gdm."), GdmServAuthDir,
GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this does not exist. Please "
"correct gdm configuration %s and "
"restart gdm.")), GdmServAuthDir,
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Authdir %s does not exist. Aborting."), GdmServAuthDir);
}
if (! S_ISDIR (statbuf.st_mode)) {
char *s = g_strdup_printf (_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this is not a directory. Please "
"correct gdm configuration %s and "
"restart gdm."), GdmServAuthDir,
GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this is not a directory. Please "
"correct gdm configuration %s and "
"restart gdm.")), GdmServAuthDir,
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Authdir %s is not a directory. Aborting."), GdmServAuthDir);
}
if (statbuf.st_uid != GdmUserId || statbuf.st_gid != GdmGroupId) {
char *s = g_strdup_printf (_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but is not owned by user %s and group "
"%s. Please correct the ownership or "
"gdm configuration %s and restart "
"gdm."),
GdmServAuthDir, GdmUser, GdmGroup,
GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but is not owned by user %s and group "
"%s. Please correct the ownership or "
"gdm configuration %s and restart "
"gdm.")),
GdmServAuthDir, GdmUser, GdmGroup,
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Authdir %s is not owned by user %s, group %s. Aborting."),
GdmServAuthDir, GdmUser, GdmGroup);
}
if (statbuf.st_mode != (S_IFDIR|S_IRWXU|S_IRGRP|S_IXGRP)) {
char *s = g_strdup_printf (_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but has the wrong permissions, it "
"should have permissions of 0750. "
"Please correct the permissions or "
"the gdm configuration %s and "
"restart gdm."),
GdmServAuthDir, GDM_CONFIG_FILE);
char *s = g_strdup_printf
(gdm_cons_i18n (N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but has the wrong permissions, it "
"should have permissions of 0750. "
"Please correct the permissions or "
"the gdm configuration %s and "
"restart gdm.")),
GdmServAuthDir, GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
gdm_fail (_("gdm_config_parse: Authdir %s has wrong permissions %o. Should be 0750. Aborting."),
GdmServAuthDir, statbuf.st_mode);
......@@ -862,11 +872,12 @@ deal_with_x_crashes (GdmDisplay *d)
/* Shit if we knew what the program was to tell the user,
* the above script would have been defined and we'd run
* it for them */
char *error = _("I cannot start the X server (your graphical "
"interface). It is likely that it is not set "
"up correctly. You will need to log in on a "
"console and rerun the X configuration "
"program. Then restart GDM.");
const char *error =
gdm_cons_i18n (N_("I cannot start the X server (your graphical "
"interface). It is likely that it is not set "
"up correctly. You will need to log in on a "
"console and rerun the X configuration "
"program. Then restart GDM."));
gdm_text_message_dialog (error);
} /* else {
* At this point .... screw the user, we don't know how to
......@@ -1283,8 +1294,10 @@ main (int argc, char *argv[])
store_argv (argc, argv);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, GNOMELOCALEDIR);
textdomain(PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
/* XDM compliant error message */
if (getuid () != 0) {
......
......@@ -766,6 +766,64 @@ gdm_setup_gids (const char *login, gid_t gid)
return TRUE;
}
/* See comment in misc.h file */
const char *
gdm_cons_i18n (const char *string)
{
char *vt_is_UTF8;
static gboolean checked = FALSE;
static gboolean is_utf8 = FALSE;
char *cmd;
if (checked) {
if (is_utf8)
return _(string);
else
return string;
}
checked = TRUE;
is_utf8 = FALSE;
if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) != 0)
return string;
vt_is_UTF8 = g_find_program_in_path ("vt-is-UTF8");
if (vt_is_UTF8 == NULL) {
int i;
char *check_paths[] = {
"/usr/bin/vt-is-UTF8",
"/usr/sbin/vt-is-UTF8",
"/bin/vt-is-UTF8",
"/sbin/vt-is-UTF8",
NULL
};
for (i = 0;
check_paths[i] != NULL &&
vt_is_UTF8 == NULL;
i++) {
if (access (check_paths[i], X_OK) == 0) {
vt_is_UTF8 = g_strdup (check_paths[i]);
}
}
}
if (vt_is_UTF8 == NULL)
return string;
cmd = g_strdup_printf (EXPANDED_SBINDIR "/gdmopen %s -q",
vt_is_UTF8);
if (system (cmd) == 0)
is_utf8 = TRUE;
g_free (cmd);
if (is_utf8)
return _(string);
else
return string;
}
/* EOF */
......@@ -28,6 +28,18 @@ void gdm_info (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void gdm_error (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void gdm_debug (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
/* Console i18n. A hack, but we'd rather speak english if we can't verify
* console fonts. So this will write out things localized only if it can
* verify a console being utf8. It will do this by gdmopening "vt-is-UTF8 -q"
* and checking the return value. This will only happen on the first try, but
* should only be used when you want to open a console anyway, so not to cause
* undue flicker. If so it will just _() the string, else it will just pass it
* along verbatim. The way to use this:
*
* foo (gdm_cons_i18n (N_("string")));
* */
const char *gdm_cons_i18n (const char *string);
/* Note that these can actually clear environment without killing
* the LD_* env vars if --preserve-ld-vars was passed to the
* main daemon */
......
......@@ -165,17 +165,17 @@ busy_ask_user (GdmDisplay *disp)
/* if we have "open" we can talk to the user */
if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) == 0) {
char *error = g_strdup_printf
(_("There already appears to be an X server "
"running on display %s. Should I try another "
"display number? If you answer no, I will "
"attempt to start the server on %s again.%s"),
(gdm_cons_i18n (N_("There already appears to be an X server "
"running on display %s. Should I try another "
"display number? If you answer no, I will "
"attempt to start the server on %s again.%s")),
disp->name,
disp->name,
#ifdef __linux__
_(" (You can change consoles by pressing Ctrl-Alt "
"plus a function key, such as Ctrl-Alt-F7 to go "
"to console 7. X servers usually run on consoles "
"7 and higher.)")
gdm_cons_i18n (N_(" (You can change consoles by pressing Ctrl-Alt "
"plus a function key, such as Ctrl-Alt-F7 to go "
"to console 7. X servers usually run on consoles "
"7 and higher.)"))
#else /* ! __linux__ */
/* no info for non linux users */
""
......
......@@ -367,14 +367,14 @@ gdm_slave_run (GdmDisplay *display)
* that we've given up. The error is likely something
* internal. */
gdm_text_message_dialog
(_("I could not start the X\n"
"server (your graphical environment)\n"
"due to some internal error.\n"
"Please contact your system administrator\n"
"or check your syslog to diagnose.\n"
"In the meantime this display will be\n"
"disabled. Please restart gdm when\n"
"the problem is corrected."));
(gdm_cons_i18n (N_("I could not start the X\n"
"server (your graphical environment)\n"
"due to some internal error.\n"
"Please contact your system administrator\n"
"or check your syslog to diagnose.\n"
"In the meantime this display will be\n"
"disabled. Please restart gdm when\n"
"the problem is corrected.")));
_exit (DISPLAY_ABORT);
}
gdm_slave_send_num (GDM_SOP_XPID, d->servpid);
......
......@@ -645,22 +645,23 @@ gdm_verify_cleanup (GdmDisplay *d)
void
gdm_verify_check (void)
{
/* FIXME: this is somewhat evil */
if (access (PAM_PREFIX "/pam.d/gdm", F_OK) != 0 &&
access ("/etc/pam.d/gdm", F_OK) != 0 &&
access (PAM_PREFIX "/pam.conf", F_OK) != 0 &&
access ("/etc/pam.conf", F_OK) != 0) {
char *s;
s = g_strdup_printf (_("Can't find PAM configuration file for gdm. "
"I've tried %s, %s, %s and %s"),
PAM_PREFIX "/pam.d/gdm",
"/etc/pam.d/gdm",
PAM_PREFIX "/pam.conf",
"/etc/pam.conf");
gdm_text_message_dialog (s);
gdm_fail ("gdm_verify_check: %s", s);
g_free (s); /* I'm an anal wanker */
pam_handle_t *ph = NULL;
if (pam_start ("gdm", NULL, &standalone_pamc, &ph) != PAM_SUCCESS) {
closelog ();
openlog ("gdm", LOG_PID, LOG_DAEMON);
gdm_text_message_dialog
(gdm_cons_i18n (N_("Can't find PAM configuration for gdm.")));
gdm_fail ("gdm_verify_check: %s",
_("Can't find PAM configuration for gdm."));
}
if (ph != NULL)
pam_end (ph, PAM_SUCCESS);
closelog ();
openlog ("gdm", LOG_PID, LOG_DAEMON);
}
/* used in pam */
......
......@@ -195,8 +195,9 @@ main (int argc, char *argv[])
char **execvec;
pid_t pid;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gnome_init_with_popt_table ("gdmXnestchooser", VERSION,
argc, argv, options, 0, &ctx);
......
......@@ -1102,8 +1102,9 @@ main (int argc, char *argv[])
glade_gnome_init();
g_free (fixedargv);
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gdm_wm_screen_init (GdmXineramaScreen);
......
......@@ -355,8 +355,9 @@ main (int argc, char *argv[])
if (g_getenv ("DOING_GDM_DEVELOPMENT") != NULL)
DOING_GDM_DEVELOPMENT = TRUE;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gnome_init ("gdmconfig", VERSION, argc, argv);
glade_gnome_init();
......
......@@ -522,8 +522,9 @@ main (int argc, char *argv[])
poptContext ctx;
const char **args;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gnome_init_with_popt_table ("gdmflexiserver", VERSION, argc, argv,
options, 0, &ctx);
......
......@@ -3667,8 +3667,9 @@ main (int argc, char *argv[])
setlocale (LC_ALL, "");
}
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
setup_cursor (GDK_LEFT_PTR);
......
......@@ -60,8 +60,9 @@ main (int argc, char *argv[])
int max_size;
char *last_pix;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gnome_program_init ("gdmphotosetup", VERSION,
LIBGNOMEUI_MODULE /* module_info */,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment