From 743db7dd1c0ced6d4aeb4d4719e4985e8f83890b Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Tue, 27 Jul 2021 12:20:03 +0200 Subject: Clarify warning on duplicate keys In order to alert the user to any potential errors in the configuration files, we keep track of configuration entries that we have not accessed and print them out. These might include misspellings or otherwise malformed strings. To collect those unparsed configuration entries, we remove the ones that have been successfully parsed from our in-memory KeyFile. The remaining keys are the offending ones. Unfortunately, because KeyFile.remove_key() removes only one matching key, we might also be left with any duplicates that would otherwise be valid entries. So, if the entry misc.font is specified twice, we currently warn about an "unknown" key, the second misc.font entry. This could potentially be misleading to the user. Since it is too expensive to fix this issue in the code, make sure we warn instead about "unknown or duplicate" keys. This way we say the correct thing without incurring a big complexity cost. --- configreader.vala | 6 +++--- po/de.po | 14 +++++++------- po/fi.po | 14 +++++++------- po/weltschmerz.pot | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/configreader.vala b/configreader.vala index 8336637..4c68901 100644 --- a/configreader.vala +++ b/configreader.vala @@ -107,9 +107,9 @@ class ConfigReader { if (keys.length > 0) { var keylist = string.joinv(", ", keys); - // TRANSLATORS: %s is the list of unknown keys joined with ', ' - var warning = ngettext("unknown key in config: %s", - "unknown keys in config: %s", keys.length).printf(keylist); + // TRANSLATORS: %s is the list of unknown or duplicate keys joined with ', ' + var warning = ngettext("unknown or duplicate key in config: %s", + "unknown or duplicate keys in config: %s", keys.length).printf(keylist); append_warning(warning); } diff --git a/po/de.po b/po/de.po index 9ed58c4..c4f9c23 100644 --- a/po/de.po +++ b/po/de.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: weltschmerz\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-07-24 19:10+0300\n" -"PO-Revision-Date: 2021-07-24 19:06+0200\n" +"POT-Creation-Date: 2021-07-26 13:03+0200\n" +"PO-Revision-Date: 2021-07-27 12:13+0200\n" "Last-Translator: Wolfgang Müller \n" "Language-Team: Wolfgang Müller\n" "Language: de\n" @@ -18,13 +18,13 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.3.1\n" -#. TRANSLATORS: %s is the list of unknown keys joined with ', ' +#. TRANSLATORS: %s is the list of unknown or duplicate keys joined with ', ' #: configreader.vala:111 #, c-format -msgid "unknown key in config: %s" -msgid_plural "unknown keys in config: %s" -msgstr[0] "unbekannter Schlüssel in der Konfigurationsdatei: %s" -msgstr[1] "unbekannte Schlüssel in der Konfigurationsdatei: %s" +msgid "unknown or duplicate key in config: %s" +msgid_plural "unknown or duplicate keys in config: %s" +msgstr[0] "unbekannter oder mehrmals vorhandener Schlüssel in der Konfigurationsdatei: %s" +msgstr[1] "unbekannte oder mehrmals vorhandene Schlüssel in der Konfigurationsdatei: %s" #. TRANSLATORS: First %s is parsed colour, %s.%s is . from the config file #: configreader.vala:169 diff --git a/po/fi.po b/po/fi.po index 33b417f..936a9c6 100644 --- a/po/fi.po +++ b/po/fi.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: weltschmerz\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-07-24 19:10+0300\n" -"PO-Revision-Date: 2021-07-24 19:13+0300\n" +"POT-Creation-Date: 2021-07-26 13:03+0200\n" +"PO-Revision-Date: 2021-07-27 12:16+0200\n" "Last-Translator: Juhani Krekelä \n" "Language-Team: nortti\n" "Language: fi\n" @@ -18,13 +18,13 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.3\n" -#. TRANSLATORS: %s is the list of unknown keys joined with ', ' +#. TRANSLATORS: %s is the list of unknown or duplicate keys joined with ', ' #: configreader.vala:111 #, c-format -msgid "unknown key in config: %s" -msgid_plural "unknown keys in config: %s" -msgstr[0] "tuntematon avain asetuksissa: %s" -msgstr[1] "tuntemattomia avaimia asetuksissa: %s" +msgid "unknown or duplicate key in config: %s" +msgid_plural "unknown or duplicate keys in config: %s" +msgstr[0] "tuntematon tai useampaan kertaan käytetty avain asetuksissa: %s" +msgstr[1] "tuntemattomia tai useampaan kertaan käytettyjä avaimia asetuksissa: %s" #. TRANSLATORS: First %s is parsed colour, %s.%s is . from the config file #: configreader.vala:169 diff --git a/po/weltschmerz.pot b/po/weltschmerz.pot index f1d1b1d..2163c3e 100644 --- a/po/weltschmerz.pot +++ b/po/weltschmerz.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: weltschmerz\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-07-24 19:10+0300\n" +"POT-Creation-Date: 2021-07-26 13:03+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,11 +18,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#. TRANSLATORS: %s is the list of unknown keys joined with ', ' +#. TRANSLATORS: %s is the list of unknown or duplicate keys joined with ', ' #: configreader.vala:111 #, c-format -msgid "unknown key in config: %s" -msgid_plural "unknown keys in config: %s" +msgid "unknown or duplicate key in config: %s" +msgid_plural "unknown or duplicate keys in config: %s" msgstr[0] "" msgstr[1] "" -- cgit v1.2.3-2-gb3c3