[devhelp: 5/5] parser: fix/improve error messages and do not translate them
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp: 5/5] parser: fix/improve error messages and do not translate them
- Date: Thu, 11 May 2017 17:34:43 +0000 (UTC)
commit f269489474d43b1d6c57bfa377fb08007dd03460
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu May 11 15:02:05 2017 +0200
parser: fix/improve error messages and do not translate them
Why not translating them?
- The error messages are not displayed in the GUI, only in the terminal
or the journal.
- When looking at the *.po files, XML attributes like "title", "name"
and "link" are sometimes translated but they must not be translated. It
would have been possible to add translator comments to say that those
must not be translated, but even with that I think some translators
would have translated the XML attributes anyway.
- With the English sentences, it is easy to search in the source code
where the error comes from. Also when someone reports a bug, etc.
- Devhelp is an application for developers, all the API references are
written in English, I think the person seeing an error message will be
able to understand it if it's in English…
src/dh-parser.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/dh-parser.c b/src/dh-parser.c
index b728ce2..7d2c174 100644
--- a/src/dh-parser.c
+++ b/src/dh-parser.c
@@ -21,7 +21,6 @@
#include "config.h"
#include "dh-parser.h"
#include <string.h>
-#include <glib/gi18n-lib.h>
#include "dh-error.h"
#include "dh-link.h"
@@ -100,8 +99,8 @@ parser_start_node_book (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("Expected “%s”, got “%s” at line %d, column %d"),
- "book", node_name, line, col);
+ "Expected <book> element, got <%s> at line %d, column %d.",
+ node_name, line, col);
return;
}
@@ -115,7 +114,8 @@ parser_start_node_book (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("Invalid namespace “%s” at line %d, column %d"),
+ "Expected xmlns value “" NAMESPACE "”, "
+ "got “%s” at line %d, column %d.",
xmlns, line, col);
return;
}
@@ -138,8 +138,8 @@ parser_start_node_book (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("“title”, “name” and “link” elements are "
- "required at line %d, column %d"),
+ "“title”, “name” and “link” attributes are required "
+ "inside the <book> element at line %d, column %d.",
line, col);
return;
}
@@ -201,8 +201,8 @@ parser_start_node_chapter (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("Expected “%s” element, got “%s” at line %d, column %d"),
- "sub", node_name, line, col);
+ "Expected <sub> element, got <%s> at line %d, column %d.",
+ node_name, line, col);
return;
}
@@ -218,8 +218,8 @@ parser_start_node_chapter (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("“name” and “link” elements are required "
- "inside the <sub> element at line %d, column %d"),
+ "“name” and “link” elements are required inside "
+ "the <sub> element at line %d, column %d.",
line, col);
return;
}
@@ -267,8 +267,8 @@ parser_start_node_keyword (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("Expected “%s” element, got “%s” at line %d, column %d"),
- "keyword", node_name, line, col);
+ "Expected <keyword> element, got <%s> at line %d, column %d.",
+ node_name, line, col);
return;
} else if (parser->version == 1 &&
g_ascii_strcasecmp (node_name, "function") != 0) {
@@ -276,8 +276,8 @@ parser_start_node_keyword (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("Expected “%s” element, got “%s” at line %d, column %d"),
- "function", node_name, line, col);
+ "Expected <function> element, got <%s> at line %d, column %d.",
+ node_name, line, col);
return;
}
@@ -297,8 +297,8 @@ parser_start_node_keyword (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("“name” and “link” attributes are required "
- "inside “%s” element on line %d, column %d"),
+ "“name” and “link” attributes are required inside "
+ "the <%s> element at line %d, column %d.",
parser->version == 2 ? "keyword" : "function",
line, col);
return;
@@ -309,8 +309,8 @@ parser_start_node_keyword (DhParser *parser,
g_set_error (error,
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
- _("“type” attribute is required inside "
- "<keyword> element on line %d, column %d"),
+ "“type” attribute is required inside the "
+ "<keyword> element at line %d, column %d.",
line, col);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]