diff --git a/src/components/AppLayout/components/AppLayoutDescription.astro b/src/components/AppLayout/components/AppLayoutDescription.astro index 95204e4..989ef73 100644 --- a/src/components/AppLayout/components/AppLayoutDescription.astro +++ b/src/components/AppLayout/components/AppLayoutDescription.astro @@ -4,9 +4,10 @@ import type { RichTextContent } from "src/shared/payload/payload-sdk"; interface Props { description: RichTextContent | string; + lang?: string | undefined; } -const { description } = Astro.props; +const { description, lang } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */} @@ -16,7 +17,7 @@ const { description } = Astro.props; typeof description === "string" ? (

) : ( - + ) } diff --git a/src/components/AppLayout/components/AppLayoutTitle.astro b/src/components/AppLayout/components/AppLayoutTitle.astro index e9cd8db..c715427 100644 --- a/src/components/AppLayout/components/AppLayoutTitle.astro +++ b/src/components/AppLayout/components/AppLayoutTitle.astro @@ -3,14 +3,15 @@ interface Props { pretitle?: string | undefined; title: string; subtitle?: string | undefined; + lang?: string | undefined; } -const { title, subtitle, pretitle } = Astro.props; +const { title, subtitle, pretitle, lang } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */} -

+

{ pretitle && ( diff --git a/src/components/AppLayout/components/Html.astro b/src/components/AppLayout/components/Html.astro index a57ec63..382fa78 100644 --- a/src/components/AppLayout/components/Html.astro +++ b/src/components/AppLayout/components/Html.astro @@ -52,6 +52,7 @@ const { currentTheme } = Astro.locals; "dark-theme": currentTheme === "dark", "texture-dots": !isIOS, "font-m": true, + "debug-lang": false, }}> @@ -150,6 +151,11 @@ const { currentTheme } = Astro.locals; {/* ------------------------------------------- CSS -------------------------------------------- */} diff --git a/src/components/Attributes.astro b/src/components/Attributes.astro index aaaefdd..b4169f1 100644 --- a/src/components/Attributes.astro +++ b/src/components/Attributes.astro @@ -32,6 +32,7 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n( @@ -42,6 +43,7 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n( @@ -52,10 +54,15 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n( ({ - name: getLocalizedMatch(translations).name, - ...(page ? { href: getLocalizedUrl(`/pages/${page.slug}`) } : {}), - }))} + lang={translation.language} + values={value.map(({ translations, page }) => { + const { name, language } = getLocalizedMatch(translations); + return { + name, + lang: language, + ...(page ? { href: getLocalizedUrl(`/pages/${page.slug}`) } : {}), + }; + })} /> ); diff --git a/src/components/Blocks/Block.astro b/src/components/Blocks/Block.astro index b87f742..eaa5556 100644 --- a/src/components/Blocks/Block.astro +++ b/src/components/Blocks/Block.astro @@ -11,18 +11,19 @@ import ErrorMessage from "components/ErrorMessage.astro"; interface Props { block: GenericBlock; + lang?: string | undefined; } -const { block } = Astro.props; +const { block, lang } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */} { isBlockLineBlock(block) ? ( - + ) : isBlockCueBlock(block) ? ( - + ) : ( - + {/* ------------------------------------------- CSS -------------------------------------------- */} diff --git a/src/components/Blocks/components/LineBlock.astro b/src/components/Blocks/components/LineBlock.astro index 9a87372..ebc8c28 100644 --- a/src/components/Blocks/components/LineBlock.astro +++ b/src/components/Blocks/components/LineBlock.astro @@ -4,17 +4,18 @@ import type { LineBlock } from "src/shared/payload/payload-sdk"; interface Props { block: LineBlock; + lang?: string | undefined; } -const { block } = Astro.props; +const { block, lang } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */}
-

{block.blockName}

+

{block.blockName}

- +
diff --git a/src/components/Credits.astro b/src/components/Credits.astro index ac841a2..08f06dc 100644 --- a/src/components/Credits.astro +++ b/src/components/Credits.astro @@ -15,16 +15,20 @@ const { getLocalizedMatch, getLocalizedUrl } = await getI18n(Astro.locals.curren
{ - credits.map(({ recorders, role: { icon, translations } }) => ( - ({ - name: username, - href: getLocalizedUrl(`/recorders/${id}`), - }))} - /> - )) + credits.map(({ recorders, role: { icon, translations } }) => { + const { language, name } = getLocalizedMatch(translations); + return ( + ({ + name: username, + href: getLocalizedUrl(`/recorders/${id}`), + }))} + /> + ); + }) }
diff --git a/src/components/HeaderTitle.astro b/src/components/HeaderTitle.astro index 5f7aad6..11c1f5c 100644 --- a/src/components/HeaderTitle.astro +++ b/src/components/HeaderTitle.astro @@ -2,36 +2,37 @@ interface Props { id?: string; header: number; + lang?: string | undefined; } -const { header, id } = Astro.props; +const { header, id, lang } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */} { header === 1 ? ( -

+

) : header === 2 ? ( -

+

) : header === 3 ? ( -

+

) : header === 4 ? ( -

+

) : header === 5 ? ( -
+
) : ( -
+
) diff --git a/src/components/InlineAttributes.astro b/src/components/InlineAttributes.astro index d15af8d..7f44664 100644 --- a/src/components/InlineAttributes.astro +++ b/src/components/InlineAttributes.astro @@ -32,6 +32,7 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n( @@ -42,6 +43,7 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n( @@ -52,10 +54,15 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n( ({ - name: getLocalizedMatch(translations).name, - ...(page ? { href: getLocalizedUrl(`/pages/${page.slug}`) } : {}), - }))} + lang={translation.language} + values={value.map(({ translations, page }) => { + const { name, language } = getLocalizedMatch(translations); + return { + name, + lang: language, + ...(page ? { href: getLocalizedUrl(`/pages/${page.slug}`) } : {}), + }; + })} /> ); diff --git a/src/components/InlineMetadata.astro b/src/components/InlineMetadata.astro index ff3a61e..7419b55 100644 --- a/src/components/InlineMetadata.astro +++ b/src/components/InlineMetadata.astro @@ -4,7 +4,7 @@ import type { Attribute } from "src/utils/attributes"; interface Props extends Attribute {} -const { icon, title, values } = Astro.props; +const { icon, title, values, lang: titleLang } = Astro.props; if (values.length === 0) return; --- @@ -14,9 +14,11 @@ if (values.length === 0) return;
-

{title}

+

{title}

+
+
+ {values.map(({ name, lang }) => {name})}
-
{values.map(({ name }) => name).join(", ")}
{/* ------------------------------------------- CSS -------------------------------------------- */} @@ -34,5 +36,11 @@ if (values.length === 0) return; color: var(--color-base-750); flex-shrink: 0; } + + & > #values { + & > span:not(:last-child)::after { + content: ", "; + } + } } diff --git a/src/components/Lightbox.astro b/src/components/Lightbox.astro index 4edb13b..88ecfef 100644 --- a/src/components/Lightbox.astro +++ b/src/components/Lightbox.astro @@ -23,6 +23,7 @@ interface Props { title: string; subtitle?: string | undefined; description?: RichTextContent | undefined; + lang?: string | undefined; attributes?: ComponentProps["attributes"] | undefined; metaAttributes?: ComponentProps["attributes"] | undefined; credits?: EndpointCredit[] | undefined; @@ -38,6 +39,7 @@ const { metaAttributes = [], credits = [], description, + lang, pretitle, title, subtitle, @@ -96,12 +98,14 @@ const hasNavigation = previousImageHref || nextImageHref;
{ smallTitle ? ( -

{title}

+

+ {title} +

) : ( - + ) } - {description && } + {description && }
{attributes.length > 0 && } {credits.length > 0 && } diff --git a/src/components/Metadata.astro b/src/components/Metadata.astro index 1475b00..8dc5187 100644 --- a/src/components/Metadata.astro +++ b/src/components/Metadata.astro @@ -4,7 +4,7 @@ import TitleIcon from "./TitleIcon.astro"; interface Props extends Attribute {} -const { icon, title, values, withBorder = true } = Astro.props; +const { icon, title, values, withBorder = true, lang: titleLang } = Astro.props; if (values.length === 0) return; --- @@ -12,16 +12,16 @@ if (values.length === 0) return; {/* ------------------------------------------- HTML ------------------------------------------- */}
- +
{ - values.map(({ name, href }) => + values.map(({ name, href, lang }) => href ? ( - + {name} ) : ( -
{name}
+
{name}
) ) } diff --git a/src/components/Previews/AudioPreview.astro b/src/components/Previews/AudioPreview.astro index 238c98e..61e1638 100644 --- a/src/components/Previews/AudioPreview.astro +++ b/src/components/Previews/AudioPreview.astro @@ -15,10 +15,10 @@ const { audio: { id, translations, attributes, filename, thumbnail, duration }, } = Astro.props; -const { pretitle, title, subtitle } = +const { pretitle, title, subtitle, language } = translations.length > 0 ? getLocalizedMatch(translations) - : { pretitle: undefined, title: filename, subtitle: undefined }; + : { pretitle: undefined, title: filename, subtitle: undefined, language: undefined }; const attributesWithMeta = [ ...attributes, @@ -36,6 +36,7 @@ const attributesWithMeta = [ pretitle={pretitle} title={title} subtitle={subtitle} + lang={language} thumbnail={thumbnail} href={getLocalizedUrl(`/audios/${id}`)} attributes={attributesWithMeta} diff --git a/src/components/Previews/CollectiblePreview.astro b/src/components/Previews/CollectiblePreview.astro index 33e6356..2303cd1 100644 --- a/src/components/Previews/CollectiblePreview.astro +++ b/src/components/Previews/CollectiblePreview.astro @@ -18,7 +18,7 @@ const { collectible: { slug, translations, thumbnail, attributes, languages, price, releaseDate }, } = Astro.props; -const { title, pretitle, subtitle } = getLocalizedMatch(translations); +const { title, pretitle, subtitle, language } = getLocalizedMatch(translations); const additionalAttributes: Attribute[] = []; @@ -65,6 +65,7 @@ if (price) { title={title} pretitle={pretitle} subtitle={subtitle} + lang={language} thumbnail={thumbnail} href={getLocalizedUrl(`/collectibles/${slug}`)} attributes={[...attributes, ...additionalAttributes]} diff --git a/src/components/Previews/GenericPreview.astro b/src/components/Previews/GenericPreview.astro index 0e0b61e..e8172f3 100644 --- a/src/components/Previews/GenericPreview.astro +++ b/src/components/Previews/GenericPreview.astro @@ -19,6 +19,7 @@ interface Props { pretitle?: string | undefined; title: string; subtitle?: string | undefined; + lang?: string | undefined; href?: string | undefined; attributes?: ComponentProps["attributes"]; disableRoundedTop?: boolean; @@ -40,6 +41,7 @@ const { disableRoundedTop = false, icon = "material-symbols:unknown-document", iconHoverLabel = t("global.previewTypes.unknown"), + lang, } = Astro.props; /* Clip the number of attributes such that the card isn't ridiculously long */ @@ -104,9 +106,11 @@ for (const attribute of attributes) {