« get me outta code hell

make additional files a counted string - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-06-18 15:52:22 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-06-18 15:52:22 -0300
commitb839fb97415e155ea25b29581fa605fe1f65b5f2 (patch)
tree160a407d7adab5463bd18cb35c9d7902f6e3870e /src
parente33d80f5704ab974f781bc97191d1e29a1ccc77e (diff)
make additional files a counted string
Diffstat (limited to 'src')
-rw-r--r--src/data/things.js1
-rw-r--r--src/misc-templates.js4
-rw-r--r--src/strings-default.json9
3 files changed, 12 insertions, 2 deletions
diff --git a/src/data/things.js b/src/data/things.js
index 035879f1..6a5cdb5e 100644
--- a/src/data/things.js
+++ b/src/data/things.js
@@ -1712,6 +1712,7 @@ Object.assign(Language.prototype, {
     },
 
     // TODO: These are hard-coded. Is there a better way?
+    countAdditionalFiles: countHelper('additionalFiles', 'files'),
     countAlbums: countHelper('albums'),
     countCommentaryEntries: countHelper('commentaryEntries', 'entries'),
     countContributions: countHelper('contributions'),
diff --git a/src/misc-templates.js b/src/misc-templates.js
index c337f6e2..61afa710 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -51,7 +51,9 @@ export function generateAdditionalFilesList(additionalFiles, {language, getFileS
     const fileCount = additionalFiles.flatMap(g => g.files).length;
 
     return fixWS`
-        <p id="additional-files">${language.$('releaseInfo.additionalFiles.heading', {fileCount})}</p>
+        <p id="additional-files">${language.$('releaseInfo.additionalFiles.heading', {
+            additionalFiles: language.countAdditionalFiles(fileCount, {unit: true})
+        })}</p>
         <dl>
             ${additionalFiles.map(({ title, description, files }) => fixWS`
                 <dt>${(description
diff --git a/src/strings-default.json b/src/strings-default.json
index b607b06e..fb2e333c 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -8,6 +8,13 @@
     "count.tracks.withUnit.few": "",
     "count.tracks.withUnit.many": "",
     "count.tracks.withUnit.other": "{TRACKS} tracks",
+    "count.additionalFiles": "{FILES}",
+    "count.additionalFiles.withUnit.zero": "",
+    "count.additionalFiles.withUnit.one": "{FILES} additional file",
+    "count.additionalFiles.withUnit.two": "",
+    "count.additionalFiles.withUnit.few": "",
+    "count.additionalFiles.withUnit.many": "",
+    "count.additionalFiles.withUnit.other": "{FILES} additional files",
     "count.albums": "{ALBUMS}",
     "count.albums.withUnit.zero": "",
     "count.albums.withUnit.one": "{ALBUMS} album",
@@ -105,7 +112,7 @@
     "releaseInfo.artTags": "Tags:",
     "releaseInfo.additionalFiles.shortcut": "{ANCHOR_LINK} {TITLES}",
     "releaseInfo.additionalFiles.shortcut.anchorLink": "Additional files:",
-    "releaseInfo.additionalFiles.heading": "Has {FILE_COUNT} additional files:",
+    "releaseInfo.additionalFiles.heading": "Has {ADDITIONAL_FILES}:",
     "releaseInfo.additionalFiles.entry": "{TITLE}",
     "releaseInfo.additionalFiles.entry.withDescription": "{TITLE}: {DESCRIPTION}",
     "releaseInfo.additionalFiles.file": "{FILE}",