Skip to content

Commit d80791a

Browse files
committed
Update blog components with i18n support
1 parent 764d3c9 commit d80791a

5 files changed

Lines changed: 19 additions & 12 deletions

File tree

frontend/components/blog/BlogCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import Image from 'next/image';
44
import Link from 'next/link';
5+
import { useTranslations } from 'next-intl';
56
import AuthorModal from './AuthorModal';
67
import type { Post, PortableTextBlock } from './BlogFilters';
78

@@ -14,6 +15,7 @@ export default function BlogCard({
1415
selectedTags: string[];
1516
onTagToggle: (tag: string) => void;
1617
}) {
18+
const t = useTranslations('blog');
1719
const excerpt =
1820
post.body
1921
?.filter((b): b is PortableTextBlock => b?._type === 'block')
@@ -135,7 +137,7 @@ export default function BlogCard({
135137
transition
136138
"
137139
>
138-
Visit Resource →
140+
{t('visitResource')}
139141
</a>
140142
)}
141143
</div>

frontend/components/blog/BlogFilters.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import { useMemo, useState } from 'react';
4+
import { useTranslations } from 'next-intl';
45
import BlogGrid from '@/components/blog/BlogGrid';
56

67
type SocialLink = {
@@ -76,6 +77,7 @@ function SearchIcon({ className }: { className?: string }) {
7677
}
7778

7879
export default function BlogFilters({ posts }: { posts: Post[] }) {
80+
const t = useTranslations('blog');
7981
const [input, setInput] = useState('');
8082
const [selectedTags, setSelectedTags] = useState<string[]>([]);
8183

@@ -175,7 +177,7 @@ export default function BlogFilters({ posts }: { posts: Post[] }) {
175177
addTag(input);
176178
}
177179
}}
178-
placeholder="Пошук..."
180+
placeholder={t('searchPlaceholder')}
179181
className="
180182
w-full
181183
rounded-xl
@@ -208,7 +210,7 @@ export default function BlogFilters({ posts }: { posts: Post[] }) {
208210
text-gray-600 hover:bg-gray-100
209211
transition
210212
"
211-
title="Remove tag"
213+
title={t('removeTag')}
212214
>
213215
<span>#{tag}</span>
214216
<span className="text-base leading-none">×</span>
@@ -225,7 +227,7 @@ export default function BlogFilters({ posts }: { posts: Post[] }) {
225227
hover:bg-gray-50 hover:border-gray-400 transition
226228
"
227229
>
228-
Add
230+
{t('add')}
229231
</button>
230232
)}
231233

@@ -239,7 +241,7 @@ export default function BlogFilters({ posts }: { posts: Post[] }) {
239241
hover:bg-gray-50 hover:border-gray-400 transition
240242
"
241243
>
242-
Clear
244+
{t('clear')}
243245
</button>
244246
)}
245247
</div>
@@ -256,7 +258,7 @@ export default function BlogFilters({ posts }: { posts: Post[] }) {
256258

257259
{!filteredPosts.length && (
258260
<p className="text-center text-gray-500 mt-10">
259-
No posts found for selected tags.
261+
{t('noPostsForTags')}
260262
</p>
261263
)}
262264
</div>

frontend/messages/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545
"title": "All Blog Posts",
4646
"metaTitle": "Blog | DevLovers",
4747
"metaDescription": "Explore the latest articles and insights",
48-
"searchPlaceholder": "Type a hashtag and press Enter (e.g. frontend, qa)",
48+
"searchPlaceholder": "Search...",
4949
"removeTag": "Remove tag",
5050
"add": "Add",
5151
"clear": "Clear",
5252
"noPosts": "No posts found",
53-
"noPostsForTags": "No posts found for selected tags"
53+
"noPostsForTags": "No posts found for selected tags",
54+
"visitResource": "Visit Resource →"
5455
},
5556
"footer": {
5657
"builtWith": "Built with",

frontend/messages/pl.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545
"title": "Wszystkie Wpisy na Blogu",
4646
"metaTitle": "Blog | DevLovers",
4747
"metaDescription": "Odkryj najnowsze artykuły i spostrzeżenia",
48-
"searchPlaceholder": "Wpisz hashtag i naciśnij Enter (np. frontend, qa)",
48+
"searchPlaceholder": "Szukaj...",
4949
"removeTag": "Usuń tag",
5050
"add": "Dodaj",
5151
"clear": "Wyczyść",
5252
"noPosts": "Nie znaleziono wpisów",
53-
"noPostsForTags": "Nie znaleziono wpisów dla wybranych tagów"
53+
"noPostsForTags": "Nie znaleziono wpisów dla wybranych tagów",
54+
"visitResource": "Odwiedź zasób →"
5455
},
5556
"footer": {
5657
"builtWith": "Zbudowane z",

frontend/messages/uk.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545
"title": "Усі статті блогу",
4646
"metaTitle": "Блог | DevLovers",
4747
"metaDescription": "Досліджуйте останні статті та корисні матеріали",
48-
"searchPlaceholder": "Введіть хештег і натисніть Enter (наприклад, frontend, qa)",
48+
"searchPlaceholder": "Пошук...",
4949
"removeTag": "Видалити тег",
5050
"add": "Додати",
5151
"clear": "Очистити",
5252
"noPosts": "Статей не знайдено",
53-
"noPostsForTags": "Немає статей за обраними тегами"
53+
"noPostsForTags": "Немає статей за обраними тегами",
54+
"visitResource": "Відвідати ресурс →"
5455
},
5556
"footer": {
5657
"builtWith": "Створено",

0 commit comments

Comments
 (0)