Re: message formatting and i18n
Hi Roland, some messages in the Midnight Commander don't translate well to other languages because the string is concatenated manually, like in src/ext.c, line 486. I started to fix some of these in mcedit. How do you feel about the new code? Well, it is step in right direction, but I am wondering why message() are not used? -- Regards, Andrew V. Samoilov GET INTERNET ACCESS FROM BCS! http://www.bcs.zp.ua Join BCS today! For your FREE webmail, visit: http://email.zp.ua/ ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: message formatting and i18n
Hello, Roland! This patch fixes too many arguments for format warning and eliminates g_string_*() at all. -- Regards, Andrew V. Samoilov GET INTERNET ACCESS FROM BCS! http://www.bcs.zp.ua Join BCS today! For your FREE webmail, visit: http://email.zp.ua/ src/ChangeLog: * ext.c (regex_command): Eliminate g_string_*(). --- ext.c~ Mon Feb 7 09:29:42 2005 +++ ext.c Mon Feb 7 15:50:27 2005 @@ -461,35 +461,27 @@ regex_command (const char *filename, con home_error = 1; goto check_stock_mc_ext; } else { - GString *msg1 = g_string_new (NULL); - GString *msg2 = g_string_new (NULL); - - g_string_sprintf (msg1, _( %s%s file error), - mc_home, MC_LIB_EXT); - g_string_sprintf (msg2, _(The format of the %smc.ext + char *title = + g_strdup_printf (_( %s%s file error), + mc_home, MC_LIB_EXT); + message (1, title, _(The format of the %smc.ext file has changed with version 3.0. It seems that the installation failed. Please fetch a fresh copy from the Midnight Commander package.), mc_home); - message (1, msg1-str, %s, msg2-str); - g_string_free (msg1, TRUE); - g_string_free (msg2, TRUE); + g_free (title); return 0; } } } if (home_error) { - GString *title = g_string_new (NULL); - GString *text = g_string_new (NULL); - - g_string_sprintf (title, _( ~/%s file error ), MC_USER_EXT); - g_string_sprintf (text, _(The format of the ~/%s file has + char *title = + g_strdup_printf (_( ~/%s file error ), MC_USER_EXT); + message (1, title, _(The format of the ~/%s file has changed with version 3.0. You may either want to copy it from %smc.ext of use that file as an example of how - to write it.), MC_USER_EXT, mc_home, mc_home); - message (1, title-str, %s, text-str); - g_string_free (title, TRUE); - g_string_free (text, TRUE); + to write it.), MC_USER_EXT, mc_home); + g_free (title); } } mc_stat (filename, mystat); ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re[2]: message formatting and i18n
Hello Andrew, Monday, February 7, 2005, 7:26:35 PM, you wrote: AVS Hello, Roland! AVS This patch fixes too many arguments for format warning and eliminates AVS g_string_*() at all. Committed. Thx -- Best regards, Pavelmailto:[EMAIL PROTECTED] ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
message formatting and i18n
Hi all, some messages in the Midnight Commander don't translate well to other languages because the string is concatenated manually, like in src/ext.c, line 486. I started to fix some of these in mcedit. How do you feel about the new code? Well, one thing is not too nice about it: The assignment of errmsg = ... while passing it as a function argument. But I don't want to allocate memory that I don't need. Roland ? mc.qpg ? rillig ? edit/editcommands.c ? maint/template.c Index: configure.ac === RCS file: /cvsroot/mc/mc/configure.ac,v retrieving revision 1.20 diff -u -p -u -r1.20 configure.ac --- configure.ac30 Jan 2005 05:06:13 - 1.20 +++ configure.ac6 Feb 2005 15:11:18 - @@ -565,6 +565,12 @@ if test x$USE_MAINTAINER_MODE = xyes fi fi +AC_ARG_ENABLE([fast-moves], + [ --disable-fast-moves Disable fast cursor movement in the internal editor]) +if test x$enable_fast_moves != xno; then + AC_DEFINE([FAST_MOVE_CURSOR], [1], [Define to enable fast cursor movement in mcedit]) +fi + ri_GCC_WARNINGS AC_SUBST(CFLAGS) Index: edit/edit.c === RCS file: /cvsroot/mc/mc/edit/edit.c,v retrieving revision 1.93 diff -u -p -u -r1.93 edit.c --- edit/edit.c 30 Jan 2005 20:34:58 - 1.93 +++ edit/edit.c 6 Feb 2005 15:11:18 - @@ -138,11 +138,10 @@ edit_load_file_fast (WEdit *edit, const if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) { /* The file-name is printed after the ':' */ - edit_error_dialog (_(Error), - get_sys_error (catstrs - (_ - ( Cannot open file for reading: ), - filename, , (char *) NULL))); + GString *errmsg = g_string_new(NULL); + g_string_sprintf(errmsg, _( Cannot open %s for reading ), filename); + edit_error_dialog (_(Error), get_sys_error (errmsg-str)); + g_string_free (errmsg, TRUE); return 1; } @@ -268,19 +267,18 @@ edit_insert_file (WEdit *edit, const cha edit_insert_stream (edit, f); edit_cursor_move (edit, current - edit-curs1); if (pclose (f) 0) { - edit_error_dialog (_(Error), - catstrs (_ - ( Error reading from pipe: ), - p, , (char *) NULL)); + GString *errmsg = g_string_new (NULL); + g_string_sprintf (errmsg, _( Error reading from pipe: %s ), p); + edit_error_dialog (_(Error), errmsg-str); + g_string_free (errmsg, TRUE); g_free (p); return 0; } } else { - edit_error_dialog (_(Error), - get_sys_error (catstrs - (_ - ( Cannot open pipe for reading: ), - p, , (char *) NULL))); + GString *errmsg = g_string_new (NULL); + g_string_sprintf (errmsg, _( Cannot open pip for reading: %s ), p); + edit_error_dialog (_(Error), errmsg-str); + g_string_free (errmsg, TRUE); g_free (p); return 0; } @@ -310,6 +308,7 @@ static int check_file_access (WEdit *edit, const char *filename, struct stat *st) { int file; +GString *errmsg = (GString *) 0; /* Try opening an existing file */ file = mc_open (filename, O_NONBLOCK | O_RDONLY | O_BINARY, 0666); @@ -324,12 +323,9 @@ check_file_access (WEdit *edit, const ch O_NONBLOCK | O_RDONLY | O_BINARY | O_CREAT | O_EXCL, 0666); if (file 0) { - edit_error_dialog (_(Error), - get_sys_error (catstrs - (_ - ( Cannot open file for reading: ), - filename, , (char *) NULL))); - return 1; + g_string_sprintf (errmsg = g_string_new (NULL), + _( Cannot open %s for reading ), filename); + goto cleanup; } else { /* New file, delete it if it's not modified or saved */ edit-delete_file = 1; @@ -338,22 +334,16 @@ check_file_access (WEdit *edit, const ch /* Check what we have opened */ if (mc_fstat (file, st) 0) { - mc_close (file); - edit_error_dialog (_(Error), - get_sys_error (catstrs - (_ - ( Cannot get size/permissions info for file: ), - filename, , (char *)
Re: message formatting and i18n
On Sun, Feb 06, 2005 at 04:18:51PM +0100, Roland Illig wrote: + g_string_sprintf (errmsg, _( Cannot open pip for reading: %s ), p); somehow pip looks wrong to me. :) -catstrs (_( Not an ordinary file: ), filename, + _( %s is not an ordinary file ), filename); i'm wondering why on earth ordinary was used, when the proper terminology is regular and in no way less (i mean, even less :)) obvious to the uninitiated. -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: message formatting and i18n
Oswald Buddenhagen wrote: On Sun, Feb 06, 2005 at 04:18:51PM +0100, Roland Illig wrote: + g_string_sprintf (errmsg, _( Cannot open pip for reading: %s ), p); somehow pip looks wrong to me. :) - catstrs (_( Not an ordinary file: ), filename, + _( %s is not an ordinary file ), filename); i'm wondering why on earth ordinary was used, when the proper terminology is regular and in no way less (i mean, even less :)) obvious to the uninitiated. Fixed the spelling errors and committed the rest. Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel