GnuCash
Contact   Instructions
Bug 792446 - Mixed languages in error dialog
Summary: Mixed languages in error dialog
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Translations (show other bugs)
Version: 2.6.x
Hardware: Other All
: Normal minor
Target Milestone: ---
Assignee: documentation
QA Contact: documentation
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-11 20:16 EST by Frank H. Ellenberger
Modified: 2020-06-01 15:26 EDT (History)
5 users (show)

See Also:


Attachments
languagemix.jpeg (10.43 KB, image/jpeg)
2018-01-11 20:16 EST, Frank H. Ellenberger
no flags Details

Description Frank H. Ellenberger 2018-01-11 20:16:21 EST
Created attachment 366692 [details]
languagemix.jpeg

While reviewing translations I got the following dialog - see attachment:
"Cannot open file /home/frank/.gnucash/checks/KeinOffset.chk: Datei oder Verzeichnis nicht gefunden"

To reproduce it:
While I was in the gnucash session I removed ~/.gnucash/checks/

LANG=de_DE.utf8 gnucash 
Open or create a file with a bank account,
File->Print checks ...(Datei->Schecks drucken)
Choose Check format: Userdefined (Benutzerdefiniert)
Select tab "User defined format" (Benutzerdefiniertes Format)
Save Check format
enter some name e.g. "KeinOffset"
Press OK
if ~/.gnucash/checks/ does not exist, the dialog appears.

In this case - others might exist, too - we have
src/gnome/dialog-print-check.c:
   pcd_save_custom_data(PrintCheckDialog *pcd, const gchar *title)
     :
     if (gnc_key_file_save_to_file(pathname, key_file, &error))
        :
    else
    {
        dialog = gtk_message_dialog_new(GTK_WINDOW(pcd->dialog),
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
                                        GTK_MESSAGE_ERROR,
                                        GTK_BUTTONS_CLOSE, "%s",
                                        _("Cannot save check format file."));
        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
                "%s", error->message);

in src/core-utils/gnc-keyfile-utils.c:
gboolean
gnc_key_file_save_to_file (const gchar *filename,
                           GKeyFile *key_file,
                           GError **error)
are several occurences of 
"Cannot open file %s: %s\n", filename, strerror(errno)
depending on the OS settings, strerror(errno) gets translated while
"Cannot open ..." remains intentional untranslated - their main purpose are messages for developers. But as this example shows, some are returned to the user.

Suggestion: mark them here N_(...) 
and depending on the context return them as %s or _(%s).
I am not sure if we need a separate flag or if there are other ways to determinate the context. Tracefiles should get them untranslated, user dialogs translated.
Comment 1 Frank H. Ellenberger 2018-01-11 20:48:18 EST
Another approach might be, to verifying the path before by using gnc-filepath-utils.c, which returns translated strings.
Comment 2 John Ralls 2018-09-27 21:04:55 EDT
*error = g_error_new(G_FILE_ERROR, g_file_error_from_errno(errno),
                     N_("Cannot open file %s: %s"), filename,
                     strerror(errno));
...
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
                                         "%s", _(error->message));

won't work because error->message will have the filename and error string filled in and so won't match "Cannot open file %s: %s".

Instead, I removed "Cannot open file" from the GError and added it (with translation marking) to gcd_save_custom_data.

Fixed for 3.3 if you update gnucash.pot, merge it to de.po, and provide a translation by Saturday.

Note You need to log in before you can comment on or make changes to this bug.