Skip to content

Commit

Permalink
Merge pull request #563 from 1fbr/fix-missing-i18n
Browse files Browse the repository at this point in the history
fix: add missing i18n text in components
  • Loading branch information
tomalaforge authored Feb 4, 2024
2 parents c729629 + 82acb4d commit c079542
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/src/components/ActionButtonFooter.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { data } = await getEntry('i18n', lang);

<div class="action-footer">
<a class="action-button" href="/subscription">
<div>Email subscription</div>
<div>{data['buttons.email']}</div>
<Icon name="email" size="1rem" />
</a>

Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/ChallengeFooter.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const npxCommand = `npx nx serve ${command}`;
<p>{data['challenge.footer.gettingStarted.title']} <a
href="/guides/getting-started">{data['challenge.footer.gettingStarted.link']}</a>.</p>
<p>{data['challenge.footer.running']} <code class="code" dir="auto">{npxCommand}
<ClipboardCopy copyText={npxCommand} />
<ClipboardCopy copyText={npxCommand} {...Astro.props} />
</code></p>
</section>
</aside>
Expand Down Expand Up @@ -71,7 +71,7 @@ const npxCommand = `npx nx serve ${command}`;
</div>

<div class="footer-note">
* You can upvote an answer with a 👍 if you like it
* {data['challenge.footer.upvoteAnswer']}
</div>

<style>
Expand Down
9 changes: 7 additions & 2 deletions docs/src/components/ClipboardCopy.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
const { copyText } = Astro.props;
import { getEntry } from "astro:content";
const { copyText, lang } = Astro.props;
const { data } = await getEntry('i18n', lang);
---

<span class="copy-container">
Expand Down Expand Up @@ -32,7 +35,9 @@ const { copyText } = Astro.props;
d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"
></path></svg
>
<span class="tooltipText triangle">Copied!</span>
<span class="tooltipText triangle">
{data['buttons.clipboardCopy']}
</span>
</span>

<script define:vars={{ copyText }}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/SubscriptionForm.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { data } = await getEntry('i18n', lang ?? 'en');
<form novalidate="" class="sp-element-container ">
<div class="sp-field " sp-id="sp-76dfa588-3af2-4619-b685-835cf8c62ef0">
<input
type="email" sp-type="email" name="sform[email]" class="sp-form-control " placeholder="username@gmail.com"
type="email" sp-type="email" name="sform[email]" class="sp-form-control " placeholder={data['subscription.email']}
sp-tips="%7B%22required%22%3A%22Required%20field%22%2C%22wrong%22%3A%22Wrong%20email%22%7D" autocomplete="on"
required="required"></div>
<div class="sp-field sp-button-container " sp-id="sp-82642eda-e68f-4b7a-a2b8-69e9d9bb5c99">
Expand Down
7 changes: 5 additions & 2 deletions docs/src/components/VideoButton.astro
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
import { getEntry } from 'astro:content';
interface Props {
lang: any;
link: string;
alt: string;
flag?: 'FR';
}
const { link, alt, flag } = Astro.props;
const { link, alt, flag, lang } = Astro.props;
const { data } = await getEntry('i18n', lang);
const isFR = flag === 'FR';
---

Expand All @@ -16,6 +19,6 @@ const isFR = flag === 'FR';
rel="noopener noreferrer"
alt={alt}>
<svg aria-hidden="true" class="astro-yzt5nm4y astro-lq7oo3uf" width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M23.5 6.2A3 3 0 0 0 21.4 4c-1.9-.5-9.4-.5-9.4-.5s-7.5 0-9.4.5A3 3 0 0 0 .5 6.3C0 8 0 12 0 12s0 4 .5 5.8A3 3 0 0 0 2.6 20c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2c.5-2 .5-5.9.5-5.9s0-4-.5-5.8zm-14 9.4V8.4l6.3 3.6-6.3 3.6z"></path></svg>
Video
{data['challenge.footer.video']}
{isFR && <span class="flag">🇫🇷</span>}
</a>
5 changes: 5 additions & 0 deletions docs/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,23 @@ const i18n = defineCollection({
.object({
'page.title.challenge': z.string(),
'author.createdBy': z.string(),
'buttons.email': z.string(),
'buttons.star': z.string(),
'buttons.sponsor': z.string(),
'buttons.clipboardCopy': z.string(),
'challenge.footer.note': z.string(),
'challenge.footer.running': z.string(),
'challenge.footer.start': z.string(),
'challenge.footer.reminder': z.string(),
'challenge.footer.communityAnswers': z.string(),
'challenge.footer.authorAnswer': z.string(),
'challenge.footer.blogPost': z.string(),
'challenge.footer.video': z.string(),
'challenge.footer.gettingStarted.title': z.string(),
'challenge.footer.gettingStarted.link': z.string(),
'challenge.footer.upvoteAnswer': z.string(),
'subscription.button': z.string(),
'subscription.email': z.string(),
'subscription.note.title': z.string(),
'subscription.note.description': z.string(),
})
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
{
"page.title.challenge": "Challenge",
"author.createdBy": "Created by",
"buttons.email": "Email subscription",
"buttons.star": "Give a star",
"buttons.sponsor": "Sponsor",
"buttons.clipboardCopy": "Copied!",
"challenge.footer.note": "Note",
"challenge.footer.running": "Start the project by executing:",
"challenge.footer.start": "The title of your PR must begin with",
"challenge.footer.reminder": "Reminder",
"challenge.footer.communityAnswers": "Community solutions",
"challenge.footer.authorAnswer": "Author's solution",
"challenge.footer.blogPost": "Article",
"challenge.footer.video": "Video",
"challenge.footer.gettingStarted.title": "To complete this challenge, start by reading: ",
"challenge.footer.gettingStarted.link": "Getting started",
"challenge.footer.upvoteAnswer": "You can upvote an answer with a 👍 if you like it",
"subscription.button": "Subscribe",
"subscription.email": "username@gmail.com",
"subscription.note.title": "Notes",
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
"pagefind.searching": "Buscando [SEARCH_TERM]...",
"page.title.challenge": "Reto",
"author.createdBy": "Creado por",
"buttons.email": "Suscripción por correo",
"buttons.star": "Danos una estrella",
"buttons.sponsor": "Patrocínanos",
"buttons.clipboardCopy": "Copiado!",
"note": "Nota",
"running": "Inicia el proyecto ejecutando el siguiente comando:",
"start": "El título de tu PR debe iniciar con",
Expand All @@ -50,8 +52,10 @@
"challenge.footer.communityAnswers": "Respuestas de la comunidad",
"challenge.footer.authorAnswer": "Respuesta del autor",
"challenge.footer.blogPost": "Artículo",
"challenge.footer.video": "Vídeo",
"challenge.footer.gettingStarted.title": "Para realizar este desafío, comienza por leer: ",
"challenge.footer.gettingStarted.link": "Inicio",
"challenge.footer.upvoteAnswer": "Puedes votar positivo una respuesta con un 👍 si te gusta",
"subscription.button": "Suscríbete",
"subscription.email": "usuario@gmail.com",
"subscription.note.title": "Notas",
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/i18n/fr.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
{
"page.title.challenge": "Challenge",
"author.createdBy": "Créé par",
"buttons.email": "Email subscription",
"buttons.star": "Donne une étoile",
"buttons.sponsor": "Sponsorise",
"buttons.clipboardCopy": "Copied!",
"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.video": "Video",
"challenge.footer.gettingStarted.title": "Pour faire ce challenge, commencer par lire: ",
"challenge.footer.gettingStarted.link": "Comment Démarrer",
"challenge.footer.upvoteAnswer": "You can upvote an answer with a 👍 if you like it",
"subscription.button": "Subscribe",
"subscription.email": "username@gmail.com",
"subscription.note.title": "Notes",
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/i18n/pt.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"page.title.challenge": "Desafio",
"author.createdBy": "Criado por",
"buttons.email": "Email subscription",
"buttons.star": "Dar uma estrela",
"buttons.sponsor": "Patrocinar",
"buttons.clipboardCopy": "Copied!",
"404.text": "Página não encontrada. Verifique a URL ou tente usar a barra de busca.",
"challenge.footer.note": "Nota",
"challenge.footer.running": "Rode o projeto executando o comando:",
Expand All @@ -11,8 +13,10 @@
"challenge.footer.communityAnswers": "Solução da Comunidade",
"challenge.footer.authorAnswer": "Solução do Autor do Desafio",
"challenge.footer.blogPost": "Artigo",
"challenge.footer.video": "Video",
"challenge.footer.gettingStarted.title": "Para realizar este desafio, comece lendo: ",
"challenge.footer.gettingStarted.link": "Começando",
"challenge.footer.upvoteAnswer": "You can upvote an answer with a 👍 if you like it",
"subscription.button": "Inscrever-se",
"subscription.email": "usuario@gmail.com",
"subscription.note.title": "Notas",
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/i18n/ru.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"page.title.challenge": "Испытание",
"author.createdBy": "Создано",
"buttons.email": "Email subscription",
"buttons.star": "Дать звезду",
"buttons.sponsor": "Спонсор",
"buttons.clipboardCopy": "Copied!",
"404.text": "Страница не найдена. Проверьте URL-адрес или воспользуйтесь строкой поиска.",
"challenge.footer.note": "Примечание",
"challenge.footer.running": "Запустите проект, выполнив команду:",
Expand All @@ -11,8 +13,10 @@
"challenge.footer.communityAnswers": "Решения сообщества",
"challenge.footer.authorAnswer": "Решение автора",
"challenge.footer.blogPost": "Статья",
"challenge.footer.video": "Video",
"challenge.footer.gettingStarted.title": "Чтобы пройти это испытание, прочитайте:",
"challenge.footer.gettingStarted.link": "Первые шаги",
"challenge.footer.upvoteAnswer": "You can upvote an answer with a 👍 if you like it",
"subscription.button": "Subscribe",
"subscription.email": "username@gmail.com",
"subscription.note.title": "Notes",
Expand Down

0 comments on commit c079542

Please sign in to comment.