Here is an example for the decision about what to use in context. I took the word “Report” I talked about before. I fix it below in two ways - with short context, and with longer and more structured one.
Fix 1. Short/minimalistic context. Generating two messages. But it doesn’t provide the translators with details about where this is used, only focuses on the ambiguity of the word:
diff --git a/gramps/gen/lib/notetype.py b/gramps/gen/lib/notetype.py
index 7cef15989..b7d0092cc 100644
--- a/gramps/gen/lib/notetype.py
+++ b/gramps/gen/lib/notetype.py
@@ -73,4 +73,4 @@ class NoteType(GrampsType):
(CITATION, _('Citation'), "Citation"),
- (REPORT_TEXT, _("Report"), "Report"),
+ (REPORT_TEXT, _("Report", "as noun"), "Report"),
(HTML_CODE, _("Html code"), "Html code"),
(TODO, _("To Do", "notetype"), "To Do"),
diff --git a/gramps/gen/plug/_pluginreg.py b/gramps/gen/plug/_pluginreg.py
index 10c08db4d..bfa1514a8 100644
--- a/gramps/gen/plug/_pluginreg.py
+++ b/gramps/gen/plug/_pluginreg.py
@@ -76,7 +76,7 @@ RULE = 13
PTYPE = [REPORT, QUICKREPORT, TOOL, IMPORT, EXPORT, DOCGEN, GENERAL,
MAPSERVICE, VIEW, RELCALC, GRAMPLET, SIDEBAR, DATABASE, RULE]
PTYPE_STR = {
- REPORT: _('Report') ,
+ REPORT: _('Report', 'as noun') ,
QUICKREPORT: _('Quickreport'),
TOOL: _('Tool'),
IMPORT: _('Importer'),
diff --git a/gramps/gui/logger/_errorview.py b/gramps/gui/logger/_errorview.py
index 210a7762a..f7dcbd810 100644
--- a/gramps/gui/logger/_errorview.py
+++ b/gramps/gui/logger/_errorview.py
@@ -164,3 +164,3 @@ class ErrorView(ManagedWindow):
self.top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
- self.top.add_button(_("Report"), Gtk.ResponseType.YES)
+ self.top.add_button(_('Report', 'as verb'), Gtk.ResponseType.YES)
self.top.add_button(_('_Help'), Gtk.ResponseType.HELP)
Fix 2. Structured context. Generating three messages. The structure of the context is “Category: specifics” - it provides the translator with full information about where the string will appear. Categories could be ie. Title, Menu, Button, Enumeration.
diff --git a/gramps/gen/lib/notetype.py b/gramps/gen/lib/notetype.py
index 7cef15989..b7d0092cc 100644
--- a/gramps/gen/lib/notetype.py
+++ b/gramps/gen/lib/notetype.py
@@ -73,4 +73,4 @@ class NoteType(GrampsType):
(CITATION, _('Citation'), "Citation"),
- (REPORT_TEXT, _("Report"), "Report"),
+ (REPORT_TEXT, _("Report", "Enumeration: type of note"), "Report"),
(HTML_CODE, _("Html code"), "Html code"),
(TODO, _("To Do", "notetype"), "To Do"),
diff --git a/gramps/gen/plug/_pluginreg.py b/gramps/gen/plug/_pluginreg.py
index 10c08db4d..bfa1514a8 100644
--- a/gramps/gen/plug/_pluginreg.py
+++ b/gramps/gen/plug/_pluginreg.py
@@ -76,7 +76,7 @@ RULE = 13
PTYPE = [REPORT, QUICKREPORT, TOOL, IMPORT, EXPORT, DOCGEN, GENERAL,
MAPSERVICE, VIEW, RELCALC, GRAMPLET, SIDEBAR, DATABASE, RULE]
PTYPE_STR = {
- REPORT: _('Report') ,
+ REPORT: _('Report', 'Enumeration: type of plugin') ,
QUICKREPORT: _('Quickreport'),
TOOL: _('Tool'),
IMPORT: _('Importer'),
diff --git a/gramps/gui/logger/_errorview.py b/gramps/gui/logger/_errorview.py
index 210a7762a..f7dcbd810 100644
--- a/gramps/gui/logger/_errorview.py
+++ b/gramps/gui/logger/_errorview.py
@@ -164,3 +164,3 @@ class ErrorView(ManagedWindow):
self.top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
- self.top.add_button(_("Report"), Gtk.ResponseType.YES)
+ self.top.add_button(_('Report', 'Button: send a report'), Gtk.ResponseType.YES)
self.top.add_button(_('_Help'), Gtk.ResponseType.HELP)
The idea in my head evolved a bit - I no longer think all strings should have context. The long messages, being muti-line / multi-sentence, are always used as either labels(description area within some window), messages or tooltips. Distinguishing between these types doesn’t influence translation. Also being long, these messages provide enough context by themselves. So I think only single-line / single-sentence messages should have contexts.