Skip to content

Commit

Permalink
feat: add translations in caseStudies and Blog
Browse files Browse the repository at this point in the history
  • Loading branch information
AldemirLucas committed Dec 5, 2024
1 parent 36567b7 commit 19e126b
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 45 deletions.
48 changes: 25 additions & 23 deletions next/components/organisms/Blog/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,29 +365,31 @@ export function BlogGrid({ posts, category }) {
{categories?.[key] || t(key)}
</Text>

<Link
display="flex"
flexDirection="row"
href={`blog?category=${key}`}
gap="8px"
cursor="pointer"
textAlign="center"
fontWeight="400"
fontSize="16px"
lineHeight="24px"
color="#0068C5"
fill="#0068C5"
_hover={{
color: "#0057A4",
fill: "#0068C5"
}}
>
Ver todos
<ChevronIcon
alt=""
width="16px"
/>
</Link>
{value.length > 7 &&
<Link
display="flex"
flexDirection="row"
href={`blog?category=${key}`}
gap="8px"
cursor="pointer"
textAlign="center"
fontWeight="400"
fontSize="16px"
lineHeight="24px"
color="#0068C5"
fill="#0068C5"
_hover={{
color: "#0057A4",
fill: "#0068C5"
}}
>
{t("seeAll")}
<ChevronIcon
alt=""
width="16px"
/>
</Link>
}
</Stack>

<Grid gap="40px" templateColumns={{ md: "1fr 1fr", xl: "1fr 1fr 1fr" }}>
Expand Down
8 changes: 4 additions & 4 deletions next/pages/blog/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export default function Post({ slug, mdxSource, headings }) {
paddingX="24px"
>
<Head>
<title>{frontmatter.title}Blog – Base dos Dados</title>
<title>{frontmatter.title}{t("pageTitle")}</title>
<meta
property="og:title"
content={`${frontmatter.title}Blog – Base dos Dados`}
content={`${frontmatter.title}${t("pageTitle")}`}
key="ogtitle"
/>
<meta
Expand Down Expand Up @@ -155,7 +155,7 @@ export default function Post({ slug, mdxSource, headings }) {
fontWeight="400"
lineHeight="24px"
color="#252A32"
>Notou algo errado ou tem uma sugestão? </Text>
>{t("noticedSomething")} </Text>
<Link
href={`https://github.com/basedosdados/website/edit/main/next/blog/${slug}.md`}
isexternal="true"
Expand All @@ -166,7 +166,7 @@ export default function Post({ slug, mdxSource, headings }) {
_hover={{
color: "#0057A4"
}}
>Contribua com a BD editando este artigo via pull request no nosso GitHub.</Link>
>{t("contributeToBD")}</Link>
</Box>
</Box>
<Box
Expand Down
8 changes: 5 additions & 3 deletions next/pages/blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import { MainPageTemplate } from "../../components/templates/main";
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useTranslation } from 'next-i18next';
import { BlogGrid } from "../../components/organisms/Blog/Home";
import { getAllPosts } from "../api/blog";

Expand All @@ -18,6 +19,7 @@ export async function getStaticProps({ locale }) {
}

export default function Blog({ posts }) {
const { t } = useTranslation("blog")
const router = useRouter()
const { query } = router
const [data, setData] = useState([])
Expand Down Expand Up @@ -49,15 +51,15 @@ export default function Blog({ posts }) {
return (
<MainPageTemplate>
<Head>
<title>Blog – Base dos Dados</title>
<title>{t("pageTitle")}</title>
<meta
property="og:title"
content="Blog – Base dos Dados"
content={t("pageTitle")}
key="ogtitle"
/>
<meta
property="og:description"
content="Blog da Base dos Dados"
content={t("pageDescription")}
key="ogdesc"
/>
</Head>
Expand Down
4 changes: 2 additions & 2 deletions next/pages/case-studies/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default function CaseStudies ({ serialize }) {
color="#252A32"
fontWeight="500"
>
Sobre
{t('about')}
</Text>

<Text
Expand All @@ -240,7 +240,7 @@ export default function CaseStudies ({ serialize }) {
color="#252A32"
fontWeight="500"
>
Setor
{t('sector')}
</Text>

<Text
Expand Down
13 changes: 13 additions & 0 deletions next/public/locales/en/blog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pageTitle": "Blog – Data Basis",
"pageDescription": "Data Basis Blog",
"blog": "Blog",
"edited": "Edited on",
"share": "Share",
"filter": "Filter",
"all": "All",
"noCategories": "No category",
"noticedSomething": "Notice something wrong or have a suggestion?",
"contributeToBD": "Contribute to BD by editing this article via pull request on our GitHub.",
"seeAll": "See all"
}
10 changes: 6 additions & 4 deletions next/public/locales/en/caseStudies.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pageTitle": "{{title}} – Data Basis",
"backLink": "Back",
"contactText": "We want to help you.",
"contactButton": "Contact us"
"pageTitle": "{{title}} – Data Basis",
"backLink": "Back",
"contactText": "We want to help you.",
"contactButton": "Contact us",
"about": "About",
"sector": "Sector"
}
13 changes: 13 additions & 0 deletions next/public/locales/es/blog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pageTitle": "Blog – Base de los Datos",
"pageDescription": "Blog de Base de los Datos",
"blog": "Blog",
"edited": "Editado el",
"share": "Compartir",
"filter": "Filtrar",
"all": "Todos",
"noCategories": "Sin categoría",
"noticedSomething": "¿Notas algo mal o tienes alguna sugerencia?",
"contributeToBD": "Contribuya a la BD editando este artículo mediante solicitud de extracción en nuestro GitHub.",
"seeAll": "Ver todo"
}
10 changes: 6 additions & 4 deletions next/public/locales/es/caseStudies.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pageTitle": "{{title}} – Base de los Datos",
"backLink": "Volver",
"contactText": "Queremos ayudarle.",
"contactButton": "Contactar"
"pageTitle": "{{title}} – Base de los Datos",
"backLink": "Volver",
"contactText": "Queremos ayudarte.",
"contactButton": "Contáctanos",
"about": "Acerca de",
"sector": "Sector"
}
7 changes: 6 additions & 1 deletion next/public/locales/pt/blog.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"pageTitle": "Blog – Base dos Dados",
"pageDescription": "Blog da Base dos Dados",
"blog": "Blog",
"edited": "Editado em",
"share": "Compartilhe",
"filter": "Filtrar",
"all": "Todos",
"no categories": "Sem categoria"
"noCategories": "Sem categoria",
"noticedSomething": "Notou algo errado ou tem uma sugestão?",
"contributeToBD": "Contribua com a BD editando este artigo via pull request no nosso GitHub.",
"seeAll": "Ver todos"
}
10 changes: 6 additions & 4 deletions next/public/locales/pt/caseStudies.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pageTitle": "{{title}} – Base dos Dados",
"backLink": "Voltar",
"contactText": "Queremos ajudar você.",
"contactButton": "Entre em contato"
"pageTitle": "{{title}} – Base dos Dados",
"backLink": "Voltar",
"contactText": "Queremos ajudar você.",
"contactButton": "Entre em contato",
"about": "Sobre",
"sector": "Setor"
}

0 comments on commit 19e126b

Please sign in to comment.