diff options
author | Wolfgang Müller | 2021-07-27 12:20:03 +0200 |
---|---|---|
committer | Wolfgang Müller | 2021-11-27 14:05:19 +0100 |
commit | 743db7dd1c0ced6d4aeb4d4719e4985e8f83890b (patch) | |
tree | d7e67f56053120e30b9f4cc7b89cb63590b586ae | |
parent | 84e59cbd782875a8ec0e2ca40fd1b086ca4ac64d (diff) | |
download | weltschmerz-743db7dd1c0ced6d4aeb4d4719e4985e8f83890b.tar.gz |
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.
-rw-r--r-- | configreader.vala | 6 | ||||
-rw-r--r-- | po/de.po | 14 | ||||
-rw-r--r-- | po/fi.po | 14 | ||||
-rw-r--r-- | 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); } @@ -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 <wolf@oriole.systems>\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 <group>.<key> from the config file #: configreader.vala:169 @@ -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ä <juhani@krekelä.fi>\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 <group>.<key> 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 <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\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] "" |