« get me outta code hell

translate a few miscellaneous missed things! - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-03-10 11:49:04 -0400
committer(quasar) nebula <towerofnix@gmail.com>2021-03-10 11:49:04 -0400
commit082427cb1f48ce2b1c7e13f362499a5c58ca76ab (patch)
tree97126e147c48d508b8334a9cc0fae1d09f2c3b3a
parent814b1f165c4f6e0623040e2b9b8fb78add1d3930 (diff)
translate a few miscellaneous missed things!
-rw-r--r--strings-default.json1
-rwxr-xr-xupd8.js50
2 files changed, 30 insertions, 21 deletions
diff --git a/strings-default.json b/strings-default.json
index 5a3d9364..0cf6a4bb 100644
--- a/strings-default.json
+++ b/strings-default.json
@@ -109,6 +109,7 @@
     "misc.chronology.heading.coverArt": "{INDEX} cover art by {ARTIST}",
     "misc.chronology.heading.flash": "{INDEX} flash/game by {ARTIST}",
     "misc.chronology.heading.track": "{INDEX} track by {ARTIST}",
+    "misc.external.domain": "External ({DOMAIN})",
     "misc.external.bandcamp": "Bandcamp",
     "misc.external.bandcamp.domain": "Bandcamp ({DOMAIN})",
     "misc.external.deviantart": "DeviantArt",
diff --git a/upd8.js b/upd8.js
index fefc1874..bbbaf49c 100755
--- a/upd8.js
+++ b/upd8.js
@@ -3443,12 +3443,17 @@ function writeFlashPage(flash) {
                 ${flash.tracks.length && fixWS`
                     <p>Tracks featured in <i>${flash.name.replace(/\.$/, '')}</i>:</p>
                     <ul>
-                        ${flash.tracks.map(track => fixWS`
-                            <li>
-                                <a href="${C.TRACK_DIRECTORY}/${track.directory}/" style="${getLinkThemeString(track)}">${track.name}</a>
-                                <span class="by">by ${getArtistString(track.artists, {strings, to})}</span>
-                            </li>
-                        `).join('\n')}
+                        ${(flash.tracks
+                            .map(track => strings('trackList.item.withArtists', {
+                                track: strings.link.track(track, {strings, to}),
+                                by: `<span class="by">${
+                                    strings('trackList.item.withArtists.by', {
+                                        artists: getArtistString(track.artists, {strings, to})
+                                    })
+                                }</span>`
+                            }))
+                            .map(row => `<li>${row}</li>`)
+                            .join('\n'))}
                     </ul>
                 `}
                 ${flash.contributors.textContent && fixWS`
@@ -4592,7 +4597,9 @@ function getArtistString(artists, {strings, to, showIcons = false, showContrib =
         return [
             strings.link.artist(who, {to}),
             showContrib && what && `(${what})`,
-            showIcons && urls.length && `<span class="icons">(${urls.map(iconifyURL).join(', ')})</span>`
+            showIcons && urls.length && `<span class="icons">(${
+                strings.list.unit(urls.map(url => iconifyURL(url, {strings, to})))
+            })</span>`
         ].filter(Boolean).join(' ');
     }));
 }
@@ -4700,24 +4707,25 @@ function fancifyFlashURL(url, flash, {strings}) {
     }</span>`;
 }
 
-function iconifyURL(url) {
+function iconifyURL(url, {strings, to}) {
+    const domain = new URL(url).hostname;
     const [ id, msg ] = (
-        url.includes('bandcamp.com') ? ['bandcamp', 'Bandcamp'] :
+        domain.includes('bandcamp.com') ? ['bandcamp', strings('misc.external.bandcamp')] :
         (
-            url.includes('music.solatrus.com')
-        ) ? ['bandcamp', `Bandcamp (${new URL(url).hostname})`] :
+            domain.includes('music.solatrus.com')
+        ) ? ['bandcamp', strings('misc.external.bandcamp.domain', {domain})] :
         (
-            url.includes('types.pl')
-        ) ? ['mastodon', `Mastodon (${new URL(url).hostname})`] :
-        url.includes('youtu') ? ['youtube', 'YouTube'] :
-        url.includes('soundcloud') ? ['soundcloud', 'SoundCloud'] :
-        url.includes('tumblr.com') ? ['tumblr', 'Tumblr'] :
-        url.includes('twitter.com') ? ['twitter', 'Twitter'] :
-        url.includes('deviantart.com') ? ['deviantart', 'DeviantArt'] :
-        url.includes('instagram.com') ? ['instagram', 'Instagram'] :
-        ['globe', `External (${new URL(url).hostname})`]
+            domain.includes('types.pl')
+        ) ? ['mastodon', strings('misc.external.mastodon.domain', {domain})] :
+        domain.includes('youtu') ? ['youtube', strings('misc.external.youtube')] :
+        domain.includes('soundcloud') ? ['soundcloud', strings('misc.external.soundcloud')] :
+        domain.includes('tumblr.com') ? ['tumblr', strings('misc.external.tumblr')] :
+        domain.includes('twitter.com') ? ['twitter', strings('misc.external.twitter')] :
+        domain.includes('deviantart.com') ? ['deviantart', strings('misc.external.deviantart')] :
+        domain.includes('instagram.com') ? ['instagram', strings('misc.external.bandcamp')] :
+        ['globe', strings('misc.external.domain', {domain})]
     );
-    return fixWS`<a href="${url}" class="icon"><svg><title>${msg}</title><use href="/${C.STATIC_DIRECTORY}/icons.svg#icon-${id}"></use></svg></a>`;
+    return fixWS`<a href="${url}" class="icon"><svg><title>${msg}</title><use href="${to.staticFile(`icons.svg#icon-${id}`)}"></use></svg></a>`;
 }
 
 function chronologyLinks(currentThing, {