diff --git a/docs/src/components/ActionButtonFooter.astro b/docs/src/components/ActionButtonFooter.astro index 1287bc0..e07b04f 100644 --- a/docs/src/components/ActionButtonFooter.astro +++ b/docs/src/components/ActionButtonFooter.astro @@ -2,8 +2,10 @@ import { Icon } from '@astrojs/starlight/components'; import MyIcon from './MyIcon.astro'; import type { Props } from '@astrojs/starlight/props'; +import { getEntry } from 'astro:content'; -const { labels } = Astro.props; +const { lang } = Astro.props; +const { data } = await getEntry('i18n', lang); --- diff --git a/docs/src/components/Author.astro b/docs/src/components/Author.astro index 5d77b5a..d2a8cb5 100644 --- a/docs/src/components/Author.astro +++ b/docs/src/components/Author.astro @@ -2,41 +2,46 @@ import { Icon } from '@astrojs/starlight/components'; interface Props { - name: string; - twitter?: string; + name: string; + twitter?: string; linkedin?: string; github?: string; labels?: Record; } -const { name, twitter, linkedin, github, labels } = Astro.props; - +const { name, twitter, linkedin, github, data } = Astro.props; ---

- {labels['author.createdBy']} {name} - {twitter && } - {linkedin && } - {github && } + {data['author.createdBy']} {name} + {twitter && + + } + {linkedin && + + } + {github && + + }

diff --git a/docs/src/components/ChallengeFooter.astro b/docs/src/components/ChallengeFooter.astro index a35e2dc..bb8f19e 100644 --- a/docs/src/components/ChallengeFooter.astro +++ b/docs/src/components/ChallengeFooter.astro @@ -1,11 +1,14 @@ --- import type { Props } from '@astrojs/starlight/props'; -import VideoButton from './VideoButton.astro' -import ClipboardCopy from './ClipboardCopy.astro' +import VideoButton from './VideoButton.astro'; +import ClipboardCopy from './ClipboardCopy.astro'; import { Icon } from '@astrojs/starlight/components'; +import { Debug } from 'astro:components'; +import { getCollection, getEntry } from 'astro:content'; -const { labels } = Astro.props; -const {author, challengeNumber, title, blogLink, videoLink, command} = Astro.props.entry.data; +const { lang } = Astro.props; +const { author, challengeNumber, title, blogLink, videoLink, command } = Astro.props.entry.data; +const { data } = await getEntry('i18n', lang); const authorLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challengeNumber}+label%3A"answer+author"`; const communityLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challengeNumber}+label%3Aanswer+sort%3Areactions-%2B1-desc`; @@ -14,60 +17,84 @@ const npxCommand = `npx nx serve ${command}`;
-{command && - -} - +{command && + + } + +
- ❖ {labels['challenge.footer.communityAnswers']}* + ❖ {data['challenge.footer.communityAnswers']}* - ▶︎ {labels['challenge.footer.authorAnswer']} + ▶︎ {data['challenge.footer.authorAnswer']} {blogLink && - - {labels['challenge.footer.blogPost']} + + {data['challenge.footer.blogPost']} } - {videoLink && } + {videoLink && + }
diff --git a/docs/src/components/Content.astro b/docs/src/components/Content.astro index fca586d..fc2a564 100644 --- a/docs/src/components/Content.astro +++ b/docs/src/components/Content.astro @@ -6,25 +6,30 @@ import Author from './Author.astro'; import ChallengeFooter from './ChallengeFooter.astro'; import CommentSection from './CommentSection.astro'; -const { labels } = Astro.props; +const { lang } = Astro.props; +const { data } = await getEntry('i18n', lang); const { challengeNumber } = Astro.props.entry.data; const author = Astro.props.entry.data.author ? await getEntry(Astro.props.entry.data.author) : null; const renderCommentSection = !Astro.props.entry.data.noCommentSection; - --- -{ challengeNumber && author && } +{ challengeNumber && author && + } - + + + -{challengeNumber && } +{challengeNumber && +} -{ renderCommentSection && } +{ renderCommentSection && + } diff --git a/docs/src/components/PageTitle.astro b/docs/src/components/PageTitle.astro index f32a28e..6f2cd72 100644 --- a/docs/src/components/PageTitle.astro +++ b/docs/src/components/PageTitle.astro @@ -1,39 +1,44 @@ --- +import { getEntry } from 'astro:content'; import type { Props } from '@astrojs/starlight/props'; import Default from '@astrojs/starlight/components/PageTitle.astro'; const { challengeNumber } = Astro.props.entry.data; -const { labels } = Astro.props; +const { lang } = Astro.props; +const { data } = await getEntry('i18n', lang); ---
- - {challengeNumber &&
{labels['page.title.challenge']} #{challengeNumber}
} + + + + {challengeNumber && +
{data['page.title.challenge']} #{challengeNumber}
}
diff --git a/docs/src/content/config.ts b/docs/src/content/config.ts index 4fbdbcf..27cfa9b 100644 --- a/docs/src/content/config.ts +++ b/docs/src/content/config.ts @@ -47,10 +47,8 @@ const i18n = defineCollection({ 'challenge.footer.communityAnswers': z.string(), 'challenge.footer.authorAnswer': z.string(), 'challenge.footer.blogPost': z.string(), - 'challenge.footer.gettingStarted': z.object({ - title: z.string(), - link: z.string(), - }), + 'challenge.footer.gettingStarted.title': z.string(), + 'challenge.footer.gettingStarted.link': z.string(), }) .partial(), }), diff --git a/docs/src/content/i18n/ fr.json b/docs/src/content/i18n/ fr.json deleted file mode 100644 index 410681e..0000000 --- a/docs/src/content/i18n/ fr.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "page.title.challenge": "Challenge", - "author.createdBy": "Créé par", - "buttons.star": "Donne une étoile", - "buttons.sponsor": "Sponsorise", - - "challenge.footer": { - "note": "Note", - "running": "Start the project by running:", - "start": "Your PR title must start with", - "reminder": "Reminder", - "communityAnswers": "Community Answers", - "authorAnswer": "Author Answer", - "blogPost": "Blog Post", - "gettingStarted": { - "title": "To do this challenge, start by reading: ", - "link": "Getting Started" - } - } -} diff --git a/docs/src/content/i18n/en.json b/docs/src/content/i18n/en.json index f54edce..fb97364 100644 --- a/docs/src/content/i18n/en.json +++ b/docs/src/content/i18n/en.json @@ -3,18 +3,13 @@ "author.createdBy": "Created by", "buttons.star": "Give a star", "buttons.sponsor": "Sponsor", - - "challenge.footer": { - "note": "Note", - "running": "Démarre le projet en exécutant:", - "start": "Le titre de ta PR doit commencer par", - "reminder": "Rappel", - "communityAnswers": "Solution de la communauté", - "authorAnswer": "Solution de l'auteur", - "blogPost": "Article", - "gettingStarted": { - "title": "Pour faire ce challenge, commencer par lire: ", - "link": "Comment Démarrer" - } - } + "challenge.footer.note": "Note", + "challenge.footer.running": "Démarre le projet en exécutant:", + "challenge.footer.start": "Le titre de ta PR doit commencer par", + "challenge.footer.reminder": "Rappel", + "challenge.footer.communityAnswers": "Solution de la communauté", + "challenge.footer.authorAnswer": "Solution de l'auteur", + "challenge.footer.blogPost": "Article", + "challenge.footer.gettingStarted.title": "Pour faire ce challenge, commencer par lire: ", + "challenge.footer.gettingStarted.link": "Comment Démarrer" } diff --git a/docs/src/content/i18n/ es.json b/docs/src/content/i18n/es.json similarity index 81% rename from docs/src/content/i18n/ es.json rename to docs/src/content/i18n/es.json index b49d051..d3e36bd 100644 --- a/docs/src/content/i18n/ es.json +++ b/docs/src/content/i18n/es.json @@ -19,11 +19,9 @@ "page.previousLink": "Anterior", "page.nextLink": "Siguiente", "404.text": "Página no encontrada. Por favor revisa la URL o intenta utilizando la barra de búsqueda.", - "expressiveCode.copyButtonCopied": "Copiado!", "expressiveCode.copyButtonTooltip": "Copiar al portapapeles", "expressiveCode.terminalWindowFallbackTitle": "Ventana de terminal", - "pagefind.clear_search": "Borrar", "pagefind.load_more": "Cargar más resultados", "pagefind.search_label": "Buscar en este sitio", @@ -34,12 +32,10 @@ "pagefind.alt_search": "Sin resultados para tu búsqueda de [SEARCH_TERM]. Te estamos mostrando resultados para [DIFFERENT_TERM]", "pagefind.search_suggestion": "Sin resultados para tu búsqueda de [SEARCH_TERM]. Intenta alguna de las siguientes búsquedas:", "pagefind.searching": "Buscando [SEARCH_TERM]...", - "page.title.challenge": "Reto", "author.createdBy": "Creado por", "buttons.star": "Danos una estrella", "buttons.sponsor": "Patrocínanos", - "note": "Nota", "running": "Inicia el proyecto ejecutando el siguiente comando:", "start": "El título de tu PR debe iniciar con", @@ -47,18 +43,13 @@ "communityAnswers": "Respuestas de la Comunidad", "authorAnswer": "Respuesta del Autor del Reto", "blogPost": "Blog Post", - - "challenge.footer": { - "note": "Nota", - "running": "Inicia el proyecto ejecutando el siguiente comando:", - "start": "El título de tu PR debe iniciar con", - "reminder": "¡No lo olvides!", - "communityAnswers": "Respuestas de la Comunidad", - "authorAnswer": "Respuesta del Autor del Reto", - "blogPost": "Blog Post", - "gettingStarted": { - "title": "Para realizar este desafío, comienza por leer: ", - "link": "Inicio" - } - } + "challenge.footer.note": "Nota", + "challenge.footer.running": "Inicia el proyecto ejecutando el siguiente comando:", + "challenge.footer.start": "El título de tu PR debe iniciar con", + "challenge.footer.reminder": "¡No lo olvides!", + "challenge.footer.communityAnswers": "Respuestas de la Comunidad", + "challenge.footer.authorAnswer": "Respuesta del Autor del Reto", + "challenge.footer.blogPost": "Blog Post", + "challenge.footer.gettingStarted.title": "Para realizar este desafío, comienza por leer: ", + "challenge.footer.gettingStarted.link": "Inicio" } diff --git a/docs/src/content/i18n/fr.json b/docs/src/content/i18n/fr.json new file mode 100644 index 0000000..86ad5c9 --- /dev/null +++ b/docs/src/content/i18n/fr.json @@ -0,0 +1,15 @@ +{ + "page.title.challenge": "Challenge", + "author.createdBy": "Créé par", + "buttons.star": "Donne une étoile", + "buttons.sponsor": "Sponsorise", + "challenge.footer.note": "Note", + "challenge.footer.running": "Start the project by running:", + "challenge.footer.start": "Your PR title must start with", + "challenge.footer.reminder": "Reminder", + "challenge.footer.communityAnswers": "Community Answers", + "challenge.footer.authorAnswer": "Author Answer", + "challenge.footer.blogPost": "Blog Post", + "challenge.footer.gettingStarted.title": "To do this challenge, start by reading: ", + "challenge.footer.gettingStarted.link": "Getting Started" +} diff --git a/docs/src/content/i18n/pt.json b/docs/src/content/i18n/pt.json index 30fcda5..47063c4 100644 --- a/docs/src/content/i18n/pt.json +++ b/docs/src/content/i18n/pt.json @@ -3,20 +3,14 @@ "author.createdBy": "Criado por", "buttons.star": "Dar uma estrela", "buttons.sponsor": "Patrocinar", - "404.text": "Página não encontrada. Verifique a URL ou tente usar a barra de busca.", - - "challenge.footer": { - "note": "Nota", - "running": "Rode o projeto executando o comando:", - "start": "O título do seu PR deve começar com", - "reminder": "Não esqueça", - "communityAnswers": "Solução da Comunidade", - "authorAnswer": "Solução do Autor do Desafio", - "blogPost": "Artigo", - "gettingStarted": { - "title": "Para realizar este desafio, comece lendo: ", - "link": "Começando" - } - } + "challenge.footer.note": "Nota", + "challenge.footer.running": "Rode o projeto executando o comando:", + "challenge.footer.start": "O título do seu PR deve começar com", + "challenge.footer.reminder": "Não esqueça", + "challenge.footer.communityAnswers": "Solução da Comunidade", + "challenge.footer.authorAnswer": "Solução do Autor do Desafio", + "challenge.footer.blogPost": "Artigo", + "challenge.footer.gettingStarted.title": "Para realizar este desafio, comece lendo: ", + "challenge.footer.gettingStarted.link": "Começando" } diff --git a/docs/src/content/i18n/ru.json b/docs/src/content/i18n/ru.json index 3974f45..e322a0a 100644 --- a/docs/src/content/i18n/ru.json +++ b/docs/src/content/i18n/ru.json @@ -3,20 +3,14 @@ "author.createdBy": "Создано", "buttons.star": "Дать звезду", "buttons.sponsor": "Спонсор", - "404.text": "Страница не найдена. Проверьте URL-адрес или воспользуйтесь строкой поиска.", - - "challenge.footer": { - "note": "Примечание", - "running": "Запустите проект, выполнив команду:", - "start": "Название вашего PR должно начинаться со слов", - "reminder": "Не забудьте", - "communityAnswers": "Решения сообщества", - "authorAnswer": "Решение автора", - "blogPost": "Статья", - "gettingStarted": { - "title": "Чтобы пройти это испытание, прочитайте:", - "link": "Первые шаги" - } - } + "challenge.footer.note": "Примечание", + "challenge.footer.running": "Запустите проект, выполнив команду:", + "challenge.footer.start": "Название вашего PR должно начинаться со слов", + "challenge.footer.reminder": "Не забудьте", + "challenge.footer.communityAnswers": "Решения сообщества", + "challenge.footer.authorAnswer": "Решение автора", + "challenge.footer.blogPost": "Статья", + "challenge.footer.gettingStarted.title": "Чтобы пройти это испытание, прочитайте:", + "challenge.footer.gettingStarted.link": "Первые шаги" }