From c6aff602f65dfa4e5a1bc1a8c6841cdda829a0ce Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 10 May 2022 20:17:40 -0300 Subject: rename strings( to language.$( --- src/data/things.js | 6 +-- src/listing-spec.js | 100 +++++++++++++++++++++---------------------- src/misc-templates.js | 84 ++++++++++++++++++------------------ src/page/album-commentary.js | 24 +++++------ src/page/album.js | 64 +++++++++++++-------------- src/page/artist.js | 90 +++++++++++++++++++------------------- src/page/flash.js | 28 ++++++------ src/page/group.js | 40 ++++++++--------- src/page/homepage.js | 10 ++--- src/page/listing.js | 18 ++++---- src/page/news.js | 16 +++---- src/page/tag.js | 10 ++--- src/page/track.js | 58 ++++++++++++------------- src/upd8.js | 26 +++++------ src/util/strings.js | 12 +++--- 15 files changed, 293 insertions(+), 293 deletions(-) diff --git a/src/data/things.js b/src/data/things.js index a37ede7b..34946c0f 100644 --- a/src/data/things.js +++ b/src/data/things.js @@ -1494,7 +1494,7 @@ Object.assign(Language.prototype, { formatDuration(secTotal, {approximate = false, unit = false}) { if (secTotal === 0) { - return strings('count.duration.missing'); + return language.$('count.duration.missing'); } const hour = Math.floor(secTotal / 3600); @@ -1537,8 +1537,8 @@ Object.assign(Language.prototype, { : value); const words = (value > 1000 - ? strings('count.words.thousand', {words: num}) - : strings('count.words', {words: num})); + ? language.$('count.words.thousand', {words: num}) + : language.$('count.words', {words: num})); return this.$('count.words.withUnit.' + this.getUnitForm(value), {words}); }, diff --git a/src/listing-spec.js b/src/listing-spec.js index 3ee977d2..755564b9 100644 --- a/src/listing-spec.js +++ b/src/listing-spec.js @@ -19,7 +19,7 @@ const listingSpec = [ }, row(album, {link, strings}) { - return strings('listingPage.listAlbums.byName.item', { + return language.$('listingPage.listAlbums.byName.item', { album: link.album(album), tracks: language.countTracks(album.tracks.length, {unit: true}) }); @@ -36,7 +36,7 @@ const listingSpec = [ }, row(album, {link, strings}) { - return strings('listingPage.listAlbums.byTracks.item', { + return language.$('listingPage.listAlbums.byTracks.item', { album: link.album(album), tracks: language.countTracks(album.tracks.length, {unit: true}) }); @@ -54,7 +54,7 @@ const listingSpec = [ }, row({album, duration}, {link, strings}) { - return strings('listingPage.listAlbums.byDuration.item', { + return language.$('listingPage.listAlbums.byDuration.item', { album: link.album(album), duration: strings.count.duration(duration) }); @@ -70,7 +70,7 @@ const listingSpec = [ }, row(album, {link, strings}) { - return strings('listingPage.listAlbums.byDate.item', { + return language.$('listingPage.listAlbums.byDate.item', { album: link.album(album), date: strings.count.date(album.date) }); @@ -92,12 +92,12 @@ const listingSpec = [ return fixWS`
${chunks.map(({dateAddedToWiki, chunk: albums}) => fixWS` -
${strings('listingPage.listAlbums.byDateAdded.date', { +
${language.$('listingPage.listAlbums.byDateAdded.date', { date: strings.count.date(dateAddedToWiki) })}
    ${(albums - .map(album => strings('listingPage.listAlbums.byDateAdded.album', { + .map(album => language.$('listingPage.listAlbums.byDateAdded.album', { album: link.album(album) })) .map(row => `
  • ${row}
  • `) @@ -120,7 +120,7 @@ const listingSpec = [ }, row({artist, contributions}, {link, strings}) { - return strings('listingPage.listArtists.byName.item', { + return language.$('listingPage.listArtists.byName.item', { artist: link.artist(artist), contributions: language.countContributions(contributions, {unit: true}) }); @@ -171,10 +171,10 @@ const listingSpec = [ return fixWS`
    -

    ${strings('listingPage.misc.trackContributors')}

    +

    ${language.$('listingPage.misc.trackContributors')}

      ${(toTracks - .map(({ artist, contributions }) => strings('listingPage.listArtists.byContribs.item', { + .map(({ artist, contributions }) => language.$('listingPage.listArtists.byContribs.item', { artist: link.artist(artist), contributions: language.countContributions(contributions, {unit: true}) })) @@ -183,13 +183,13 @@ const listingSpec = [
    -

    ${strings('listingPage.misc' + +

    ${language.$('listingPage.misc' + (showAsFlashes ? '.artAndFlashContributors' : '.artContributors'))}

      ${(toArtAndFlashes - .map(({ artist, contributions }) => strings('listingPage.listArtists.byContribs.item', { + .map(({ artist, contributions }) => language.$('listingPage.listArtists.byContribs.item', { artist: link.artist(artist), contributions: language.countContributions(contributions, {unit: true}) })) @@ -217,7 +217,7 @@ const listingSpec = [ }, row({artist, entries}, {link, strings}) { - return strings('listingPage.listArtists.byCommentary.item', { + return language.$('listingPage.listArtists.byCommentary.item', { artist: link.artist(artist), entries: language.countCommentaryEntries(entries, {unit: true}) }); @@ -242,7 +242,7 @@ const listingSpec = [ }, row({artist, duration}, {link, strings}) { - return strings('listingPage.listArtists.byDuration.item', { + return language.$('listingPage.listArtists.byDuration.item', { artist: link.artist(artist), duration: strings.count.duration(duration) }); @@ -297,10 +297,10 @@ const listingSpec = [ return fixWS`
      -

      ${strings('listingPage.misc.trackContributors')}

      +

      ${language.$('listingPage.misc.trackContributors')}

        ${(toTracks - .map(({ artist, date }) => strings('listingPage.listArtists.byLatest.item', { + .map(({ artist, date }) => language.$('listingPage.listArtists.byLatest.item', { artist: link.artist(artist), date: strings.count.date(date) })) @@ -309,13 +309,13 @@ const listingSpec = [
      -

      ${strings('listingPage.misc' + +

      ${language.$('listingPage.misc' + (showAsFlashes ? '.artAndFlashContributors' : '.artContributors'))}

        ${(toArtAndFlashes - .map(({ artist, date }) => strings('listingPage.listArtists.byLatest.item', { + .map(({ artist, date }) => language.$('listingPage.listArtists.byLatest.item', { artist: link.artist(artist), date: strings.count.date(date) })) @@ -335,10 +335,10 @@ const listingSpec = [ data: ({wikiData}) => wikiData.groupData.slice().sort(sortByName), row(group, {link, strings}) { - return strings('listingPage.listGroups.byCategory.group', { + return language.$('listingPage.listGroups.byCategory.group', { group: link.groupInfo(group), gallery: link.groupGallery(group, { - text: strings('listingPage.listGroups.byCategory.group.gallery') + text: language.$('listingPage.listGroups.byCategory.group.gallery') }) }); } @@ -354,15 +354,15 @@ const listingSpec = [ return fixWS`
        ${groupCategoryData.map(category => fixWS` -
        ${strings('listingPage.listGroups.byCategory.category', { +
        ${language.$('listingPage.listGroups.byCategory.category', { category: link.groupInfo(category.groups[0], {text: category.name}) })}
          ${(category.groups - .map(group => strings('listingPage.listGroups.byCategory.group', { + .map(group => language.$('listingPage.listGroups.byCategory.group', { group: link.groupInfo(group), gallery: link.groupGallery(group, { - text: strings('listingPage.listGroups.byCategory.group.gallery') + text: language.$('listingPage.listGroups.byCategory.group.gallery') }) })) .map(row => `
        • ${row}
        • `) @@ -386,7 +386,7 @@ const listingSpec = [ }, row({group, albums}, {link, strings}) { - return strings('listingPage.listGroups.byAlbums.item', { + return language.$('listingPage.listGroups.byAlbums.item', { group: link.groupInfo(group), albums: language.countAlbums(albums, {unit: true}) }); @@ -405,7 +405,7 @@ const listingSpec = [ }, row({group, tracks}, {link, strings}) { - return strings('listingPage.listGroups.byTracks.item', { + return language.$('listingPage.listGroups.byTracks.item', { group: link.groupInfo(group), tracks: language.countTracks(tracks, {unit: true}) }); @@ -424,7 +424,7 @@ const listingSpec = [ }, row({group, duration}, {link, strings}) { - return strings('listingPage.listGroups.byDuration.item', { + return language.$('listingPage.listGroups.byDuration.item', { group: link.groupInfo(group), duration: strings.count.duration(duration) }); @@ -462,7 +462,7 @@ const listingSpec = [ }, row({group, date}, {link, strings}) { - return strings('listingPage.listGroups.byLatest.item', { + return language.$('listingPage.listGroups.byLatest.item', { group: link.groupInfo(group), date: strings.count.date(date) }); @@ -478,7 +478,7 @@ const listingSpec = [ }, row(track, {link, strings}) { - return strings('listingPage.listTracks.byName.item', { + return language.$('listingPage.listTracks.byName.item', { track: link.track(track) }); } @@ -493,12 +493,12 @@ const listingSpec = [ return fixWS`
          ${albumData.map(album => fixWS` -
          ${strings('listingPage.listTracks.byAlbum.album', { +
          ${language.$('listingPage.listTracks.byAlbum.album', { album: link.album(album) })}
            ${(album.tracks - .map(track => strings('listingPage.listTracks.byAlbum.track', { + .map(track => language.$('listingPage.listTracks.byAlbum.track', { track: link.track(track) })) .map(row => `
          1. ${row}
          2. `) @@ -525,17 +525,17 @@ const listingSpec = [ return fixWS`
            ${chunks.map(({album, date, chunk: tracks}) => fixWS` -
            ${strings('listingPage.listTracks.byDate.album', { +
            ${language.$('listingPage.listTracks.byDate.album', { album: link.album(album), date: strings.count.date(date) })}
              ${(tracks .map(track => track.aka - ? `
            • ${strings('listingPage.listTracks.byDate.track.rerelease', { + ? `
            • ${language.$('listingPage.listTracks.byDate.track.rerelease', { track: link.track(track) })}
            • ` - : `
            • ${strings('listingPage.listTracks.byDate.track', { + : `
            • ${language.$('listingPage.listTracks.byDate.track', { track: link.track(track) })}
            • `) .join('\n'))} @@ -558,7 +558,7 @@ const listingSpec = [ }, row({track, duration}, {link, strings}) { - return strings('listingPage.listTracks.byDuration.item', { + return language.$('listingPage.listTracks.byDuration.item', { track: link.track(track), duration: strings.count.duration(duration) }); @@ -580,12 +580,12 @@ const listingSpec = [ return fixWS`
              ${albums.map(({album, tracks}) => fixWS` -
              ${strings('listingPage.listTracks.byDurationInAlbum.album', { +
              ${language.$('listingPage.listTracks.byDurationInAlbum.album', { album: link.album(album) })}
                ${(tracks - .map(track => strings('listingPage.listTracks.byDurationInAlbum.track', { + .map(track => language.$('listingPage.listTracks.byDurationInAlbum.track', { track: link.track(track), duration: strings.count.duration(track.duration) })) @@ -610,7 +610,7 @@ const listingSpec = [ }, row({track, timesReferenced}, {link, strings}) { - return strings('listingPage.listTracks.byTimesReferenced.item', { + return language.$('listingPage.listTracks.byTimesReferenced.item', { track: link.track(track), timesReferenced: language.countTimesReferenced(timesReferenced, {unit: true}) }); @@ -631,13 +631,13 @@ const listingSpec = [ return fixWS`
                ${chunks.map(({album, chunk: tracks}) => fixWS` -
                ${strings('listingPage.listTracks.inFlashes.byAlbum.album', { +
                ${language.$('listingPage.listTracks.inFlashes.byAlbum.album', { album: link.album(album), date: strings.count.date(album.date) })}
                  ${(tracks - .map(track => strings('listingPage.listTracks.inFlashes.byAlbum.track', { + .map(track => language.$('listingPage.listTracks.inFlashes.byAlbum.track', { track: link.track(track), flashes: strings.list.and(track.featuredInFlashes.map(link.flash)) })) @@ -660,13 +660,13 @@ const listingSpec = [ return fixWS`
                  ${sortByDate(flashData.slice()).map(flash => fixWS` -
                  ${strings('listingPage.listTracks.inFlashes.byFlash.flash', { +
                  ${language.$('listingPage.listTracks.inFlashes.byFlash.flash', { flash: link.flash(flash), date: strings.count.date(flash.date) })}
                    ${(flash.featuredTracks - .map(track => strings('listingPage.listTracks.inFlashes.byFlash.track', { + .map(track => language.$('listingPage.listTracks.inFlashes.byFlash.track', { track: link.track(track), album: link.album(track.album) })) @@ -691,13 +691,13 @@ const listingSpec = [ return fixWS`
                    ${chunks.map(({album, chunk: tracks}) => fixWS` -
                    ${strings('listingPage.listTracks.withLyrics.album', { +
                    ${language.$('listingPage.listTracks.withLyrics.album', { album: link.album(album), date: strings.count.date(album.date) })}
                      ${(tracks - .map(track => strings('listingPage.listTracks.withLyrics.track', { + .map(track => language.$('listingPage.listTracks.withLyrics.track', { track: link.track(track), })) .map(row => `
                    • ${row}
                    • `) @@ -722,7 +722,7 @@ const listingSpec = [ }, row({tag, timesUsed}, {link, strings}) { - return strings('listingPage.listTags.byName.item', { + return language.$('listingPage.listTags.byName.item', { tag: link.tag(tag), timesUsed: language.countTimesUsed(timesUsed, {unit: true}) }); @@ -742,7 +742,7 @@ const listingSpec = [ }, row({tag, timesUsed}, {link, strings}) { - return strings('listingPage.listTags.byUses.item', { + return language.$('listingPage.listTags.byUses.item', { tag: link.tag(tag), timesUsed: language.countTimesUsed(timesUsed, {unit: true}) }); @@ -794,27 +794,27 @@ const filterListings = directoryPrefix => listingSpec const listingTargetSpec = [ { - title: ({strings}) => strings('listingPage.target.album'), + title: ({strings}) => language.$('listingPage.target.album'), listings: filterListings('album') }, { - title: ({strings}) => strings('listingPage.target.artist'), + title: ({strings}) => language.$('listingPage.target.artist'), listings: filterListings('artist') }, { - title: ({strings}) => strings('listingPage.target.group'), + title: ({strings}) => language.$('listingPage.target.group'), listings: filterListings('group') }, { - title: ({strings}) => strings('listingPage.target.track'), + title: ({strings}) => language.$('listingPage.target.track'), listings: filterListings('track') }, { - title: ({strings}) => strings('listingPage.target.tag'), + title: ({strings}) => language.$('listingPage.target.tag'), listings: filterListings('tag') }, { - title: ({strings}) => strings('listingPage.target.other'), + title: ({strings}) => language.$('listingPage.target.other'), listings: [ listingSpec.find(l => l.directory === 'random') ] diff --git a/src/misc-templates.js b/src/misc-templates.js index 9a00d3b5..4d9939a1 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -67,7 +67,7 @@ export function generateChronologyLinks(currentThing, { } if (contributions.length > 8) { - return `
                      ${strings('misc.chronology.seeArtistPages')}
                      `; + return `
                      ${language.$('misc.chronology.seeArtistPages')}
                      `; } return contributions.map(({ who: artist }) => { @@ -83,11 +83,11 @@ export function generateChronologyLinks(currentThing, { const parts = [ previous && linkAnythingMan(previous, { color: false, - text: strings('misc.nav.previous') + text: language.$('misc.nav.previous') }), next && linkAnythingMan(next, { color: false, - text: strings('misc.nav.next') + text: language.$('misc.nav.next') }) ].filter(Boolean); @@ -102,7 +102,7 @@ export function generateChronologyLinks(currentThing, { return fixWS`
                      - ${strings(headingString, stringOpts)} + ${language.$(headingString, stringOpts)} ${parts.length && `(${parts.join(', ')})`}
                      `; @@ -112,7 +112,7 @@ export function generateChronologyLinks(currentThing, { // Content warning tags export function getRevealStringFromWarnings(warnings, {strings}) { - return strings('misc.contentWarnings', {warnings}) + `
                      ${strings('misc.contentWarnings.reveal')}` + return language.$('misc.contentWarnings', {warnings}) + `
                      ${language.$('misc.contentWarnings.reveal')}` } export function getRevealStringFromTags(tags, {strings}) { @@ -152,7 +152,7 @@ export function generateCoverLink({ })} ${wikiInfo.enableArtTagUI && tags.filter(tag => !tag.isContentWarning).length && fixWS`

                      - ${strings('releaseInfo.artTags')} + ${language.$('releaseInfo.artTags')} ${(tags .filter(tag => !tag.isContentWarning) .map(link.tag) @@ -214,23 +214,23 @@ export function fancifyURL(url, {strings, album = false} = {}) { domain = local; } return fixWS`${ - domain === local ? strings('misc.external.local') : - domain.includes('bandcamp.com') ? strings('misc.external.bandcamp') : - BANDCAMP_DOMAINS.includes(domain) ? strings('misc.external.bandcamp.domain', {domain}) : - MASTODON_DOMAINS.includes(domain) ? strings('misc.external.mastodon.domain', {domain}) : + domain === local ? language.$('misc.external.local') : + domain.includes('bandcamp.com') ? language.$('misc.external.bandcamp') : + BANDCAMP_DOMAINS.includes(domain) ? language.$('misc.external.bandcamp.domain', {domain}) : + MASTODON_DOMAINS.includes(domain) ? language.$('misc.external.mastodon.domain', {domain}) : domain.includes('youtu') ? (album ? (url.includes('list=') - ? strings('misc.external.youtube.playlist') - : strings('misc.external.youtube.fullAlbum')) - : strings('misc.external.youtube')) : - domain.includes('soundcloud') ? strings('misc.external.soundcloud') : - domain.includes('tumblr.com') ? strings('misc.external.tumblr') : - domain.includes('twitter.com') ? strings('misc.external.twitter') : - domain.includes('deviantart.com') ? strings('misc.external.deviantart') : - domain.includes('wikipedia.org') ? strings('misc.external.wikipedia') : - domain.includes('poetryfoundation.org') ? strings('misc.external.poetryFoundation') : - domain.includes('instagram.com') ? strings('misc.external.instagram') : - domain.includes('patreon.com') ? strings('misc.external.patreon') : + ? language.$('misc.external.youtube.playlist') + : language.$('misc.external.youtube.fullAlbum')) + : language.$('misc.external.youtube')) : + domain.includes('soundcloud') ? language.$('misc.external.soundcloud') : + domain.includes('tumblr.com') ? language.$('misc.external.tumblr') : + domain.includes('twitter.com') ? language.$('misc.external.twitter') : + domain.includes('deviantart.com') ? language.$('misc.external.deviantart') : + domain.includes('wikipedia.org') ? language.$('misc.external.wikipedia') : + domain.includes('poetryfoundation.org') ? language.$('misc.external.poetryFoundation') : + domain.includes('instagram.com') ? language.$('misc.external.instagram') : + domain.includes('patreon.com') ? language.$('misc.external.patreon') : domain }`; } @@ -239,10 +239,10 @@ export function fancifyFlashURL(url, flash, {strings}) { const link = fancifyURL(url, {strings}); return `${ url.includes('homestuck.com') ? (isNaN(Number(flash.page)) - ? strings('misc.external.flash.homestuck.secret', {link}) - : strings('misc.external.flash.homestuck.page', {link, page: flash.page})) : - url.includes('bgreco.net') ? strings('misc.external.flash.bgreco', {link}) : - url.includes('youtu') ? strings('misc.external.flash.youtube', {link}) : + ? language.$('misc.external.flash.homestuck.secret', {link}) + : language.$('misc.external.flash.homestuck.page', {link, page: flash.page})) : + url.includes('bgreco.net') ? language.$('misc.external.flash.bgreco', {link}) : + url.includes('youtu') ? language.$('misc.external.flash.youtube', {link}) : link }`; } @@ -250,16 +250,16 @@ export function fancifyFlashURL(url, flash, {strings}) { export function iconifyURL(url, {strings, to}) { const domain = new URL(url).hostname; const [ id, msg ] = ( - domain.includes('bandcamp.com') ? ['bandcamp', strings('misc.external.bandcamp')] : - BANDCAMP_DOMAINS.includes(domain) ? ['bandcamp', strings('misc.external.bandcamp.domain', {domain})] : - MASTODON_DOMAINS.includes(domain) ? ['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})] + domain.includes('bandcamp.com') ? ['bandcamp', language.$('misc.external.bandcamp')] : + BANDCAMP_DOMAINS.includes(domain) ? ['bandcamp', language.$('misc.external.bandcamp.domain', {domain})] : + MASTODON_DOMAINS.includes(domain) ? ['mastodon', language.$('misc.external.mastodon.domain', {domain})] : + domain.includes('youtu') ? ['youtube', language.$('misc.external.youtube')] : + domain.includes('soundcloud') ? ['soundcloud', language.$('misc.external.soundcloud')] : + domain.includes('tumblr.com') ? ['tumblr', language.$('misc.external.tumblr')] : + domain.includes('twitter.com') ? ['twitter', language.$('misc.external.twitter')] : + domain.includes('deviantart.com') ? ['deviantart', language.$('misc.external.deviantart')] : + domain.includes('instagram.com') ? ['instagram', language.$('misc.external.bandcamp')] : + ['globe', language.$('misc.external.domain', {domain})] ); return fixWS`${msg}`; } @@ -305,11 +305,11 @@ export function getAlbumGridHTML({ return getGridHTML({ srcFn: getAlbumCover, linkFn: link.album, - detailsFn: details && (album => strings('misc.albumGrid.details', { + detailsFn: details && (album => language.$('misc.albumGrid.details', { tracks: language.countTracks(album.tracks.length, {unit: true}), time: strings.count.duration(getTotalDuration(album.tracks)) })), - noSrcTextFn: album => strings('misc.albumGrid.noCoverArt', { + noSrcTextFn: album => language.$('misc.albumGrid.noCoverArt', { album: album.name }), ...props @@ -337,11 +337,11 @@ export function generateInfoGalleryLinks(currentThing, isGallery, { return [ link[linkKeyInfo](currentThing, { class: isGallery ? '' : 'current', - text: strings('misc.nav.info') + text: language.$('misc.nav.info') }), link[linkKeyGallery](currentThing, { class: isGallery ? 'current' : '', - text: strings('misc.nav.gallery') + text: language.$('misc.nav.gallery') }) ].join(', '); } @@ -364,7 +364,7 @@ export function generatePreviousNextLinks(current, { id: 'previous-button', title: previous.name }, - text: strings('misc.nav.previous'), + text: language.$('misc.nav.previous'), color: false }), next && linkFn(next, { @@ -372,7 +372,7 @@ export function generatePreviousNextLinks(current, { id: 'next-button', title: next.name }, - text: strings('misc.nav.next'), + text: language.$('misc.nav.next'), color: false }) ].filter(Boolean).join(', '); @@ -405,5 +405,5 @@ export function getFooterLocalizationLinks(pathname, { return html.tag('div', {class: 'footer-localization-links'}, - strings('misc.uiLanguage', {languages: links.join('\n')})); + language.$('misc.uiLanguage', {languages: links.join('\n')})); } diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js index 90b36fc2..3c2b23cc 100644 --- a/src/page/album-commentary.js +++ b/src/page/album-commentary.js @@ -36,28 +36,28 @@ export function write(album, {wikiData}) { to, transformMultiline }) => ({ - title: strings('albumCommentaryPage.title', {album: album.name}), + title: language.$('albumCommentaryPage.title', {album: album.name}), stylesheet: getAlbumStylesheet(album), theme: getThemeString(album.color), main: { content: fixWS`

                      -

                      ${strings('albumCommentaryPage.title', { +

                      ${language.$('albumCommentaryPage.title', { album: link.album(album) })}

                      -

                      ${strings('albumCommentaryPage.infoLine', { +

                      ${language.$('albumCommentaryPage.infoLine', { words: `${strings.count.words(words, {unit: true})}`, entries: `${language.countCommentaryEntries(entries.length, {unit: true})}` })}

                      ${album.commentary && fixWS` -

                      ${strings('albumCommentaryPage.entry.title.albumCommentary')}

                      +

                      ${language.$('albumCommentaryPage.entry.title.albumCommentary')}

                      ${transformMultiline(album.commentary)}
                      `} ${album.tracks.filter(t => t.commentary).map(track => fixWS` -

                      ${strings('albumCommentaryPage.entry.title.trackCommentary', { +

                      ${language.$('albumCommentaryPage.entry.title.trackCommentary', { track: link.track(track) })}

                      @@ -73,10 +73,10 @@ export function write(album, {wikiData}) { {toHome: true}, { path: ['localized.commentaryIndex'], - title: strings('commentaryIndex.title') + title: language.$('commentaryIndex.title') }, { - html: strings('albumCommentaryPage.nav.album', { + html: language.$('albumCommentaryPage.nav.album', { album: link.albumCommentary(album, {class: 'current'}) }) } @@ -109,21 +109,21 @@ export function writeTargetless({wikiData}) { link, strings }) => ({ - title: strings('commentaryIndex.title'), + title: language.$('commentaryIndex.title'), main: { content: fixWS`
                      -

                      ${strings('commentaryIndex.title')}

                      -

                      ${strings('commentaryIndex.infoLine', { +

                      ${language.$('commentaryIndex.title')}

                      +

                      ${language.$('commentaryIndex.infoLine', { words: `${strings.count.words(totalWords, {unit: true})}`, entries: `${language.countCommentaryEntries(totalEntries, {unit: true})}` })}

                      -

                      ${strings('commentaryIndex.albumList.title')}

                      +

                      ${language.$('commentaryIndex.albumList.title')}

                        ${data .map(({ album, entries, words }) => fixWS` -
                      • ${strings('commentaryIndex.albumList.item', { +
                      • ${language.$('commentaryIndex.albumList.item', { album: link.albumCommentary(album), words: strings.count.words(words, {unit: true}), entries: language.countCommentaryEntries(entries.length, {unit: true}) diff --git a/src/page/album.js b/src/page/album.js index 66d4bfae..4b4ac6bd 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -41,11 +41,11 @@ export function write(album, {wikiData}) { track.artistContribs.map(c => c.who), album.artistContribs.map(c => c.who), {checkOrder: false}) - ? strings('trackList.item.withDuration', itemOpts) - : strings('trackList.item.withDuration.withArtists', { + ? language.$('trackList.item.withDuration', itemOpts) + : language.$('trackList.item.withDuration.withArtists', { ...itemOpts, by: `${ - strings('trackList.item.withArtists.by', { + language.$('trackList.item.withArtists.by', { artists: getArtistString(track.artistContribs) }) }` @@ -121,7 +121,7 @@ export function write(album, {wikiData}) { const cover = getAlbumCover(album); return { - title: strings('albumPage.title', {album: album.name}), + title: language.$('albumPage.title', {album: album.name}), stylesheet: getAlbumStylesheet(album), theme: getThemeString(album.color, [ `--album-directory: ${album.directory}` @@ -130,7 +130,7 @@ export function write(album, {wikiData}) { banner: album.bannerArtistContribs.length && { dimensions: album.bannerDimensions, path: ['media.albumBanner', album.directory, album.bannerFileExtension], - alt: strings('misc.alt.albumBanner'), + alt: language.$('misc.alt.albumBanner'), position: 'top' }, @@ -138,58 +138,58 @@ export function write(album, {wikiData}) { content: fixWS` ${cover && generateCoverLink({ src: cover, - alt: strings('misc.alt.albumCover'), + alt: language.$('misc.alt.albumCover'), tags: album.artTags })} -

                        ${strings('albumPage.title', {album: album.name})}

                        +

                        ${language.$('albumPage.title', {album: album.name})}

                        ${[ - album.artistContribs.length && strings('releaseInfo.by', { + album.artistContribs.length && language.$('releaseInfo.by', { artists: getArtistString(album.artistContribs, { showContrib: true, showIcons: true }) }), - album.coverArtistContribs.length && strings('releaseInfo.coverArtBy', { + album.coverArtistContribs.length && language.$('releaseInfo.coverArtBy', { artists: getArtistString(album.coverArtistContribs, { showContrib: true, showIcons: true }) }), - album.wallpaperArtistContribs.length && strings('releaseInfo.wallpaperArtBy', { + album.wallpaperArtistContribs.length && language.$('releaseInfo.wallpaperArtBy', { artists: getArtistString(album.wallpaperArtistContribs, { showContrib: true, showIcons: true }) }), - album.bannerArtistContribs.length && strings('releaseInfo.bannerArtBy', { + album.bannerArtistContribs.length && language.$('releaseInfo.bannerArtBy', { artists: getArtistString(album.bannerArtistContribs, { showContrib: true, showIcons: true }) }), - album.date && strings('releaseInfo.released', { + album.date && language.$('releaseInfo.released', { date: strings.count.date(album.date) }), (album.coverArtDate && +album.coverArtDate !== +album.date && - strings('releaseInfo.artReleased', { + language.$('releaseInfo.artReleased', { date: strings.count.date(album.coverArtDate) })), - strings('releaseInfo.duration', { + language.$('releaseInfo.duration', { duration: strings.count.duration(albumDuration, {approximate: album.tracks.length > 1}) }) ].filter(Boolean).join('
                        \n')}

                        ${commentaryEntries && `

                        ${ - strings('releaseInfo.viewCommentary', { + language.$('releaseInfo.viewCommentary', { link: link.albumCommentary(album, { - text: strings('releaseInfo.viewCommentary.link') + text: language.$('releaseInfo.viewCommentary.link') }) }) }

                        `} ${album.urls?.length && `

                        ${ - strings('releaseInfo.listenOn', { + language.$('releaseInfo.listenOn', { links: strings.list.or(album.urls.map(url => fancifyURL(url, {album: true}))) }) }

                        `} @@ -197,7 +197,7 @@ export function write(album, {wikiData}) {
                        ${album.trackGroups.map(({ name, color, startIndex, tracks }) => fixWS`
                        ${ - strings('trackList.group', { + language.$('trackList.group', { duration: strings.count.duration(getTotalDuration(tracks), {approximate: tracks.length > 1}), group: name }) @@ -215,14 +215,14 @@ export function write(album, {wikiData}) { ${album.dateAddedToWiki && fixWS`

                        ${[ - strings('releaseInfo.addedToWiki', { + language.$('releaseInfo.addedToWiki', { date: strings.count.date(album.dateAddedToWiki) }) ].filter(Boolean).join('
                        \n')}

                        `} ${album.commentary && fixWS` -

                        ${strings('releaseInfo.artistCommentary')}

                        +

                        ${language.$('releaseInfo.artistCommentary')}

                        ${transformMultiline(album.commentary)}
                        @@ -243,7 +243,7 @@ export function write(album, {wikiData}) { links: [ {toHome: true}, { - html: strings('albumPage.nav.album', { + html: language.$('albumPage.nav.album', { album: link.album(album, {class: 'current'}) }) }, @@ -276,7 +276,7 @@ export function generateAlbumSidebar(album, currentTrack, { /* const trackGroups = album.trackGroups || [{ - name: strings('albumSidebar.trackList.fallbackGroupName'), + name: language.$('albumSidebar.trackList.fallbackGroupName'), color: album.color, startIndex: 0, tracks: album.tracks @@ -287,13 +287,13 @@ export function generateAlbumSidebar(album, currentTrack, { const trackToListItem = track => html.tag('li', {class: track === currentTrack && 'current'}, - strings('albumSidebar.trackList.item', { + language.$('albumSidebar.trackList.item', { track: link.track(track) })); const nameOrDefault = (isDefaultTrackGroup, name) => (isDefaultTrackGroup - ? strings('albumSidebar.trackList.fallbackGroupName') + ? language.$('albumSidebar.trackList.fallbackGroupName') : name); const trackListPart = fixWS` @@ -309,11 +309,11 @@ export function generateAlbumSidebar(album, currentTrack, { html.tag('summary', {style: getLinkThemeString(color)}, (listTag === 'ol' - ? strings('albumSidebar.trackList.group.withRange', { + ? language.$('albumSidebar.trackList.group.withRange', { group: `${nameOrDefault(isDefaultTrackGroup, name)}`, range: `${startIndex + 1}–${startIndex + tracks.length}` }) - : strings('albumSidebar.trackList.group', { + : language.$('albumSidebar.trackList.group', { group: `${nameOrDefault(isDefaultTrackGroup, name)}` })) ), @@ -335,24 +335,24 @@ export function generateAlbumSidebar(album, currentTrack, { return {group, next, previous}; }).map(({group, next, previous}) => fixWS`

                        ${ - strings('albumSidebar.groupBox.title', { + language.$('albumSidebar.groupBox.title', { group: link.groupInfo(group) }) }

                        ${!currentTrack && transformMultiline(group.descriptionShort)} ${group.urls?.length && `

                        ${ - strings('releaseInfo.visitOn', { + language.$('releaseInfo.visitOn', { links: strings.list.or(group.urls.map(url => fancifyURL(url))) }) }

                        `} ${!currentTrack && fixWS` ${next && ``} ${previous && ``} @@ -397,8 +397,8 @@ export function generateAlbumNavLinks(album, currentTrack, { }); const randomLink = `${ (currentTrack - ? strings('trackPage.nav.random') - : strings('albumPage.nav.randomTrack')) + ? language.$('trackPage.nav.random') + : language.$('albumPage.nav.randomTrack')) }`; return (previousNextLinks diff --git a/src/page/artist.js b/src/page/artist.js index 0383c68d..3a9de70b 100644 --- a/src/page/artist.js +++ b/src/page/artist.js @@ -143,20 +143,20 @@ export function write(artist, {wikiData}) { aka, entry, artists, contrib }) => (aka - ? strings('artistPage.creditList.entry.rerelease', {entry}) + ? language.$('artistPage.creditList.entry.rerelease', {entry}) : (artists.length ? ((contrib.what || contrib.whatArray?.length) - ? strings('artistPage.creditList.entry.withArtists.withContribution', { + ? language.$('artistPage.creditList.entry.withArtists.withContribution', { entry, artists: getArtistString(artists), contribution: (contrib.whatArray ? strings.list.unit(contrib.whatArray) : contrib.what) }) - : strings('artistPage.creditList.entry.withArtists', { + : language.$('artistPage.creditList.entry.withArtists', { entry, artists: getArtistString(artists) })) : ((contrib.what || contrib.whatArray?.length) - ? strings('artistPage.creditList.entry.withContribution', { + ? language.$('artistPage.creditList.entry.withContribution', { entry, contribution: (contrib.whatArray ? strings.list.unit(contrib.whatArray) : contrib.what) }) @@ -168,24 +168,24 @@ export function write(artist, {wikiData}) {
                        ${chunks.map(({date, album, chunk, duration}) => fixWS`
                        ${ - (date && duration) ? strings('artistPage.creditList.album.withDate.withDuration', { + (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 ? strings('artistPage.creditList.album.withDate', { + }) : date ? language.$('artistPage.creditList.album.withDate', { album: link.album(album), date: strings.count.date(date) - }) : duration ? strings('artistPage.creditList.album.withDuration', { + }) : duration ? language.$('artistPage.creditList.album.withDuration', { album: link.album(album), duration: strings.count.duration(duration, {approximate: true}) - }) : strings('artistPage.creditList.album', { + }) : language.$('artistPage.creditList.album', { album: link.album(album) })}
                          ${(chunk .map(({track, ...props}) => ({ aka: track.aka, - entry: strings('artistPage.creditList.entry.track.withDuration', { + entry: language.$('artistPage.creditList.entry.track.withDuration', { track: link.track(track), duration: strings.count.duration(track.duration) }), @@ -283,47 +283,47 @@ export function write(artist, {wikiData}) { }); return { - title: strings('artistPage.title', {artist: name}), + title: language.$('artistPage.title', {artist: name}), main: { content: fixWS` ${artist.hasAvatar && generateCoverLink({ src: getArtistAvatar(artist), - alt: strings('misc.alt.artistAvatar') + alt: language.$('misc.alt.artistAvatar') })} -

                          ${strings('artistPage.title', {artist: name})}

                          +

                          ${language.$('artistPage.title', {artist: name})}

                          ${contextNotes && fixWS` -

                          ${strings('releaseInfo.note')}

                          +

                          ${language.$('releaseInfo.note')}

                          ${transformMultiline(contextNotes)}

                          `} - ${urls?.length && `

                          ${strings('releaseInfo.visitOn', { + ${urls?.length && `

                          ${language.$('releaseInfo.visitOn', { links: strings.list.or(urls.map(url => fancifyURL(url, {strings}))) })}

                          `} - ${hasGallery && `

                          ${strings('artistPage.viewArtGallery', { + ${hasGallery && `

                          ${language.$('artistPage.viewArtGallery', { link: link.artistGallery(artist, { - text: strings('artistPage.viewArtGallery.link') + text: language.$('artistPage.viewArtGallery.link') }) })}

                          `} -

                          ${strings('misc.jumpTo.withLinks', { +

                          ${language.$('misc.jumpTo.withLinks', { links: strings.list.unit([ - allTracks.length && `${strings('artistPage.trackList.title')}`, - artThingsAll.length && `${strings('artistPage.artList.title')}`, - wikiInfo.enableFlashesAndGames && flashes.length && `${strings('artistPage.flashList.title')}`, - commentaryThings.length && `${strings('artistPage.commentaryList.title')}` + allTracks.length && `${language.$('artistPage.trackList.title')}`, + artThingsAll.length && `${language.$('artistPage.artList.title')}`, + wikiInfo.enableFlashesAndGames && flashes.length && `${language.$('artistPage.flashList.title')}`, + commentaryThings.length && `${language.$('artistPage.commentaryList.title')}` ].filter(Boolean)) })}

                          ${allTracks.length && fixWS` -

                          ${strings('artistPage.trackList.title')}

                          -

                          ${strings('artistPage.contributedDurationLine', { +

                          ${language.$('artistPage.trackList.title')}

                          +

                          ${language.$('artistPage.contributedDurationLine', { artist: artist.name, duration: strings.count.duration(totalDuration, {approximate: true, unit: true}) })}

                          -

                          ${strings('artistPage.musicGroupsLine', { +

                          ${language.$('artistPage.musicGroupsLine', { groups: strings.list.unit(musicGroups - .map(({ group, contributions }) => strings('artistPage.groupsLine.item', { + .map(({ group, contributions }) => language.$('artistPage.groupsLine.item', { group: link.groupInfo(group), contributions: language.countContributions(contributions) }))) @@ -331,22 +331,22 @@ export function write(artist, {wikiData}) { ${generateTrackList(trackListChunks)} `} ${artThingsAll.length && fixWS` -

                          ${strings('artistPage.artList.title')}

                          - ${hasGallery && `

                          ${strings('artistPage.viewArtGallery.orBrowseList', { +

                          ${language.$('artistPage.artList.title')}

                          + ${hasGallery && `

                          ${language.$('artistPage.viewArtGallery.orBrowseList', { link: link.artistGallery(artist, { - text: strings('artistPage.viewArtGallery.link') + text: language.$('artistPage.viewArtGallery.link') }) })}

                          `} -

                          ${strings('artistPage.artGroupsLine', { +

                          ${language.$('artistPage.artGroupsLine', { groups: strings.list.unit(artGroups - .map(({ group, contributions }) => strings('artistPage.groupsLine.item', { + .map(({ group, contributions }) => language.$('artistPage.groupsLine.item', { group: link.groupInfo(group), contributions: language.countContributions(contributions) }))) })}

                          ${artListChunks.map(({date, album, chunk}) => fixWS` -
                          ${strings('artistPage.creditList.album.withDate', { +
                          ${language.$('artistPage.creditList.album.withDate', { album: link.album(album), date: strings.count.date(date) })}
                          @@ -354,10 +354,10 @@ export function write(artist, {wikiData}) { ${(chunk .map(({album, track, key, ...props}) => ({ entry: (track - ? strings('artistPage.creditList.entry.track', { + ? language.$('artistPage.creditList.entry.track', { track: link.track(track) }) - : `${strings('artistPage.creditList.entry.album.' + { + : `${language.$('artistPage.creditList.entry.album.' + { wallpaperArtistContribs: 'wallpaperArt', bannerArtistContribs: 'bannerArt', coverArtistContribs: 'coverArt' @@ -372,17 +372,17 @@ export function write(artist, {wikiData}) {
                          `} ${wikiInfo.enableFlashesAndGames && flashes.length && fixWS` -

                          ${strings('artistPage.flashList.title')}

                          +

                          ${language.$('artistPage.flashList.title')}

                          ${flashListChunks.map(({act, chunk, dateFirst, dateLast}) => fixWS` -
                          ${strings('artistPage.creditList.flashAct.withDateRange', { +
                          ${language.$('artistPage.creditList.flashAct.withDateRange', { act: link.flash(chunk[0].flash, {text: act.name}), dateRange: strings.count.dateRange([dateFirst, dateLast]) })}
                            ${(chunk .map(({flash, ...props}) => ({ - entry: strings('artistPage.creditList.entry.flash', { + entry: language.$('artistPage.creditList.entry.flash', { flash: link.flash(flash) }), ...props @@ -395,19 +395,19 @@ export function write(artist, {wikiData}) {
                          `} ${commentaryThings.length && fixWS` -

                          ${strings('artistPage.commentaryList.title')}

                          +

                          ${language.$('artistPage.commentaryList.title')}

                          ${commentaryListChunks.map(({album, chunk}) => fixWS` -
                          ${strings('artistPage.creditList.album', { +
                          ${language.$('artistPage.creditList.album', { album: link.album(album) })}
                            ${(chunk .map(({album, track, ...props}) => track - ? strings('artistPage.creditList.entry.track', { + ? language.$('artistPage.creditList.entry.track', { track: link.track(track) }) - : `${strings('artistPage.creditList.entry.album.commentary')}`) + : `${language.$('artistPage.creditList.entry.album.commentary')}`) .map(row => `
                          • ${row}
                          • `) .join('\n'))}
                          @@ -439,13 +439,13 @@ export function write(artist, {wikiData}) { strings, to }) => ({ - title: strings('artistGalleryPage.title', {artist: name}), + title: language.$('artistGalleryPage.title', {artist: name}), main: { classes: ['top-index'], content: fixWS` -

                          ${strings('artistGalleryPage.title', {artist: name})}

                          -

                          ${strings('artistGalleryPage.infoLine', { +

                          ${language.$('artistGalleryPage.title', {artist: name})}

                          +

                          ${language.$('artistGalleryPage.infoLine', { coverArts: language.countCoverArts(artThingsGallery.length, {unit: true}) })}

                          @@ -497,10 +497,10 @@ function generateNavForArtist(artist, isGallery, hasGallery, { wikiInfo.enableListings && { path: ['localized.listingIndex'], - title: strings('listingIndex.title') + title: language.$('listingIndex.title') }, { - html: strings('artistPage.nav.artist', { + html: language.$('artistPage.nav.artist', { artist: link.artist(artist, {class: 'current'}) }) }, diff --git a/src/page/flash.js b/src/page/flash.js index 54653a00..5e027f70 100644 --- a/src/page/flash.js +++ b/src/page/flash.js @@ -36,20 +36,20 @@ export function write(flash, {wikiData}) { strings, transformInline }) => ({ - title: strings('flashPage.title', {flash: flash.name}), + title: language.$('flashPage.title', {flash: flash.name}), theme: getThemeString(flash.color, [ `--flash-directory: ${flash.directory}` ]), main: { content: fixWS` -

                          ${strings('flashPage.title', {flash: flash.name})}

                          +

                          ${language.$('flashPage.title', {flash: flash.name})}

                          ${generateCoverLink({ src: getFlashCover(flash), - alt: strings('misc.alt.flashArt') + alt: language.$('misc.alt.flashArt') })} -

                          ${strings('releaseInfo.released', {date: strings.count.date(flash.date)})}

                          - ${(flash.page || flash.urls?.length) && `

                          ${strings('releaseInfo.playOn', { +

                          ${language.$('releaseInfo.released', {date: strings.count.date(flash.date)})}

                          + ${(flash.page || flash.urls?.length) && `

                          ${language.$('releaseInfo.playOn', { links: strings.list.or([ flash.page && getFlashLink(flash), ...flash.urls ?? [] @@ -59,10 +59,10 @@ export function write(flash, {wikiData}) {

                          Tracks featured in ${flash.name.replace(/\.$/, '')}:

                            ${(flash.featuredTracks - .map(track => strings('trackList.item.withArtists', { + .map(track => language.$('trackList.item.withArtists', { track: link.track(track), by: `${ - strings('trackList.item.withArtists.by', { + language.$('trackList.item.withArtists.by', { artists: getArtistString(track.artistContribs) }) }` @@ -72,7 +72,7 @@ export function write(flash, {wikiData}) {
                          `} ${flash.contributorContribs.length && fixWS` -

                          ${strings('releaseInfo.contributors')}

                          +

                          ${language.$('releaseInfo.contributors')}

                            ${flash.contributorContribs .map(contrib => `
                          • ${getArtistString([contrib], { @@ -111,14 +111,14 @@ export function writeTargetless({wikiData}) { link, strings }) => ({ - title: strings('flashIndex.title'), + title: language.$('flashIndex.title'), main: { classes: ['flash-index'], content: fixWS` -

                            ${strings('flashIndex.title')}

                            +

                            ${language.$('flashIndex.title')}

                            -

                            ${strings('misc.jumpTo')}

                            +

                            ${language.$('misc.jumpTo')}

                              ${flashActData.filter(act => act.jump).map(({ anchor, jump, jumpColor }) => fixWS`
                            • ${jump}
                            • @@ -165,10 +165,10 @@ function generateNavForFlash(flash, { {toHome: true}, { path: ['localized.flashIndex'], - title: strings('flashIndex.title') + title: language.$('flashIndex.title') }, { - html: strings('flashPage.nav.flash', { + html: language.$('flashPage.nav.flash', { flash: link.flash(flash, {class: 'current'}) }) }, @@ -211,7 +211,7 @@ function generateSidebarForFlash(flash, {link, strings, wikiData}) { return { content: fixWS` -

                              ${link.flashIndex('', {text: strings('flashIndex.title')})}

                              +

                              ${link.flashIndex('', {text: language.$('flashIndex.title')})}

                              ${flashActData.filter(act => act.name.startsWith('Act 1') || diff --git a/src/page/group.js b/src/page/group.js index 7ffade67..53c792a4 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -42,44 +42,44 @@ export function write(group, {wikiData}) { strings, transformMultiline }) => ({ - title: strings('groupInfoPage.title', {group: group.name}), + title: language.$('groupInfoPage.title', {group: group.name}), theme: getThemeString(group.color), main: { content: fixWS` -

                              ${strings('groupInfoPage.title', {group: group.name})}

                              +

                              ${language.$('groupInfoPage.title', {group: group.name})}

                              ${group.urls?.length && `

                              ${ - strings('releaseInfo.visitOn', { + language.$('releaseInfo.visitOn', { links: strings.list.or(group.urls.map(url => fancifyURL(url, {strings}))) }) }

                              `}
                              ${transformMultiline(group.description)}
                              -

                              ${strings('groupInfoPage.albumList.title')}

                              +

                              ${language.$('groupInfoPage.albumList.title')}

                              ${ - strings('groupInfoPage.viewAlbumGallery', { + language.$('groupInfoPage.viewAlbumGallery', { link: link.groupGallery(group, { - text: strings('groupInfoPage.viewAlbumGallery.link') + text: language.$('groupInfoPage.viewAlbumGallery.link') }) }) }

                                ${albumLines.map(({ album, otherGroup }) => { const item = (album.date - ? strings('groupInfoPage.albumList.item', { + ? language.$('groupInfoPage.albumList.item', { year: album.date.getFullYear(), album: link.album(album) }) - : strings('groupInfoPage.albumList.item.withoutYear', { + : language.$('groupInfoPage.albumList.item.withoutYear', { album: link.album(album) })); return html.tag('li', (otherGroup - ? strings('groupInfoPage.albumList.item.withAccent', { + ? language.$('groupInfoPage.albumList.item.withAccent', { item, accent: html.tag('span', {class: 'other-group-accent'}, - strings('groupInfoPage.albumList.item.otherGroupAccent', { + language.$('groupInfoPage.albumList.item.otherGroupAccent', { group: link.groupInfo(otherGroup, {color: false}) })) }) @@ -118,15 +118,15 @@ export function write(group, {wikiData}) { link, strings }) => ({ - title: strings('groupGalleryPage.title', {group: group.name}), + title: language.$('groupGalleryPage.title', {group: group.name}), theme: getThemeString(group.color), main: { classes: ['top-index'], content: fixWS` -

                                ${strings('groupGalleryPage.title', {group: group.name})}

                                +

                                ${language.$('groupGalleryPage.title', {group: group.name})}

                                ${ - strings('groupGalleryPage.infoLine', { + language.$('groupGalleryPage.infoLine', { tracks: `${language.countTracks(tracks.length, {unit: true})}`, albums: `${language.countAlbums(albums.length, {unit: true})}`, time: `${strings.count.duration(totalDuration, {unit: true})}` @@ -134,9 +134,9 @@ export function write(group, {wikiData}) { }

                                ${wikiInfo.enableGroupUI && wikiInfo.enableListings && html.tag('p', {class: 'quick-info'}, - strings('groupGalleryPage.anotherGroupLine', { + language.$('groupGalleryPage.anotherGroupLine', { link: link.listing(listingSpec.find(l => l.directory === 'groups/by-category'), { - text: strings('groupGalleryPage.anotherGroupLine.link') + text: language.$('groupGalleryPage.anotherGroupLine.link') }) }) )} @@ -187,7 +187,7 @@ function generateGroupSidebar(currentGroup, isGallery, { return { content: fixWS` -

                                ${strings('groupSidebar.title')}

                                +

                                ${language.$('groupSidebar.title')}

                                ${groupCategoryData.map(category => html.tag('details', { open: category === currentGroup.category, @@ -195,7 +195,7 @@ function generateGroupSidebar(currentGroup, isGallery, { }, [ html.tag('summary', {style: getLinkThemeString(category.color)}, - strings('groupSidebar.groupList.category', { + language.$('groupSidebar.groupList.category', { category: `${category.name}` })), html.tag('ul', @@ -204,7 +204,7 @@ function generateGroupSidebar(currentGroup, isGallery, { class: group === currentGroup && 'current', style: getLinkThemeString(group.color) }, - strings('groupSidebar.groupList.item', { + language.$('groupSidebar.groupList.item', { group: link[linkKey](group) })))) ])).join('\n')} @@ -245,10 +245,10 @@ function generateGroupNav(currentGroup, isGallery, { wikiInfo.enableListings && { path: ['localized.listingIndex'], - title: strings('listingIndex.title') + title: language.$('listingIndex.title') }, { - html: strings('groupPage.nav.group', { + html: language.$('groupPage.nav.group', { group: link[linkKey](currentGroup, {class: 'current'}) }) }, diff --git a/src/page/homepage.js b/src/page/homepage.js index 8b470e9b..ed7d3442 100644 --- a/src/page/homepage.js +++ b/src/page/homepage.js @@ -84,14 +84,14 @@ export function writeTargetless({wikiData}) { // (even though that would 8e hilarious). content: (transformMultiline(homepageLayout.sidebarContent.replace('[[news]]', '__GENERATE_NEWS__')) .replace('

                                __GENERATE_NEWS__

                                ', wikiInfo.enableNews ? fixWS` -

                                ${strings('homepage.news.title')}

                                +

                                ${language.$('homepage.news.title')}

                                ${newsData.slice(0, 3).map((entry, i) => html.tag('article', {class: ['news-entry', i === 0 && 'first-news-entry']}, fixWS`

                                ${link.newsEntry(entry)}

                                ${transformMultiline(entry.contentShort)} ${entry.contentShort !== entry.content && link.newsEntry(entry, { - text: strings('homepage.news.entry.viewRest') + text: language.$('homepage.news.entry.viewRest') })} `)).join('\n')} ` : `

                                News requested in content description but this feature isn't enabled

                                `)) @@ -103,11 +103,11 @@ export function writeTargetless({wikiData}) { ${[ link.home('', {text: wikiInfo.nameShort, class: 'current', to}), wikiInfo.enableListings && - link.listingIndex('', {text: strings('listingIndex.title'), to}), + link.listingIndex('', {text: language.$('listingIndex.title'), to}), wikiInfo.enableNews && - link.newsIndex('', {text: strings('newsIndex.title'), to}), + link.newsIndex('', {text: language.$('newsIndex.title'), to}), wikiInfo.enableFlashesAndGames && - link.flashIndex('', {text: strings('flashIndex.title'), to}), + link.flashIndex('', {text: language.$('flashIndex.title'), to}), ...(staticPageData .filter(page => page.showInNavigationBar) .map(page => link.staticPage(page, {text: page.nameShort}))) diff --git a/src/page/listing.js b/src/page/listing.js index dbac4b73..efa3fdfd 100644 --- a/src/page/listing.js +++ b/src/page/listing.js @@ -47,11 +47,11 @@ export function write(listing, {wikiData}) { const titleKey = `listingPage.${listing.stringsKey}.title`; return { - title: strings(titleKey), + title: language.$(titleKey), main: { content: fixWS` -

                                ${strings(titleKey)}

                                +

                                ${language.$(titleKey)}

                                ${listing.html && (listing.data ? listing.html(data, opts) : listing.html(opts))} @@ -80,7 +80,7 @@ export function write(listing, {wikiData}) { {toHome: true}, { path: ['localized.listingIndex'], - title: strings('listingIndex.title') + title: language.$('listingIndex.title') }, {toCurrentPage: true} ] @@ -105,19 +105,19 @@ export function writeTargetless({wikiData}) { strings, link }) => ({ - title: strings('listingIndex.title'), + title: language.$('listingIndex.title'), main: { content: fixWS` -

                                ${strings('listingIndex.title')}

                                -

                                ${strings('listingIndex.infoLine', { +

                                ${language.$('listingIndex.title')}

                                +

                                ${language.$('listingIndex.infoLine', { wiki: wikiInfo.name, tracks: `${language.countTracks(trackData.length, {unit: true})}`, albums: `${language.countAlbums(albumData.length, {unit: true})}`, duration: `${strings.count.duration(totalDuration, {approximate: true, unit: true})}` })}


                                -

                                ${strings('listingIndex.exploreList')}

                                +

                                ${language.$('listingIndex.exploreList')}

                                ${generateLinkIndexForListings(null, false, {link, strings, wikiData})} ` }, @@ -147,7 +147,7 @@ function generateSidebarForListings(currentListing, { wikiData }) { return fixWS` -

                                ${link.listingIndex('', {text: strings('listingIndex.title')})}

                                +

                                ${link.listingIndex('', {text: language.$('listingIndex.title')})}

                                ${generateLinkIndexForListings(currentListing, true, { getLinkThemeString, link, @@ -175,7 +175,7 @@ function generateLinkIndexForListings(currentListing, forSidebar, { const genUL = listings => html.tag('ul', listings.map(listing => html.tag('li', {class: [listing === currentListing && 'current']}, - link.listing(listing, {text: strings(`listingPage.${listing.stringsKey}.title.short`)}) + link.listing(listing, {text: language.$(`listingPage.${listing.stringsKey}.title.short`)}) ))); if (forSidebar) { diff --git a/src/page/news.js b/src/page/news.js index 759bb93b..9951a2a8 100644 --- a/src/page/news.js +++ b/src/page/news.js @@ -24,13 +24,13 @@ export function write(entry, {wikiData}) { strings, transformMultiline, }) => ({ - title: strings('newsEntryPage.title', {entry: entry.name}), + title: language.$('newsEntryPage.title', {entry: entry.name}), main: { content: fixWS`
                                -

                                ${strings('newsEntryPage.title', {entry: entry.name})}

                                -

                                ${strings('newsEntryPage.published', {date: strings.count.date(entry.date)})}

                                +

                                ${language.$('newsEntryPage.title', {entry: entry.name})}

                                +

                                ${language.$('newsEntryPage.published', {date: strings.count.date(entry.date)})}

                                ${transformMultiline(entry.content)}
                                ` @@ -59,18 +59,18 @@ export function writeTargetless({wikiData}) { strings, transformMultiline }) => ({ - title: strings('newsIndex.title'), + title: language.$('newsIndex.title'), main: { content: fixWS`
                                -

                                ${strings('newsIndex.title')}

                                +

                                ${language.$('newsIndex.title')}

                                ${newsData.map(entry => fixWS`

                                ${link.newsEntry(entry)}

                                ${transformMultiline(entry.contentShort)} ${entry.contentShort !== entry.content && `

                                ${link.newsEntry(entry, { - text: strings('newsIndex.entry.viewRest') + text: language.$('newsIndex.entry.viewRest') })}

                                `}
                                `).join('\n')} @@ -108,10 +108,10 @@ function generateNewsEntryNav(entry, { {toHome: true}, { path: ['localized.newsIndex'], - title: strings('newsEntryPage.nav.news') + title: language.$('newsEntryPage.nav.news') }, { - html: strings('newsEntryPage.nav.entry', { + html: language.$('newsEntryPage.nav.entry', { date: strings.count.date(entry.date), entry: link.newsEntry(entry, {class: 'current'}) }) diff --git a/src/page/tag.js b/src/page/tag.js index 09d0beb9..af2e3942 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -37,14 +37,14 @@ export function write(tag, {wikiData}) { strings, to }) => ({ - title: strings('tagPage.title', {tag: tag.name}), + title: language.$('tagPage.title', {tag: tag.name}), theme: getThemeString(tag.color), main: { classes: ['top-index'], content: fixWS` -

                                ${strings('tagPage.title', {tag: tag.name})}

                                -

                                ${strings('tagPage.infoLine', { +

                                ${language.$('tagPage.title', {tag: tag.name})}

                                +

                                ${language.$('tagPage.infoLine', { coverArts: language.countCoverArts(things.length, {unit: true}) })}

                                @@ -92,10 +92,10 @@ function generateTagNav(tag, { wikiData.wikiInfo.enableListings && { path: ['localized.listingIndex'], - title: strings('listingIndex.title') + title: language.$('listingIndex.title') }, { - html: strings('tagPage.nav.tag', { + html: language.$('tagPage.nav.tag', { tag: link.tag(tag, {class: 'current'}) }) }, diff --git a/src/page/track.js b/src/page/track.js index c27b2b65..92a49ff0 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -52,14 +52,14 @@ export function write(track, {wikiData}) { const unbound_generateTrackList = (tracks, {getArtistString, link, strings}) => html.tag('ul', tracks.map(track => { - const line = strings('trackList.item.withArtists', { + const line = language.$('trackList.item.withArtists', { track: link.track(track), - by: `${strings('trackList.item.withArtists.by', { + by: `${language.$('trackList.item.withArtists.by', { artists: getArtistString(track.artistContribs) })}` }); return (track.aka - ? `
                              • ${strings('trackList.item.rerelease', {track: line})}
                              • ` + ? `
                              • ${language.$('trackList.item.rerelease', {track: line})}
                              • ` : `
                              • ${line}
                              • `); }) ); @@ -76,7 +76,7 @@ export function write(track, {wikiData}) { .filter(line => line.replace(/<\/b>/g, '').includes(':')) .map(line => fixWS` ${line} - ${strings('releaseInfo.artistCommentary.seeOriginalRelease', { + ${language.$('releaseInfo.artistCommentary.seeOriginalRelease', { original: link.track(track) })} `) @@ -140,7 +140,7 @@ export function write(track, {wikiData}) { const cover = getTrackCover(track); return { - title: strings('trackPage.title', {track: track.name}), + title: language.$('trackPage.title', {track: track.name}), stylesheet: getAlbumStylesheet(album, {to}), theme: getThemeString(track.color, [ `--album-directory: ${album.directory}`, @@ -153,7 +153,7 @@ export function write(track, {wikiData}) { classes: ['dim'], dimensions: album.bannerDimensions, path: ['media.albumBanner', album.directory, album.bannerFileExtension], - alt: strings('misc.alt.albumBanner'), + alt: language.$('misc.alt.albumBanner'), position: 'bottom' }, */ @@ -162,49 +162,49 @@ export function write(track, {wikiData}) { content: fixWS` ${cover && generateCoverLink({ src: cover, - alt: strings('misc.alt.trackCover'), + alt: language.$('misc.alt.trackCover'), tags: track.artTags })} -

                                ${strings('trackPage.title', {track: track.name})}

                                +

                                ${language.$('trackPage.title', {track: track.name})}

                                ${[ - strings('releaseInfo.by', { + language.$('releaseInfo.by', { artists: getArtistString(track.artistContribs, { showContrib: true, showIcons: true }) }), - track.coverArtistContribs.length && strings('releaseInfo.coverArtBy', { + track.coverArtistContribs.length && language.$('releaseInfo.coverArtBy', { artists: getArtistString(track.coverArtistContribs, { showContrib: true, showIcons: true }) }), - track.date && strings('releaseInfo.released', { + track.date && language.$('releaseInfo.released', { date: strings.count.date(track.date) }), (track.coverArtDate && +track.coverArtDate !== +track.date && - strings('releaseInfo.artReleased', { + language.$('releaseInfo.artReleased', { date: strings.count.date(track.coverArtDate) })), - track.duration && strings('releaseInfo.duration', { + track.duration && language.$('releaseInfo.duration', { duration: strings.count.duration(track.duration) }) ].filter(Boolean).join('
                                \n')}

                                ${ (track.urls?.length - ? strings('releaseInfo.listenOn', { + ? language.$('releaseInfo.listenOn', { links: strings.list.or(track.urls.map(url => fancifyURL(url, {strings}))) }) - : strings('releaseInfo.listenOn.noLinks')) + : language.$('releaseInfo.listenOn.noLinks')) }

                                ${otherReleases.length && fixWS` -

                                ${strings('releaseInfo.alsoReleasedAs')}

                                +

                                ${language.$('releaseInfo.alsoReleasedAs')}

                                  ${otherReleases.map(track => fixWS` -
                                • ${strings('releaseInfo.alsoReleasedAs.item', { +
                                • ${language.$('releaseInfo.alsoReleasedAs.item', { track: link.track(track), album: link.album(track.album) })}
                                • @@ -212,7 +212,7 @@ export function write(track, {wikiData}) {
                                `} ${track.contributorContribs.length && fixWS` -

                                ${strings('releaseInfo.contributors')}

                                +

                                ${language.$('releaseInfo.contributors')}

                                  ${(track.contributorContribs .map(contrib => `
                                • ${getArtistString([contrib], { @@ -223,19 +223,19 @@ export function write(track, {wikiData}) {
                                `} ${referencedTracks.length && fixWS` -

                                ${strings('releaseInfo.tracksReferenced', {track: `${track.name}`})}

                                +

                                ${language.$('releaseInfo.tracksReferenced', {track: `${track.name}`})}

                                ${generateTrackList(referencedTracks)} `} ${referencedByTracks.length && fixWS` -

                                ${strings('releaseInfo.tracksThatReference', {track: `${track.name}`})}

                                +

                                ${language.$('releaseInfo.tracksThatReference', {track: `${track.name}`})}

                                ${useDividedReferences && fixWS`
                                ${rbtOfficial.length && fixWS` -
                                ${strings('trackPage.referenceList.official')}
                                +
                                ${language.$('trackPage.referenceList.official')}
                                ${generateTrackList(rbtOfficial)}
                                `} ${rbtFanon.length && fixWS` -
                                ${strings('trackPage.referenceList.fandom')}
                                +
                                ${language.$('trackPage.referenceList.fandom')}
                                ${generateTrackList(rbtFanon)}
                                `}
                                @@ -243,28 +243,28 @@ export function write(track, {wikiData}) { ${!useDividedReferences && generateTrackList(referencedByTracks)} `} ${wikiInfo.enableFlashesAndGames && flashesThatFeature.length && fixWS` -

                                ${strings('releaseInfo.flashesThatFeature', {track: `${track.name}`})}

                                +

                                ${language.$('releaseInfo.flashesThatFeature', {track: `${track.name}`})}

                                  ${flashesThatFeature.map(({ flash, as }) => html.tag('li', {class: as !== track && 'rerelease'}, (as === track - ? strings('releaseInfo.flashesThatFeature.item', { + ? language.$('releaseInfo.flashesThatFeature.item', { flash: link.flash(flash) }) - : strings('releaseInfo.flashesThatFeature.item.asDifferentRelease', { + : language.$('releaseInfo.flashesThatFeature.item.asDifferentRelease', { flash: link.flash(flash), track: link.track(as) })))).join('\n')}
                                `} ${track.lyrics && fixWS` -

                                ${strings('releaseInfo.lyrics')}

                                +

                                ${language.$('releaseInfo.lyrics')}

                                ${transformLyrics(track.lyrics)}
                                `} ${hasCommentary && fixWS` -

                                ${strings('releaseInfo.artistCommentary')}

                                +

                                ${language.$('releaseInfo.artistCommentary')}

                                ${generateCommentary({link, strings, transformMultiline})}
                                @@ -289,12 +289,12 @@ export function write(track, {wikiData}) { title: album.name }, listTag === 'ol' ? { - html: strings('trackPage.nav.track.withNumber', { + html: language.$('trackPage.nav.track.withNumber', { number: album.tracks.indexOf(track) + 1, track: link.track(track, {class: 'current', to}) }) } : { - html: strings('trackPage.nav.track', { + html: language.$('trackPage.nav.track', { track: link.track(track, {class: 'current', to}) }) }, diff --git a/src/upd8.js b/src/upd8.js index 33c40677..d0df62fc 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -311,7 +311,7 @@ const replacerSpec = { 'string': { find: null, value: ref => ref, - html: (ref, {strings, args}) => strings(ref, args) + html: (ref, {strings, args}) => language.$(ref, args) }, 'tag': { find: 'artTag', @@ -1049,9 +1049,9 @@ writePage.html = (pageFn, { })}

                                -

                                ${strings('releaseInfo.from', {album: ''})}

                                -

                                ${strings('releaseInfo.by', {artists: ''})}

                                -

                                ${strings('releaseInfo.coverArtBy', {artists: ''})}

                                +

                                ${language.$('releaseInfo.from', {album: ''})}

                                +

                                ${language.$('releaseInfo.by', {artists: ''})}

                                +

                                ${language.$('releaseInfo.coverArtBy', {artists: ''})}

                          @@ -1087,14 +1087,14 @@ writePage.html = (pageFn, { ${mainHTML && fixWS`
                          ${[ - ['#content', strings('misc.skippers.skipToContent')], + ['#content', language.$('misc.skippers.skipToContent')], sidebarLeftHTML && ['#sidebar-left', (sidebarRightHTML - ? strings('misc.skippers.skipToSidebar.left') - : strings('misc.skippers.skipToSidebar'))], + ? language.$('misc.skippers.skipToSidebar.left') + : language.$('misc.skippers.skipToSidebar'))], sidebarRightHTML && ['#sidebar-right', (sidebarLeftHTML - ? strings('misc.skippers.skipToSidebar.right') - : strings('misc.skippers.skipToSidebar'))], - footerHTML && ['#footer', strings('misc.skippers.skipToFooter')] + ? language.$('misc.skippers.skipToSidebar.right') + : language.$('misc.skippers.skipToSidebar'))], + footerHTML && ['#footer', language.$('misc.skippers.skipToFooter')] ].filter(Boolean).map(([ href, title ]) => fixWS` ${title} `).join('\n')} @@ -1201,7 +1201,7 @@ function generateRedirectPage(title, target, {strings}) { - ${strings('redirectPage.title', {title})} + ${language.$('redirectPage.title', {title})} @@ -1209,8 +1209,8 @@ function generateRedirectPage(title, target, {strings}) {
                          -

                          ${strings('redirectPage.title', {title})}

                          -

                          ${strings('redirectPage.infoLine', { +

                          ${language.$('redirectPage.title', {title})}

                          +

                          ${language.$('redirectPage.infoLine', { target: `${target}` })}

                          diff --git a/src/util/strings.js b/src/util/strings.js index c596bd89..835e4055 100644 --- a/src/util/strings.js +++ b/src/util/strings.js @@ -22,8 +22,8 @@ import { bindOpts } from './sugar.js'; // look like a dictionary each value of which is itself a util dictionary, // each value of which is a function in the format (value, opts) => (...). // Each of those util dictionaries will 8e attached to the final returned -// strings() function, containing functions which automatically have that -// same strings() function provided as part of its opts argument (alongside +// language.$() function, containing functions which automatically have that +// same language.$() function provided as part of its opts argument (alongside // any additional arguments passed). // // Basically, it's so that instead of doing: @@ -193,7 +193,7 @@ export function genStrings(stringsJSON, { return strings; } -const countHelper = (stringKey, argName = stringKey) => (value, {strings, unit = false}) => strings( +const countHelper = (stringKey, argName = stringKey) => (value, {strings, unit = false}) => language.$( (unit ? `count.${stringKey}.withUnit.` + strings.intl.plural.cardinal.select(value) : `count.${stringKey}`), @@ -222,10 +222,10 @@ export const count = { : value); const words = (value > 1000 - ? strings('count.words.thousand', {words: num}) - : strings('count.words', {words: num})); + ? language.$('count.words.thousand', {words: num}) + : language.$('count.words', {words: num})); - return strings('count.words.withUnit.' + strings.intl.plural.cardinal.select(value), {words}); + return language.$('count.words.withUnit.' + strings.intl.plural.cardinal.select(value), {words}); }, albums: countHelper('albums'), -- cgit 1.3.0-6-gf8a5