diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-06-14 22:10:12 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:12 -0300 |
commit | 99261a74b1f3298144d8c5c6d676d63ad27a1299 (patch) | |
tree | 953c14b248dbc1ead549d717369c6d6155d11f19 /src/content/dependencies/generateAlbumSidebarTrackSection.js | |
parent | 53b65bd2cbfb1001194d67f57780e92c6c8c5aaf (diff) |
content: encapsulate everything
Diffstat (limited to 'src/content/dependencies/generateAlbumSidebarTrackSection.js')
-rw-r--r-- | src/content/dependencies/generateAlbumSidebarTrackSection.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/content/dependencies/generateAlbumSidebarTrackSection.js b/src/content/dependencies/generateAlbumSidebarTrackSection.js index aa5c723d..d59218b8 100644 --- a/src/content/dependencies/generateAlbumSidebarTrackSection.js +++ b/src/content/dependencies/generateAlbumSidebarTrackSection.js @@ -55,10 +55,12 @@ export default { }, generate(data, relations, slots, {getColors, html, language}) { + const capsule = language.encapsulate('albumSidebar.trackList'); + const sectionName = html.tag('span', {class: 'group-name'}, (data.isDefaultTrackSection - ? language.$('albumSidebar.trackList.fallbackSectionName') + ? language.$(capsule, 'fallbackSectionName') : data.name)); let colorStyle; @@ -78,7 +80,7 @@ export default { data.tracksAreMissingCommentary[index] && {class: 'no-commentary'}, - language.$('albumSidebar.trackList.item', { + language.$(capsule, 'item', { track: (slots.mode === 'commentary' && data.tracksAreMissingCommentary[index] ? trackLink.slots({ @@ -117,14 +119,17 @@ export default { colorStyle, html.tag('span', - (data.hasTrackNumbers - ? language.$('albumSidebar.trackList.group.withRange', { - group: sectionName, - range: `${data.firstTrackNumber}–${data.lastTrackNumber}` - }) - : language.$('albumSidebar.trackList.group', { - group: sectionName, - })))), + language.encapsulate(capsule, 'group', capsule => { + const options = {group: sectionName}; + + if (data.hasTrackNumbers) { + capsule += '.withRange'; + options.range = + `${data.firstTrackNumber}–${data.lastTrackNumber}`; + } + + return language.$(capsule, options); + }))), (data.hasTrackNumbers ? html.tag('ol', |