« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/listing-spec.js28
-rw-r--r--src/misc-templates.js4
-rw-r--r--src/page/album-commentary.js6
-rw-r--r--src/page/album.js12
-rw-r--r--src/page/artist.js16
-rw-r--r--src/page/flash.js2
-rw-r--r--src/page/group.js2
-rw-r--r--src/page/homepage.js2
-rw-r--r--src/page/listing.js2
-rw-r--r--src/page/news.js6
-rw-r--r--src/page/track.js6
-rwxr-xr-xsrc/upd8.js2
12 files changed, 44 insertions, 44 deletions
diff --git a/src/listing-spec.js b/src/listing-spec.js
index 755564b9..c583a4d1 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -56,7 +56,7 @@ const listingSpec = [
         row({album, duration}, {link, strings}) {
             return language.$('listingPage.listAlbums.byDuration.item', {
                 album: link.album(album),
-                duration: strings.count.duration(duration)
+                duration: language.formatDuration(duration)
             });
         }
     },
@@ -72,7 +72,7 @@ const listingSpec = [
         row(album, {link, strings}) {
             return language.$('listingPage.listAlbums.byDate.item', {
                 album: link.album(album),
-                date: strings.count.date(album.date)
+                date: language.formatDate(album.date)
             });
         }
     },
@@ -93,7 +93,7 @@ const listingSpec = [
                 <dl>
                     ${chunks.map(({dateAddedToWiki, chunk: albums}) => fixWS`
                         <dt>${language.$('listingPage.listAlbums.byDateAdded.date', {
-                            date: strings.count.date(dateAddedToWiki)
+                            date: language.formatDate(dateAddedToWiki)
                         })}</dt>
                         <dd><ul>
                             ${(albums
@@ -244,7 +244,7 @@ const listingSpec = [
         row({artist, duration}, {link, strings}) {
             return language.$('listingPage.listArtists.byDuration.item', {
                 artist: link.artist(artist),
-                duration: strings.count.duration(duration)
+                duration: language.formatDuration(duration)
             });
         }
     },
@@ -302,7 +302,7 @@ const listingSpec = [
                             ${(toTracks
                                 .map(({ artist, date }) => language.$('listingPage.listArtists.byLatest.item', {
                                     artist: link.artist(artist),
-                                    date: strings.count.date(date)
+                                    date: language.formatDate(date)
                                 }))
                                 .map(row => `<li>${row}</li>`)
                                 .join('\n'))}
@@ -317,7 +317,7 @@ const listingSpec = [
                             ${(toArtAndFlashes
                                 .map(({ artist, date }) => language.$('listingPage.listArtists.byLatest.item', {
                                     artist: link.artist(artist),
-                                    date: strings.count.date(date)
+                                    date: language.formatDate(date)
                                 }))
                                 .map(row => `<li>${row}</li>`)
                                 .join('\n'))}
@@ -426,7 +426,7 @@ const listingSpec = [
         row({group, duration}, {link, strings}) {
             return language.$('listingPage.listGroups.byDuration.item', {
                 group: link.groupInfo(group),
-                duration: strings.count.duration(duration)
+                duration: language.formatDuration(duration)
             });
         }
     },
@@ -464,7 +464,7 @@ const listingSpec = [
         row({group, date}, {link, strings}) {
             return language.$('listingPage.listGroups.byLatest.item', {
                 group: link.groupInfo(group),
-                date: strings.count.date(date)
+                date: language.formatDate(date)
             });
         }
     },
@@ -527,7 +527,7 @@ const listingSpec = [
                     ${chunks.map(({album, date, chunk: tracks}) => fixWS`
                         <dt>${language.$('listingPage.listTracks.byDate.album', {
                             album: link.album(album),
-                            date: strings.count.date(date)
+                            date: language.formatDate(date)
                         })}</dt>
                         <dd><ul>
                             ${(tracks
@@ -560,7 +560,7 @@ const listingSpec = [
         row({track, duration}, {link, strings}) {
             return language.$('listingPage.listTracks.byDuration.item', {
                 track: link.track(track),
-                duration: strings.count.duration(duration)
+                duration: language.formatDuration(duration)
             });
         }
     },
@@ -587,7 +587,7 @@ const listingSpec = [
                             ${(tracks
                                 .map(track => language.$('listingPage.listTracks.byDurationInAlbum.track', {
                                     track: link.track(track),
-                                    duration: strings.count.duration(track.duration)
+                                    duration: language.formatDuration(track.duration)
                                 }))
                                 .map(row => `<li>${row}</li>`)
                                 .join('\n'))}
@@ -633,7 +633,7 @@ const listingSpec = [
                     ${chunks.map(({album, chunk: tracks}) => fixWS`
                         <dt>${language.$('listingPage.listTracks.inFlashes.byAlbum.album', {
                             album: link.album(album),
-                            date: strings.count.date(album.date)
+                            date: language.formatDate(album.date)
                         })}</dt>
                         <dd><ul>
                             ${(tracks
@@ -662,7 +662,7 @@ const listingSpec = [
                     ${sortByDate(flashData.slice()).map(flash => fixWS`
                         <dt>${language.$('listingPage.listTracks.inFlashes.byFlash.flash', {
                             flash: link.flash(flash),
-                            date: strings.count.date(flash.date)
+                            date: language.formatDate(flash.date)
                         })}</dt>
                         <dd><ul>
                             ${(flash.featuredTracks
@@ -693,7 +693,7 @@ const listingSpec = [
                     ${chunks.map(({album, chunk: tracks}) => fixWS`
                         <dt>${language.$('listingPage.listTracks.withLyrics.album', {
                             album: link.album(album),
-                            date: strings.count.date(album.date)
+                            date: language.formatDate(album.date)
                         })}</dt>
                         <dd><ul>
                             ${(tracks
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 4d9939a1..3c0b2b73 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -96,7 +96,7 @@ export function generateChronologyLinks(currentThing, {
         }
 
         const stringOpts = {
-            index: strings.count.index(index + 1, {strings}),
+            index: language.formatIndex(index + 1, {strings}),
             artist: link.artist(artist)
         };
 
@@ -307,7 +307,7 @@ export function getAlbumGridHTML({
         linkFn: link.album,
         detailsFn: details && (album => language.$('misc.albumGrid.details', {
             tracks: language.countTracks(album.tracks.length, {unit: true}),
-            time: strings.count.duration(getTotalDuration(album.tracks))
+            time: language.formatDuration(getTotalDuration(album.tracks))
         })),
         noSrcTextFn: album => language.$('misc.albumGrid.noCoverArt', {
             album: album.name
diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js
index 3c2b23cc..5b82ca23 100644
--- a/src/page/album-commentary.js
+++ b/src/page/album-commentary.js
@@ -47,7 +47,7 @@ export function write(album, {wikiData}) {
                             album: link.album(album)
                         })}</h1>
                         <p>${language.$('albumCommentaryPage.infoLine', {
-                            words: `<b>${strings.count.words(words, {unit: true})}</b>`,
+                            words: `<b>${language.formatWordCount(words, {unit: true})}</b>`,
                             entries: `<b>${language.countCommentaryEntries(entries.length, {unit: true})}</b>`
                         })}</p>
                         ${album.commentary && fixWS`
@@ -116,7 +116,7 @@ export function writeTargetless({wikiData}) {
                     <div class="long-content">
                         <h1>${language.$('commentaryIndex.title')}</h1>
                         <p>${language.$('commentaryIndex.infoLine', {
-                            words: `<b>${strings.count.words(totalWords, {unit: true})}</b>`,
+                            words: `<b>${language.formatWordCount(totalWords, {unit: true})}</b>`,
                             entries: `<b>${language.countCommentaryEntries(totalEntries, {unit: true})}</b>`
                         })}</p>
                         <p>${language.$('commentaryIndex.albumList.title')}</p>
@@ -125,7 +125,7 @@ export function writeTargetless({wikiData}) {
                                 .map(({ album, entries, words }) => fixWS`
                                     <li>${language.$('commentaryIndex.albumList.item', {
                                         album: link.albumCommentary(album),
-                                        words: strings.count.words(words, {unit: true}),
+                                        words: language.formatWordCount(words, {unit: true}),
                                         entries: language.countCommentaryEntries(entries.length, {unit: true})
                                     })}</li>
                                 `)
diff --git a/src/page/album.js b/src/page/album.js
index 4b4ac6bd..448ef72e 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -33,7 +33,7 @@ export function write(album, {wikiData}) {
         strings
     }) => {
         const itemOpts = {
-            duration: strings.count.duration(track.duration),
+            duration: language.formatDuration(track.duration),
             track: link.track(track)
         };
         return `<li style="${getLinkThemeString(track.color)}">${
@@ -169,15 +169,15 @@ export function write(album, {wikiData}) {
                                     })
                                 }),
                                 album.date && language.$('releaseInfo.released', {
-                                    date: strings.count.date(album.date)
+                                    date: language.formatDate(album.date)
                                 }),
                                 (album.coverArtDate &&
                                     +album.coverArtDate !== +album.date &&
                                     language.$('releaseInfo.artReleased', {
-                                        date: strings.count.date(album.coverArtDate)
+                                        date: language.formatDate(album.coverArtDate)
                                     })),
                                 language.$('releaseInfo.duration', {
-                                    duration: strings.count.duration(albumDuration, {approximate: album.tracks.length > 1})
+                                    duration: language.formatDuration(albumDuration, {approximate: album.tracks.length > 1})
                                 })
                             ].filter(Boolean).join('<br>\n')}
                         </p>
@@ -198,7 +198,7 @@ export function write(album, {wikiData}) {
                                 ${album.trackGroups.map(({ name, color, startIndex, tracks }) => fixWS`
                                     <dt>${
                                         language.$('trackList.group', {
-                                            duration: strings.count.duration(getTotalDuration(tracks), {approximate: tracks.length > 1}),
+                                            duration: language.formatDuration(getTotalDuration(tracks), {approximate: tracks.length > 1}),
                                             group: name
                                         })
                                     }</dt>
@@ -216,7 +216,7 @@ export function write(album, {wikiData}) {
                             <p>
                                 ${[
                                     language.$('releaseInfo.addedToWiki', {
-                                        date: strings.count.date(album.dateAddedToWiki)
+                                        date: language.formatDate(album.dateAddedToWiki)
                                     })
                                 ].filter(Boolean).join('<br>\n')}
                             </p>
diff --git a/src/page/artist.js b/src/page/artist.js
index 3a9de70b..7d28feec 100644
--- a/src/page/artist.js
+++ b/src/page/artist.js
@@ -170,14 +170,14 @@ export function write(artist, {wikiData}) {
                 <dt>${
                     (date && duration) ? language.$('artistPage.creditList.album.withDate.withDuration', {
                         album: link.album(album),
-                        date: strings.count.date(date),
-                        duration: strings.count.duration(duration, {approximate: true})
+                        date: language.formatDate(date),
+                        duration: language.formatDuration(duration, {approximate: true})
                     }) : date ? language.$('artistPage.creditList.album.withDate', {
                         album: link.album(album),
-                        date: strings.count.date(date)
+                        date: language.formatDate(date)
                     }) : duration ? language.$('artistPage.creditList.album.withDuration', {
                         album: link.album(album),
-                        duration: strings.count.duration(duration, {approximate: true})
+                        duration: language.formatDuration(duration, {approximate: true})
                     }) : language.$('artistPage.creditList.album', {
                         album: link.album(album)
                     })}</dt>
@@ -187,7 +187,7 @@ export function write(artist, {wikiData}) {
                             aka: track.aka,
                             entry: language.$('artistPage.creditList.entry.track.withDuration', {
                                 track: link.track(track),
-                                duration: strings.count.duration(track.duration)
+                                duration: language.formatDuration(track.duration)
                             }),
                             ...props
                         }))
@@ -319,7 +319,7 @@ export function write(artist, {wikiData}) {
                             <h2 id="tracks">${language.$('artistPage.trackList.title')}</h2>
                             <p>${language.$('artistPage.contributedDurationLine', {
                                 artist: artist.name,
-                                duration: strings.count.duration(totalDuration, {approximate: true, unit: true})
+                                duration: language.formatDuration(totalDuration, {approximate: true, unit: true})
                             })}</p>
                             <p>${language.$('artistPage.musicGroupsLine', {
                                 groups: strings.list.unit(musicGroups
@@ -348,7 +348,7 @@ export function write(artist, {wikiData}) {
                                 ${artListChunks.map(({date, album, chunk}) => fixWS`
                                     <dt>${language.$('artistPage.creditList.album.withDate', {
                                         album: link.album(album),
-                                        date: strings.count.date(date)
+                                        date: language.formatDate(date)
                                     })}</dt>
                                     <dd><ul>
                                         ${(chunk
@@ -377,7 +377,7 @@ export function write(artist, {wikiData}) {
                                 ${flashListChunks.map(({act, chunk, dateFirst, dateLast}) => fixWS`
                                     <dt>${language.$('artistPage.creditList.flashAct.withDateRange', {
                                         act: link.flash(chunk[0].flash, {text: act.name}),
-                                        dateRange: strings.count.dateRange([dateFirst, dateLast])
+                                        dateRange: language.formatDateRange(dateFirst, dateLast)
                                     })}</dt>
                                     <dd><ul>
                                         ${(chunk
diff --git a/src/page/flash.js b/src/page/flash.js
index 5e027f70..fe72a8bd 100644
--- a/src/page/flash.js
+++ b/src/page/flash.js
@@ -48,7 +48,7 @@ export function write(flash, {wikiData}) {
                         src: getFlashCover(flash),
                         alt: language.$('misc.alt.flashArt')
                     })}
-                    <p>${language.$('releaseInfo.released', {date: strings.count.date(flash.date)})}</p>
+                    <p>${language.$('releaseInfo.released', {date: language.formatDate(flash.date)})}</p>
                     ${(flash.page || flash.urls?.length) && `<p>${language.$('releaseInfo.playOn', {
                         links: strings.list.or([
                             flash.page && getFlashLink(flash),
diff --git a/src/page/group.js b/src/page/group.js
index 53c792a4..0467cada 100644
--- a/src/page/group.js
+++ b/src/page/group.js
@@ -129,7 +129,7 @@ export function write(group, {wikiData}) {
                         language.$('groupGalleryPage.infoLine', {
                             tracks: `<b>${language.countTracks(tracks.length, {unit: true})}</b>`,
                             albums: `<b>${language.countAlbums(albums.length, {unit: true})}</b>`,
-                            time: `<b>${strings.count.duration(totalDuration, {unit: true})}</b>`
+                            time: `<b>${language.formatDuration(totalDuration, {unit: true})}</b>`
                         })
                     }</p>
                     ${wikiInfo.enableGroupUI && wikiInfo.enableListings && html.tag('p',
diff --git a/src/page/homepage.js b/src/page/homepage.js
index ed7d3442..01844fb4 100644
--- a/src/page/homepage.js
+++ b/src/page/homepage.js
@@ -88,7 +88,7 @@ export function writeTargetless({wikiData}) {
                         ${newsData.slice(0, 3).map((entry, i) => html.tag('article',
                             {class: ['news-entry', i === 0 && 'first-news-entry']},
                             fixWS`
-                                <h2><time>${strings.count.date(entry.date)}</time> ${link.newsEntry(entry)}</h2>
+                                <h2><time>${language.formatDate(entry.date)}</time> ${link.newsEntry(entry)}</h2>
                                 ${transformMultiline(entry.contentShort)}
                                 ${entry.contentShort !== entry.content && link.newsEntry(entry, {
                                     text: language.$('homepage.news.entry.viewRest')
diff --git a/src/page/listing.js b/src/page/listing.js
index efa3fdfd..a6f9e9e1 100644
--- a/src/page/listing.js
+++ b/src/page/listing.js
@@ -114,7 +114,7 @@ export function writeTargetless({wikiData}) {
                         wiki: wikiInfo.name,
                         tracks: `<b>${language.countTracks(trackData.length, {unit: true})}</b>`,
                         albums: `<b>${language.countAlbums(albumData.length, {unit: true})}</b>`,
-                        duration: `<b>${strings.count.duration(totalDuration, {approximate: true, unit: true})}</b>`
+                        duration: `<b>${language.formatDuration(totalDuration, {approximate: true, unit: true})}</b>`
                     })}</p>
                     <hr>
                     <p>${language.$('listingIndex.exploreList')}</p>
diff --git a/src/page/news.js b/src/page/news.js
index 9951a2a8..47239583 100644
--- a/src/page/news.js
+++ b/src/page/news.js
@@ -30,7 +30,7 @@ export function write(entry, {wikiData}) {
                 content: fixWS`
                     <div class="long-content">
                         <h1>${language.$('newsEntryPage.title', {entry: entry.name})}</h1>
-                        <p>${language.$('newsEntryPage.published', {date: strings.count.date(entry.date)})}</p>
+                        <p>${language.$('newsEntryPage.published', {date: language.formatDate(entry.date)})}</p>
                         ${transformMultiline(entry.content)}
                     </div>
                 `
@@ -67,7 +67,7 @@ export function writeTargetless({wikiData}) {
                         <h1>${language.$('newsIndex.title')}</h1>
                         ${newsData.map(entry => fixWS`
                             <article id="${entry.directory}">
-                                <h2><time>${strings.count.date(entry.date)}</time> ${link.newsEntry(entry)}</h2>
+                                <h2><time>${language.formatDate(entry.date)}</time> ${link.newsEntry(entry)}</h2>
                                 ${transformMultiline(entry.contentShort)}
                                 ${entry.contentShort !== entry.content && `<p>${link.newsEntry(entry, {
                                     text: language.$('newsIndex.entry.viewRest')
@@ -112,7 +112,7 @@ function generateNewsEntryNav(entry, {
             },
             {
                 html: language.$('newsEntryPage.nav.entry', {
-                    date: strings.count.date(entry.date),
+                    date: language.formatDate(entry.date),
                     entry: link.newsEntry(entry, {class: 'current'})
                 })
             },
diff --git a/src/page/track.js b/src/page/track.js
index 92a49ff0..295f4257 100644
--- a/src/page/track.js
+++ b/src/page/track.js
@@ -181,15 +181,15 @@ export function write(track, {wikiData}) {
                                     })
                                 }),
                                 track.date && language.$('releaseInfo.released', {
-                                    date: strings.count.date(track.date)
+                                    date: language.formatDate(track.date)
                                 }),
                                 (track.coverArtDate &&
                                     +track.coverArtDate !== +track.date &&
                                     language.$('releaseInfo.artReleased', {
-                                        date: strings.count.date(track.coverArtDate)
+                                        date: language.formatDate(track.coverArtDate)
                                     })),
                                 track.duration && language.$('releaseInfo.duration', {
-                                    duration: strings.count.duration(track.duration)
+                                    duration: language.formatDuration(track.duration)
                                 })
                             ].filter(Boolean).join('<br>\n')}
                         </p>
diff --git a/src/upd8.js b/src/upd8.js
index d0df62fc..01330355 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -246,7 +246,7 @@ const replacerSpec = {
     'date': {
         find: null,
         value: ref => new Date(ref),
-        html: (date, {strings}) => `<time datetime="${date.toString()}">${strings.count.date(date)}</time>`
+        html: (date, {strings}) => `<time datetime="${date.toString()}">${language.formatDate(date)}</time>`
     },
     'flash': {
         find: 'flash',