diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-05-10 20:39:43 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-05-10 20:39:43 -0300 |
commit | 7056fa7c07ae08f5596c9ef8d8582642890bd764 (patch) | |
tree | c21b9e5950185378b90db07bde0143839533990c /src | |
parent | 2fa9baf09753243cc223859c06abad8abfc9bf2a (diff) |
rename strings arg to language
Diffstat (limited to 'src')
-rw-r--r-- | src/listing-spec.js | 68 | ||||
-rw-r--r-- | src/misc-templates.js | 40 | ||||
-rw-r--r-- | src/page/album-commentary.js | 4 | ||||
-rw-r--r-- | src/page/album.js | 14 | ||||
-rw-r--r-- | src/page/artist.js | 26 | ||||
-rw-r--r-- | src/page/flash.js | 12 | ||||
-rw-r--r-- | src/page/group.js | 18 | ||||
-rw-r--r-- | src/page/homepage.js | 2 | ||||
-rw-r--r-- | src/page/listing.js | 20 | ||||
-rw-r--r-- | src/page/news.js | 10 | ||||
-rw-r--r-- | src/page/static.js | 2 | ||||
-rw-r--r-- | src/page/tag.js | 6 | ||||
-rw-r--r-- | src/page/track.js | 16 | ||||
-rw-r--r-- | src/util/replacer.js | 10 |
14 files changed, 124 insertions, 124 deletions
diff --git a/src/listing-spec.js b/src/listing-spec.js index 6df89978..e1561d8e 100644 --- a/src/listing-spec.js +++ b/src/listing-spec.js @@ -18,7 +18,7 @@ const listingSpec = [ .sort(sortByName); }, - row(album, {link, strings}) { + row(album, {link, language}) { return language.$('listingPage.listAlbums.byName.item', { album: link.album(album), tracks: language.countTracks(album.tracks.length, {unit: true}) @@ -35,7 +35,7 @@ const listingSpec = [ .sort((a, b) => b.tracks.length - a.tracks.length); }, - row(album, {link, strings}) { + row(album, {link, language}) { return language.$('listingPage.listAlbums.byTracks.item', { album: link.album(album), tracks: language.countTracks(album.tracks.length, {unit: true}) @@ -53,7 +53,7 @@ const listingSpec = [ .sort((a, b) => b.duration - a.duration); }, - row({album, duration}, {link, strings}) { + row({album, duration}, {link, language}) { return language.$('listingPage.listAlbums.byDuration.item', { album: link.album(album), duration: language.formatDuration(duration) @@ -69,7 +69,7 @@ const listingSpec = [ return sortByDate(wikiData.albumData.filter(album => album.date)); }, - row(album, {link, strings}) { + row(album, {link, language}) { return language.$('listingPage.listAlbums.byDate.item', { album: link.album(album), date: language.formatDate(album.date) @@ -88,7 +88,7 @@ const listingSpec = [ }), ['dateAddedToWiki']); }, - html(chunks, {link, strings}) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks.map(({dateAddedToWiki, chunk: albums}) => fixWS` @@ -119,7 +119,7 @@ const listingSpec = [ .map(artist => ({artist, contributions: getArtistNumContributions(artist)})); }, - row({artist, contributions}, {link, strings}) { + row({artist, contributions}, {link, language}) { return language.$('listingPage.listArtists.byName.item', { artist: link.artist(artist), contributions: language.countContributions(contributions, {unit: true}) @@ -167,7 +167,7 @@ const listingSpec = [ }; }, - html({toTracks, toArtAndFlashes, showAsFlashes}, {link, strings}) { + html({toTracks, toArtAndFlashes, showAsFlashes}, {link, language}) { return fixWS` <div class="content-columns"> <div class="column"> @@ -216,7 +216,7 @@ const listingSpec = [ .sort((a, b) => b.entries - a.entries); }, - row({artist, entries}, {link, strings}) { + row({artist, entries}, {link, language}) { return language.$('listingPage.listArtists.byCommentary.item', { artist: link.artist(artist), entries: language.countCommentaryEntries(entries, {unit: true}) @@ -241,7 +241,7 @@ const listingSpec = [ .sort((a, b) => b.duration - a.duration); }, - row({artist, duration}, {link, strings}) { + row({artist, duration}, {link, language}) { return language.$('listingPage.listArtists.byDuration.item', { artist: link.artist(artist), duration: language.formatDuration(duration) @@ -293,7 +293,7 @@ const listingSpec = [ }; }, - html({toTracks, toArtAndFlashes, showAsFlashes}, {link, strings}) { + html({toTracks, toArtAndFlashes, showAsFlashes}, {link, language}) { return fixWS` <div class="content-columns"> <div class="column"> @@ -334,7 +334,7 @@ const listingSpec = [ condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, data: ({wikiData}) => wikiData.groupData.slice().sort(sortByName), - row(group, {link, strings}) { + row(group, {link, language}) { return language.$('listingPage.listGroups.byCategory.group', { group: link.groupInfo(group), gallery: link.groupGallery(group, { @@ -350,7 +350,7 @@ const listingSpec = [ condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, data: ({wikiData}) => wikiData.groupCategoryData, - html(groupCategoryData, {link, strings}) { + html(groupCategoryData, {link, language}) { return fixWS` <dl> ${groupCategoryData.map(category => fixWS` @@ -385,7 +385,7 @@ const listingSpec = [ .sort((a, b) => b.albums - a.albums); }, - row({group, albums}, {link, strings}) { + row({group, albums}, {link, language}) { return language.$('listingPage.listGroups.byAlbums.item', { group: link.groupInfo(group), albums: language.countAlbums(albums, {unit: true}) @@ -404,7 +404,7 @@ const listingSpec = [ .sort((a, b) => b.tracks - a.tracks); }, - row({group, tracks}, {link, strings}) { + row({group, tracks}, {link, language}) { return language.$('listingPage.listGroups.byTracks.item', { group: link.groupInfo(group), tracks: language.countTracks(tracks, {unit: true}) @@ -423,7 +423,7 @@ const listingSpec = [ .sort((a, b) => b.duration - a.duration); }, - row({group, duration}, {link, strings}) { + row({group, duration}, {link, language}) { return language.$('listingPage.listGroups.byDuration.item', { group: link.groupInfo(group), duration: language.formatDuration(duration) @@ -461,7 +461,7 @@ const listingSpec = [ .reverse()).reverse() }, - row({group, date}, {link, strings}) { + row({group, date}, {link, language}) { return language.$('listingPage.listGroups.byLatest.item', { group: link.groupInfo(group), date: language.formatDate(date) @@ -477,7 +477,7 @@ const listingSpec = [ return wikiData.trackData.slice().sort(sortByName); }, - row(track, {link, strings}) { + row(track, {link, language}) { return language.$('listingPage.listTracks.byName.item', { track: link.track(track) }); @@ -489,7 +489,7 @@ const listingSpec = [ stringsKey: 'listTracks.byAlbum', data: ({wikiData}) => wikiData.albumData, - html(albumData, {link, strings}) { + html(albumData, {link, language}) { return fixWS` <dl> ${albumData.map(album => fixWS` @@ -521,7 +521,7 @@ const listingSpec = [ ); }, - html(chunks, {link, strings}) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks.map(({album, date, chunk: tracks}) => fixWS` @@ -557,7 +557,7 @@ const listingSpec = [ .sort((a, b) => b.duration - a.duration); }, - row({track, duration}, {link, strings}) { + row({track, duration}, {link, language}) { return language.$('listingPage.listTracks.byDuration.item', { track: link.track(track), duration: language.formatDuration(duration) @@ -576,7 +576,7 @@ const listingSpec = [ })); }, - html(albums, {link, strings}) { + html(albums, {link, language}) { return fixWS` <dl> ${albums.map(({album, tracks}) => fixWS` @@ -609,7 +609,7 @@ const listingSpec = [ .sort((a, b) => b.timesReferenced - a.timesReferenced); }, - row({track, timesReferenced}, {link, strings}) { + row({track, timesReferenced}, {link, language}) { return language.$('listingPage.listTracks.byTimesReferenced.item', { track: link.track(track), timesReferenced: language.countTimesReferenced(timesReferenced, {unit: true}) @@ -627,7 +627,7 @@ const listingSpec = [ .filter(t => t.featuredInFlashes?.length > 0), ['album']); }, - html(chunks, {link, strings}) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks.map(({album, chunk: tracks}) => fixWS` @@ -656,7 +656,7 @@ const listingSpec = [ condition: ({wikiData}) => wikiData.wikiInfo.enableFlashesAndGames, data: ({wikiData}) => wikiData.flashData, - html(flashData, {link, strings}) { + html(flashData, {link, language}) { return fixWS` <dl> ${sortByDate(flashData.slice()).map(flash => fixWS` @@ -687,7 +687,7 @@ const listingSpec = [ return chunkByProperties(wikiData.trackData.filter(t => t.lyrics), ['album']); }, - html(chunks, {link, strings}) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks.map(({album, chunk: tracks}) => fixWS` @@ -721,7 +721,7 @@ const listingSpec = [ .map(tag => ({tag, timesUsed: tag.taggedInThings?.length})); }, - row({tag, timesUsed}, {link, strings}) { + row({tag, timesUsed}, {link, language}) { return language.$('listingPage.listTags.byName.item', { tag: link.tag(tag), timesUsed: language.countTimesUsed(timesUsed, {unit: true}) @@ -741,7 +741,7 @@ const listingSpec = [ .sort((a, b) => b.timesUsed - a.timesUsed); }, - row({tag, timesUsed}, {link, strings}) { + row({tag, timesUsed}, {link, language}) { return language.$('listingPage.listTags.byUses.item', { tag: link.tag(tag), timesUsed: language.countTimesUsed(timesUsed, {unit: true}) @@ -760,7 +760,7 @@ const listingSpec = [ html: ({officialAlbumData, fandomAlbumData}, { getLinkThemeString, - strings + language }) => fixWS` <p>Choose a link to go to a random page in that category or album! If your browser doesn't support relatively modern JavaScript or you've disabled it, these links won't work - sorry.</p> <p class="js-hide-once-data">(Data files are downloading in the background! Please wait for data to load.)</p> @@ -794,27 +794,27 @@ const filterListings = directoryPrefix => listingSpec const listingTargetSpec = [ { - title: ({strings}) => language.$('listingPage.target.album'), + title: ({language}) => language.$('listingPage.target.album'), listings: filterListings('album') }, { - title: ({strings}) => language.$('listingPage.target.artist'), + title: ({language}) => language.$('listingPage.target.artist'), listings: filterListings('artist') }, { - title: ({strings}) => language.$('listingPage.target.group'), + title: ({language}) => language.$('listingPage.target.group'), listings: filterListings('group') }, { - title: ({strings}) => language.$('listingPage.target.track'), + title: ({language}) => language.$('listingPage.target.track'), listings: filterListings('track') }, { - title: ({strings}) => language.$('listingPage.target.tag'), + title: ({language}) => language.$('listingPage.target.tag'), listings: filterListings('tag') }, { - title: ({strings}) => language.$('listingPage.target.other'), + title: ({language}) => language.$('listingPage.target.other'), listings: [ listingSpec.find(l => l.directory === 'random') ] diff --git a/src/misc-templates.js b/src/misc-templates.js index 93d9eabb..2e25a738 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -1,5 +1,5 @@ // Miscellaneous utility functions which are useful across page specifications. -// These are made available right on a page spec's ({wikiData, strings, ...}) +// These are made available right on a page spec's ({wikiData, language, ...}) // args object! import fixWS from 'fix-whitespace'; @@ -31,7 +31,7 @@ const MASTODON_DOMAINS = [ // Artist strings export function getArtistString(artists, { - iconifyURL, link, strings, + iconifyURL, link, language, showIcons = false, showContrib = false }) { @@ -41,7 +41,7 @@ export function getArtistString(artists, { link.artist(who), showContrib && what && `(${what})`, showIcons && urls?.length && `<span class="icons">(${ - language.formatUnitList(urls.map(url => iconifyURL(url, {strings}))) + language.formatUnitList(urls.map(url => iconifyURL(url, {language}))) })</span>` ].filter(Boolean).join(' '); })); @@ -56,7 +56,7 @@ export function generateChronologyLinks(currentThing, { headingString, link, linkAnythingMan, - strings, + language, wikiData }) { const { albumData } = wikiData; @@ -96,7 +96,7 @@ export function generateChronologyLinks(currentThing, { } const stringOpts = { - index: language.formatIndex(index + 1, {strings}), + index: language.formatIndex(index + 1, {language}), artist: link.artist(artist) }; @@ -111,19 +111,19 @@ export function generateChronologyLinks(currentThing, { // Content warning tags -export function getRevealStringFromWarnings(warnings, {strings}) { +export function getRevealStringFromWarnings(warnings, {language}) { return language.$('misc.contentWarnings', {warnings}) + `<br><span class="reveal-interaction">${language.$('misc.contentWarnings.reveal')}</span>` } -export function getRevealStringFromTags(tags, {strings}) { +export function getRevealStringFromTags(tags, {language}) { return tags && tags.some(tag => tag.isContentWarning) && ( - getRevealStringFromWarnings(language.formatUnitList(tags.filter(tag => tag.isContentWarning).map(tag => tag.name)), {strings})); + getRevealStringFromWarnings(language.formatUnitList(tags.filter(tag => tag.isContentWarning).map(tag => tag.name)), {language})); } // Cover art links export function generateCoverLink({ - img, link, strings, to, wikiData, + img, link, language, to, wikiData, src, path, alt, @@ -148,7 +148,7 @@ export function generateCoverLink({ id: 'cover-art', link: true, square: true, - reveal: getRevealStringFromTags(tags, {strings}) + reveal: getRevealStringFromTags(tags, {language}) })} ${wikiInfo.enableArtTagUI && tags.filter(tag => !tag.isContentWarning).length && fixWS` <p class="tags"> @@ -203,7 +203,7 @@ export function getAlbumStylesheet(album, {to}) { // Fancy lookin' links -export function fancifyURL(url, {strings, album = false} = {}) { +export function fancifyURL(url, {language, album = false} = {}) { let local = Symbol(); let domain; try { @@ -235,8 +235,8 @@ export function fancifyURL(url, {strings, album = false} = {}) { }</a>`; } -export function fancifyFlashURL(url, flash, {strings}) { - const link = fancifyURL(url, {strings}); +export function fancifyFlashURL(url, flash, {language}) { + const link = fancifyURL(url, {language}); return `<span class="nowrap">${ url.includes('homestuck.com') ? (isNaN(Number(flash.page)) ? language.$('misc.external.flash.homestuck.secret', {link}) @@ -247,7 +247,7 @@ export function fancifyFlashURL(url, flash, {strings}) { }</span>`; } -export function iconifyURL(url, {strings, to}) { +export function iconifyURL(url, {language, to}) { const domain = new URL(url).hostname; const [ id, msg ] = ( domain.includes('bandcamp.com') ? ['bandcamp', language.$('misc.external.bandcamp')] : @@ -268,7 +268,7 @@ export function iconifyURL(url, {strings, to}) { export function getGridHTML({ img, - strings, + language, entries, srcFn, @@ -288,7 +288,7 @@ export function getGridHTML({ thumb: 'small', lazy: (typeof lazy === 'number' ? i >= lazy : lazy), square: true, - reveal: getRevealStringFromTags(item.artTags, {strings}), + reveal: getRevealStringFromTags(item.artTags, {language}), noSrcText: noSrcTextFn(item) })} <span>${item.name}</span> @@ -298,7 +298,7 @@ export function getGridHTML({ } export function getAlbumGridHTML({ - getAlbumCover, getGridHTML, link, strings, + getAlbumCover, getGridHTML, link, language, details = false, ...props }) { @@ -330,7 +330,7 @@ export function getFlashGridHTML({ // Nav-bar links export function generateInfoGalleryLinks(currentThing, isGallery, { - link, strings, + link, language, linkKeyGallery, linkKeyInfo }) { @@ -350,7 +350,7 @@ export function generatePreviousNextLinks(current, { data, link, linkKey, - strings + language }) { const linkFn = link[linkKey]; @@ -383,7 +383,7 @@ export function generatePreviousNextLinks(current, { export function getFooterLocalizationLinks(pathname, { languages, paths, - strings, + language, to }) { const { toPath } = paths; diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js index 5b82ca23..e587b16e 100644 --- a/src/page/album-commentary.js +++ b/src/page/album-commentary.js @@ -32,7 +32,7 @@ export function write(album, {wikiData}) { getLinkThemeString, getThemeString, link, - strings, + language, to, transformMultiline }) => ({ @@ -107,7 +107,7 @@ export function writeTargetless({wikiData}) { path: ['commentaryIndex'], page: ({ link, - strings + language }) => ({ title: language.$('commentaryIndex.title'), diff --git a/src/page/album.js b/src/page/album.js index d24ebafd..45e5439a 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -30,7 +30,7 @@ export function write(album, {wikiData}) { getArtistString, getLinkThemeString, link, - strings + language }) => { const itemOpts = { duration: language.formatDuration(track.duration), @@ -108,14 +108,14 @@ export function write(album, {wikiData}) { getLinkThemeString, getThemeString, link, - strings, + language, transformMultiline }) => { const trackToListItem = bindOpts(unbound_trackToListItem, { getArtistString, getLinkThemeString, link, - strings + language }); const cover = getAlbumCover(album); @@ -234,7 +234,7 @@ export function write(album, {wikiData}) { fancifyURL, getLinkThemeString, link, - strings, + language, transformMultiline, wikiData }), @@ -250,7 +250,7 @@ export function write(album, {wikiData}) { album.tracks.length > 1 && { divider: false, - html: generateAlbumNavLinks(album, null, {strings}) + html: generateAlbumNavLinks(album, null, {language}) } ], content: html.tag('div', generateAlbumChronologyLinks(album, null, {generateChronologyLinks})) @@ -268,7 +268,7 @@ export function generateAlbumSidebar(album, currentTrack, { fancifyURL, getLinkThemeString, link, - strings, + language, transformMultiline, wikiData }) { @@ -385,7 +385,7 @@ export function generateAlbumSidebar(album, currentTrack, { export function generateAlbumNavLinks(album, currentTrack, { generatePreviousNextLinks, - strings + language }) { if (album.tracks.length <= 1) { return ''; diff --git a/src/page/artist.js b/src/page/artist.js index 68eaf53b..0bfcf1c4 100644 --- a/src/page/artist.js +++ b/src/page/artist.js @@ -139,7 +139,7 @@ export function write(artist, {wikiData}) { } const generateEntryAccents = ({ - getArtistString, strings, + getArtistString, language, aka, entry, artists, contrib }) => (aka @@ -163,7 +163,7 @@ export function write(artist, {wikiData}) { : entry))); const unbound_generateTrackList = (chunks, { - getArtistString, link, strings + getArtistString, link, language }) => fixWS` <dl> ${chunks.map(({date, album, chunk, duration}) => fixWS` @@ -193,7 +193,7 @@ export function write(artist, {wikiData}) { })) .map(({aka, ...opts}) => html.tag('li', {class: aka && 'rerelease'}, - generateEntryAccents({getArtistString, strings, aka, ...opts}))) + generateEntryAccents({getArtistString, language, aka, ...opts}))) .join('\n'))} </ul></dd> `).join('\n')} @@ -272,14 +272,14 @@ export function write(artist, {wikiData}) { getArtistAvatar, getArtistString, link, - strings, + language, to, transformMultiline }) => { const generateTrackList = bindOpts(unbound_generateTrackList, { getArtistString, link, - strings + language }); return { @@ -300,7 +300,7 @@ export function write(artist, {wikiData}) { <hr> `} ${urls?.length && `<p>${language.$('releaseInfo.visitOn', { - links: language.formatDisjunctionList(urls.map(url => fancifyURL(url, {strings}))) + links: language.formatDisjunctionList(urls.map(url => fancifyURL(url, {language}))) })}</p>`} ${hasGallery && `<p>${language.$('artistPage.viewArtGallery', { link: link.artistGallery(artist, { @@ -364,7 +364,7 @@ export function write(artist, {wikiData}) { }[key])}</i>`), ...props })) - .map(opts => generateEntryAccents({getArtistString, strings, ...opts})) + .map(opts => generateEntryAccents({getArtistString, language, ...opts})) .map(row => `<li>${row}</li>`) .join('\n'))} </ul></dd> @@ -387,7 +387,7 @@ export function write(artist, {wikiData}) { }), ...props })) - .map(opts => generateEntryAccents({getArtistString, strings, ...opts})) + .map(opts => generateEntryAccents({getArtistString, language, ...opts})) .map(row => `<li>${row}</li>`) .join('\n'))} </ul></dd> @@ -420,7 +420,7 @@ export function write(artist, {wikiData}) { nav: generateNavForArtist(artist, false, hasGallery, { generateInfoGalleryLinks, link, - strings, + language, wikiData }) }; @@ -436,7 +436,7 @@ export function write(artist, {wikiData}) { getGridHTML, getTrackCover, link, - strings, + language, to }) => ({ title: language.$('artistGalleryPage.title', {artist: name}), @@ -465,7 +465,7 @@ export function write(artist, {wikiData}) { nav: generateNavForArtist(artist, true, hasGallery, { generateInfoGalleryLinks, link, - strings, + language, wikiData }) }) @@ -479,14 +479,14 @@ export function write(artist, {wikiData}) { function generateNavForArtist(artist, isGallery, hasGallery, { generateInfoGalleryLinks, link, - strings, + language, wikiData }) { const { wikiInfo } = wikiData; const infoGalleryLinks = (hasGallery && generateInfoGalleryLinks(artist, isGallery, { - link, strings, + link, language, linkKeyGallery: 'artistGallery', linkKeyInfo: 'artist' })) diff --git a/src/page/flash.js b/src/page/flash.js index 97824e07..58969b15 100644 --- a/src/page/flash.js +++ b/src/page/flash.js @@ -33,7 +33,7 @@ export function write(flash, {wikiData}) { getFlashCover, getThemeString, link, - strings, + language, transformInline }) => ({ title: language.$('flashPage.title', {flash: flash.name}), @@ -85,12 +85,12 @@ export function write(flash, {wikiData}) { ` }, - sidebarLeft: generateSidebarForFlash(flash, {link, strings, wikiData}), + sidebarLeft: generateSidebarForFlash(flash, {link, language, wikiData}), nav: generateNavForFlash(flash, { generateChronologyLinks, generatePreviousNextLinks, link, - strings, + language, wikiData }) }) @@ -109,7 +109,7 @@ export function writeTargetless({wikiData}) { getFlashGridHTML, getLinkThemeString, link, - strings + language }) => ({ title: language.$('flashIndex.title'), @@ -150,7 +150,7 @@ function generateNavForFlash(flash, { generateChronologyLinks, generatePreviousNextLinks, link, - strings, + language, wikiData }) { const { flashData, wikiInfo } = wikiData; @@ -191,7 +191,7 @@ function generateNavForFlash(flash, { }; } -function generateSidebarForFlash(flash, {link, strings, wikiData}) { +function generateSidebarForFlash(flash, {link, language, wikiData}) { // all hard-coded, sorry :( // this doesnt have a super portable implementation/design...yet!! diff --git a/src/page/group.js b/src/page/group.js index 1aea3fb1..eb401dd0 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -39,7 +39,7 @@ export function write(group, {wikiData}) { getThemeString, fancifyURL, link, - strings, + language, transformMultiline }) => ({ title: language.$('groupInfoPage.title', {group: group.name}), @@ -50,7 +50,7 @@ export function write(group, {wikiData}) { <h1>${language.$('groupInfoPage.title', {group: group.name})}</h1> ${group.urls?.length && `<p>${ language.$('releaseInfo.visitOn', { - links: language.formatDisjunctionList(group.urls.map(url => fancifyURL(url, {strings}))) + links: language.formatDisjunctionList(group.urls.map(url => fancifyURL(url, {language}))) }) }</p>`} <blockquote> @@ -92,7 +92,7 @@ export function write(group, {wikiData}) { sidebarLeft: generateGroupSidebar(group, false, { getLinkThemeString, link, - strings, + language, wikiData }), @@ -100,7 +100,7 @@ export function write(group, {wikiData}) { generateInfoGalleryLinks, generatePreviousNextLinks, link, - strings, + language, wikiData }) }) @@ -116,7 +116,7 @@ export function write(group, {wikiData}) { getLinkThemeString, getThemeString, link, - strings + language }) => ({ title: language.$('groupGalleryPage.title', {group: group.name}), theme: getThemeString(group.color), @@ -152,7 +152,7 @@ export function write(group, {wikiData}) { sidebarLeft: generateGroupSidebar(group, true, { getLinkThemeString, link, - strings, + language, wikiData }), @@ -160,7 +160,7 @@ export function write(group, {wikiData}) { generateInfoGalleryLinks, generatePreviousNextLinks, link, - strings, + language, wikiData }) }) @@ -174,7 +174,7 @@ export function write(group, {wikiData}) { function generateGroupSidebar(currentGroup, isGallery, { getLinkThemeString, link, - strings, + language, wikiData }) { const { groupCategoryData, wikiInfo } = wikiData; @@ -217,7 +217,7 @@ function generateGroupNav(currentGroup, isGallery, { generateInfoGalleryLinks, generatePreviousNextLinks, link, - strings, + language, wikiData }) { const { groupData, wikiInfo } = wikiData; diff --git a/src/page/homepage.js b/src/page/homepage.js index 01844fb4..b20fc812 100644 --- a/src/page/homepage.js +++ b/src/page/homepage.js @@ -23,7 +23,7 @@ export function writeTargetless({wikiData}) { getAlbumGridHTML, getLinkThemeString, link, - strings, + language, to, transformInline, transformMultiline diff --git a/src/page/listing.js b/src/page/listing.js index a6f9e9e1..261b1e90 100644 --- a/src/page/listing.js +++ b/src/page/listing.js @@ -43,7 +43,7 @@ export function write(listing, {wikiData}) { type: 'page', path: ['listing', listing.directory], page: opts => { - const { getLinkThemeString, link, strings } = opts; + const { getLinkThemeString, link, language } = opts; const titleKey = `listingPage.${listing.stringsKey}.title`; return { @@ -70,7 +70,7 @@ export function write(listing, {wikiData}) { content: generateSidebarForListings(listing, { getLinkThemeString, link, - strings, + language, wikiData }) }, @@ -102,7 +102,7 @@ export function writeTargetless({wikiData}) { path: ['listingIndex'], page: ({ getLinkThemeString, - strings, + language, link }) => ({ title: language.$('listingIndex.title'), @@ -118,7 +118,7 @@ export function writeTargetless({wikiData}) { })}</p> <hr> <p>${language.$('listingIndex.exploreList')}</p> - ${generateLinkIndexForListings(null, false, {link, strings, wikiData})} + ${generateLinkIndexForListings(null, false, {link, language, wikiData})} ` }, @@ -126,7 +126,7 @@ export function writeTargetless({wikiData}) { content: generateSidebarForListings(null, { getLinkThemeString, link, - strings, + language, wikiData }) }, @@ -143,7 +143,7 @@ export function writeTargetless({wikiData}) { function generateSidebarForListings(currentListing, { getLinkThemeString, link, - strings, + language, wikiData }) { return fixWS` @@ -151,7 +151,7 @@ function generateSidebarForListings(currentListing, { ${generateLinkIndexForListings(currentListing, true, { getLinkThemeString, link, - strings, + language, wikiData })} `; @@ -160,7 +160,7 @@ function generateSidebarForListings(currentListing, { function generateLinkIndexForListings(currentListing, forSidebar, { getLinkThemeString, link, - strings, + language, wikiData }) { const { listingTargetSpec, wikiInfo } = wikiData; @@ -188,13 +188,13 @@ function generateLinkIndexForListings(currentListing, forSidebar, { {style: getLinkThemeString(wikiInfo.color)}, html.tag('span', {class: 'group-name'}, - title({strings}))), + title({language}))), genUL(listings) ])).join('\n'); } else { return html.tag('dl', filteredByCondition.flatMap(({ title, listings }) => [ - html.tag('dt', title({strings})), + html.tag('dt', title({language})), html.tag('dd', genUL(listings)) ])); } diff --git a/src/page/news.js b/src/page/news.js index 47239583..4f5c5059 100644 --- a/src/page/news.js +++ b/src/page/news.js @@ -21,7 +21,7 @@ export function write(entry, {wikiData}) { page: ({ generatePreviousNextLinks, link, - strings, + language, transformMultiline, }) => ({ title: language.$('newsEntryPage.title', {entry: entry.name}), @@ -39,7 +39,7 @@ export function write(entry, {wikiData}) { nav: generateNewsEntryNav(entry, { generatePreviousNextLinks, link, - strings, + language, wikiData }) }) @@ -56,7 +56,7 @@ export function writeTargetless({wikiData}) { path: ['newsIndex'], page: ({ link, - strings, + language, transformMultiline }) => ({ title: language.$('newsIndex.title'), @@ -90,7 +90,7 @@ export function writeTargetless({wikiData}) { function generateNewsEntryNav(entry, { generatePreviousNextLinks, link, - strings, + language, wikiData }) { const { wikiInfo, newsData } = wikiData; @@ -98,7 +98,7 @@ function generateNewsEntryNav(entry, { // The newsData list is sorted reverse chronologically (newest ones first), // so the way we find next/previous entries is flipped from normal. const previousNextLinks = generatePreviousNextLinks(entry, { - link, strings, + link, language, data: newsData.slice().reverse(), linkKey: 'newsEntry' }); diff --git a/src/page/static.js b/src/page/static.js index ff57c4fb..e9b6a047 100644 --- a/src/page/static.js +++ b/src/page/static.js @@ -17,7 +17,7 @@ export function write(staticPage, {wikiData}) { type: 'page', path: ['staticPage', staticPage.directory], page: ({ - strings, + language, transformMultiline }) => ({ title: staticPage.name, diff --git a/src/page/tag.js b/src/page/tag.js index af2e3942..8e5e6999 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -34,7 +34,7 @@ export function write(tag, {wikiData}) { getThemeString, getTrackCover, link, - strings, + language, to }) => ({ title: language.$('tagPage.title', {tag: tag.name}), @@ -64,7 +64,7 @@ export function write(tag, {wikiData}) { nav: generateTagNav(tag, { generatePreviousNextLinks, link, - strings, + language, wikiData }) }) @@ -78,7 +78,7 @@ export function write(tag, {wikiData}) { function generateTagNav(tag, { generatePreviousNextLinks, link, - strings, + language, wikiData }) { const previousNextLinks = generatePreviousNextLinks(tag, { diff --git a/src/page/track.js b/src/page/track.js index 7cc6d5ab..5249ea44 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -50,7 +50,7 @@ export function write(track, {wikiData}) { .flatMap(track => track.featuredInFlashes.map(flash => ({flash, as: track})))); } - const unbound_generateTrackList = (tracks, {getArtistString, link, strings}) => html.tag('ul', + const unbound_generateTrackList = (tracks, {getArtistString, link, language}) => html.tag('ul', tracks.map(track => { const line = language.$('trackList.item.withArtists', { track: link.track(track), @@ -67,7 +67,7 @@ export function write(track, {wikiData}) { const hasCommentary = track.commentary || otherReleases.some(t => t.commentary); const generateCommentary = ({ link, - strings, + language, transformMultiline }) => transformMultiline([ track.commentary, @@ -130,13 +130,13 @@ export function write(track, {wikiData}) { getThemeString, getTrackCover, link, - strings, + language, transformInline, transformLyrics, transformMultiline, to }) => { - const generateTrackList = bindOpts(unbound_generateTrackList, {getArtistString, link, strings}); + const generateTrackList = bindOpts(unbound_generateTrackList, {getArtistString, link, language}); const cover = getTrackCover(track); return { @@ -196,7 +196,7 @@ export function write(track, {wikiData}) { <p>${ (track.urls?.length ? language.$('releaseInfo.listenOn', { - links: language.formatDisjunctionList(track.urls.map(url => fancifyURL(url, {strings}))) + links: language.formatDisjunctionList(track.urls.map(url => fancifyURL(url, {language}))) }) : language.$('releaseInfo.listenOn.noLinks')) }</p> @@ -266,7 +266,7 @@ export function write(track, {wikiData}) { ${hasCommentary && fixWS` <p>${language.$('releaseInfo.artistCommentary')}</p> <blockquote> - ${generateCommentary({link, strings, transformMultiline})} + ${generateCommentary({link, language, transformMultiline})} </blockquote> `} ` @@ -276,7 +276,7 @@ export function write(track, {wikiData}) { fancifyURL, getLinkThemeString, link, - strings, + language, transformMultiline, wikiData }), @@ -303,7 +303,7 @@ export function write(track, {wikiData}) { divider: false, html: generateAlbumNavLinks(album, track, { generatePreviousNextLinks, - strings + language }) } ].filter(Boolean), diff --git a/src/util/replacer.js b/src/util/replacer.js index 0066d218..b29044f2 100644 --- a/src/util/replacer.js +++ b/src/util/replacer.js @@ -319,7 +319,7 @@ export function parseInput(input) { } function evaluateTag(node, opts) { - const { find, input, link, replacerSpec, strings, to, wikiData } = opts; + const { find, input, language, link, replacerSpec, to, wikiData } = opts; const source = input.slice(node.i, node.iEnd); @@ -382,7 +382,7 @@ function evaluateTag(node, opts) { : link[linkKey]); try { - return fn(value, {text: label, hash, args, strings, to}); + return fn(value, {text: label, hash, args, language, to}); } catch (error) { logError`The link ${source} failed to be processed: ${error}`; return source; @@ -416,14 +416,14 @@ function transformNodes(nodes, opts) { return nodes.map(node => transformNode(node, opts)).join(''); } -export function transformInline(input, {replacerSpec, find, link, strings, to, wikiData}) { +export function transformInline(input, {replacerSpec, find, link, language, to, wikiData}) { if (!replacerSpec) throw new Error('Expected replacerSpec'); if (!find) throw new Error('Expected find'); if (!link) throw new Error('Expected link'); - if (!strings) throw new Error('Expected strings'); + if (!language) throw new Error('Expected language'); if (!to) throw new Error('Expected to'); if (!wikiData) throw new Error('Expected wikiData'); const nodes = parseInput(input); - return transformNodes(nodes, {input, find, link, replacerSpec, strings, to, wikiData}); + return transformNodes(nodes, {input, find, link, replacerSpec, language, to, wikiData}); } |