Skip to content

Commit

Permalink
Add multilingual support for blog section and update Vue i18n configu…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
abdessamadbettal committed Dec 13, 2024
1 parent b3e5788 commit 01e2236
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/vue-i18n-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
|--------------------------------------------------------------------------
|
| The file path for the compiled Vue i18n file.
|
| Run this cmd for generate transalations --> php artisan vue:translations
*/

'outputFile' => resource_path('js/i18n/locales.js'),
Expand Down
3 changes: 3 additions & 0 deletions lang/ar/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
'features' => 'الميزات',
'blogs' => 'المدونات',
'documentation' => 'التوثيق',
'see_more_posts' => 'عرض المزيد من المقالات',
'latest_blogs' => 'أحدث المقالات',
'latest_blogs_text' => 'اقرأ أحدث المقالات من مدونتنا.',
];
3 changes: 3 additions & 0 deletions lang/en/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
'features' => 'Features',
'blogs' => 'Blogs',
'documentation' => 'Documentation',
'see_more_posts' => 'See more posts',
'latest_blogs' => 'Latest Blogs',
'latest_blogs_text' => 'Read the latest posts from our blog.',
];
3 changes: 3 additions & 0 deletions lang/es/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
'features' => 'Características',
'blogs' => 'Blogs',
'documentation' => 'Documentación',
'see_more_posts' => 'Ver más publicaciones',
'latest_blogs' => 'Últimos Blogs',
'latest_blogs_text' => 'Lea las últimas publicaciones de nuestro blog.',
];
3 changes: 3 additions & 0 deletions lang/fr/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
'features' => 'Fonctionnalités',
'blogs' => 'Blogs',
'documentation' => 'Documentation',
'see_more_posts' => 'Voir plus de publications',
'latest_blogs' => 'Derniers Blogs',
'latest_blogs_text' => 'Lisez les dernières publications de notre blog.',
];
9 changes: 7 additions & 2 deletions resources/js/Components/Blog/BlogSection.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div class="container relative md:mt-24 mt-16">
<div class="grid grid-cols-1 pb-6 text-center">
<h3 class="mb-6 md:text-3xl text-2xl md:leading-normal leading-normal font-semibold">{{ $t('travel_blogs')
<h3 class="mb-6 md:text-3xl text-2xl md:leading-normal leading-normal font-semibold">{{ $t('latest_blogs')
}}</h3>

<p class="text-slate-400 max-w-xl mx-auto">{{ $t('simple_text') }}</p>
<p class="text-slate-400 max-w-xl mx-auto">{{ $t('latest_blogs_text') }}</p>
</div>

<div class="grid lg:grid-cols-3 md:grid-cols-2 grid-cols-1 mt-6 gap-6">
Expand All @@ -20,11 +20,16 @@
</template>
<BlogCard v-else v-for="item in posts" :key="item.id" :item="item" />
</div>
<div class="mt-6 text-center">
<Link :href="route('posts.index')" class="text-slate-400 hover:text-primary-500 inline-block cursor-pointer">{{ $t('see_more_posts') }}
<i class="mdi mdi-arrow-right align-middle"></i></Link>
</div>
</div>
</template>

<script>
import BlogCard from '@/Components/Blog/BlogCard.vue';
import { Link } from '@inertiajs/vue3';
export default {
name: 'BlogSection',
Expand Down
20 changes: 16 additions & 4 deletions resources/js/i18n/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export default {
"view_on_github": "عرض على GitHub",
"features": "الميزات",
"blogs": "المدونات",
"documentation": "التوثيق"
"documentation": "التوثيق",
"see_more_posts": "عرض المزيد من المقالات",
"latest_blogs": "أحدث المقالات",
"latest_blogs_text": "اقرأ أحدث المقالات من مدونتنا."
},
"mail": {
"about_us": "معلومات عنا",
Expand Down Expand Up @@ -301,7 +304,10 @@ export default {
"view_on_github": "View on GitHub",
"features": "Features",
"blogs": "Blogs",
"documentation": "Documentation"
"documentation": "Documentation",
"see_more_posts": "See more posts",
"latest_blogs": "Latest Blogs",
"latest_blogs_text": "Read the latest posts from our blog."
},
"mail": {
"about_us": "About us",
Expand Down Expand Up @@ -556,7 +562,10 @@ export default {
"view_on_github": "Ver en GitHub",
"features": "Características",
"blogs": "Blogs",
"documentation": "Documentación"
"documentation": "Documentación",
"see_more_posts": "Ver más publicaciones",
"latest_blogs": "Últimos Blogs",
"latest_blogs_text": "Lea las últimas publicaciones de nuestro blog."
},
"mail": {
"about_us": "Sobre nosotros",
Expand Down Expand Up @@ -809,7 +818,10 @@ export default {
"view_on_github": "Voir sur GitHub",
"features": "Fonctionnalités",
"blogs": "Blogs",
"documentation": "Documentation"
"documentation": "Documentation",
"see_more_posts": "Voir plus de publications",
"latest_blogs": "Derniers Blogs",
"latest_blogs_text": "Lisez les dernières publications de notre blog."
},
"mail": {
"about_us": "À propos de nous",
Expand Down

0 comments on commit 01e2236

Please sign in to comment.