This commit is contained in:
2025-07-29 16:17:32 +05:00
parent 643ccd6d9e
commit e927a912e1
8 changed files with 243 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
use Symfony\Component\HttpFoundation\Response;
class SetLocale
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (Session::has('locale')) {
App::setLocale(Session::get('locale'));
} else {
App::setLocale('en'); // Default locale
}
return $next($request);
}
}

View File

@@ -12,6 +12,9 @@ return Application::configure(basePath: dirname(__DIR__))
) )
->withMiddleware(function (Middleware $middleware) { ->withMiddleware(function (Middleware $middleware) {
// //
$middleware->web(append: [
\App\Http\Middleware\SetLocale::class,
]);
}) })
->withExceptions(function (Exceptions $exceptions) { ->withExceptions(function (Exceptions $exceptions) {
// //

View File

@@ -11,6 +11,7 @@
"filament/spatie-laravel-settings-plugin": "^3.2", "filament/spatie-laravel-settings-plugin": "^3.2",
"laravel/framework": "^12.0", "laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1", "laravel/tinker": "^2.10.1",
"spatie/laravel-translatable": "^6.11",
"z3d0x/filament-logger": "^0.8.0" "z3d0x/filament-logger": "^0.8.0"
}, },
"require-dev": { "require-dev": {

85
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "083e990c0eec83189874544dae9a4776", "content-hash": "eb170ca2ffc7e53c6f0867f0d04d9f13",
"packages": [ "packages": [
{ {
"name": "anourvalar/eloquent-serialize", "name": "anourvalar/eloquent-serialize",
@@ -5270,6 +5270,89 @@
], ],
"time": "2025-04-11T11:35:56+00:00" "time": "2025-04-11T11:35:56+00:00"
}, },
{
"name": "spatie/laravel-translatable",
"version": "6.11.4",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-translatable.git",
"reference": "032d85b28de315310dab2048b857016f1194f68b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/032d85b28de315310dab2048b857016f1194f68b",
"reference": "032d85b28de315310dab2048b857016f1194f68b",
"shasum": ""
},
"require": {
"illuminate/database": "^10.0|^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0",
"php": "^8.0",
"spatie/laravel-package-tools": "^1.11"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.64",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
"pestphp/pest": "^1.20|^2.0|^3.0"
},
"type": "library",
"extra": {
"aliases": {
"Translatable": "Spatie\\Translatable\\Facades\\Translatable"
},
"laravel": {
"providers": [
"Spatie\\Translatable\\TranslatableServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\Translatable\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Sebastian De Deyne",
"email": "sebastian@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A trait to make an Eloquent model hold translations",
"homepage": "https://github.com/spatie/laravel-translatable",
"keywords": [
"eloquent",
"i8n",
"laravel-translatable",
"model",
"multilingual",
"spatie",
"translate"
],
"support": {
"issues": "https://github.com/spatie/laravel-translatable/issues",
"source": "https://github.com/spatie/laravel-translatable/tree/6.11.4"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2025-02-20T15:51:22+00:00"
},
{ {
"name": "spatie/temporary-directory", "name": "spatie/temporary-directory",
"version": "2.3.0", "version": "2.3.0",

40
resources/lang/en/app.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
return [
'Search Here' => 'Search Here',
'Address' => 'Address',
'Phone' => 'Phone',
'Email Address' => 'Email Address',
'Location' => 'Location',
'Home' => 'Home',
'About Us' => 'About Us',
'Our solutions' => 'Our solutions',
'News & Stories' => 'News & Stories',
'News' => 'News',
'Success Stories' => 'Success Stories',
'Careers' => 'Careers',
'Career Opportunities' => 'Career Opportunities',
'Internships' => 'Internships',
'Contact' => 'Contact',
'Get Started' => 'Get Started',
'Salary:' => 'Salary:',
'Description' => 'Description',
'Responsibilities and Qualifications' => 'Responsibilities and Qualifications',
'Apply for this Career' => 'Apply for this Career',
'Apply for this Internship' => 'Apply for this Internship',
'Our Trusted Partners' => 'Our Trusted Partners',
'Mode' => 'Mode',
'light' => 'light',
'dark' => 'dark',
'Quick links' => 'Quick links',
'Support' => 'Support',
'Terms & Conditions' => 'Terms & Conditions',
'Privacy policy' => 'Privacy policy',
'About US' => 'About US',
'About Page Settings' => 'About Page Settings',
'Portfolio' => 'Portfolio',
'Contact Page Settings' => 'Contact Page Settings',
'Manage Solutions' => 'Manage Solutions',
'Success Section' => 'Success Section',
'Settings' => 'Settings',
];

40
resources/lang/ru/app.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
return [
'Search Here' => 'Искать здесь',
'Address' => 'Адрес',
'Phone' => 'Телефон',
'Email Address' => 'Адрес электронной почты',
'Location' => 'Местонахождение',
'Home' => 'Главная',
'About Us' => 'О нас',
'Our solutions' => 'Наши решения',
'News & Stories' => 'Новости и истории',
'News' => 'Новости',
'Success Stories' => 'Истории успеха',
'Careers' => 'Карьера',
'Career Opportunities' => 'Возможности карьерного роста',
'Internships' => 'Стажировки',
'Contact' => 'Контакты',
'Get Started' => 'Начать',
'Salary:' => 'Зарплата:',
'Description' => 'Описание',
'Responsibilities and Qualifications' => 'Обязанности и квалификация',
'Apply for this Career' => 'Подать заявку на эту вакансию',
'Apply for this Internship' => 'Подать заявку на эту стажировку',
'Our Trusted Partners' => 'Наши доверенные партнеры',
'Mode' => 'Режим',
'light' => 'светлый',
'dark' => 'темный',
'Quick links' => 'Быстрые ссылки',
'Support' => 'Поддержка',
'Terms & Conditions' => 'Условия и положения',
'Privacy policy' => 'Политика конфиденциальности',
'About US' => 'О нас',
'About Page Settings' => 'Настройки страницы «О нас»',
'Portfolio' => 'Портфолио',
'Contact Page Settings' => 'Настройки страницы контактов',
'Manage Solutions' => 'Управление решениями',
'Success Section' => 'Раздел «Успех»',
'Settings' => 'Настройки',
];

40
resources/lang/tk/app.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
return [
'Search Here' => 'Şu ýerden gözle',
'Address' => 'Salgy',
'Phone' => 'Telefon',
'Email Address' => 'E-poçta salgysy',
'Location' => 'Ýerleşýän ýeri',
'Home' => 'Baş sahypa',
'About Us' => 'Biz barada',
'Our solutions' => 'Biziň çözgütlerimiz',
'News & Stories' => 'Täzelikler we Hekaýalar',
'News' => 'Täzelikler',
'Success Stories' => 'Üstünlik Hekaýalary',
'Careers' => 'Iş orunlary',
'Career Opportunities' => 'Iş mümkinçilikleri',
'Internships' => 'Hünär öwrenmek',
'Contact' => 'Habarlaşmak',
'Get Started' => 'Başlamak',
'Salary:' => 'Aýlyk:',
'Description' => 'Beýan',
'Responsibilities and Qualifications' => 'Jogapkärçilikler we Hünärler',
'Apply for this Career' => 'Bu işe ýüz tutmak',
'Apply for this Internship' => 'Bu hünär öwrenmäge ýüz tutmak',
'Our Trusted Partners' => 'Biziň ygtybarly hyzmatdaşlarymyz',
'Mode' => 'Režim',
'light' => 'ýagty',
'dark' => 'garaňky',
'Quick links' => 'Çalt geçişler',
'Support' => 'Goldaw',
'Terms & Conditions' => 'Şertler we Düzgünler',
'Privacy policy' => 'Gizlinlik syýasaty',
'About US' => 'Biz barada',
'About Page Settings' => 'Biz barada sahypanyň sazlamalary',
'Portfolio' => 'Portfolio',
'Contact Page Settings' => 'Habarlaşmak sahypasynyň sazlamalary',
'Manage Solutions' => 'Çözgütleri dolandyrmak',
'Success Section' => 'Üstünlik bölümi',
'Settings' => 'Sazlamalar',
];

View File

@@ -11,6 +11,7 @@ use App\Http\Controllers\NewsPageController;
use App\Http\Controllers\OurSolutionPageController; use App\Http\Controllers\OurSolutionPageController;
use App\Http\Controllers\Web\SuccessPageController; use App\Http\Controllers\Web\SuccessPageController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Session;
// Homepage... // Homepage...
Route::get('/', [HomePageController::class, 'index'])->name('home'); Route::get('/', [HomePageController::class, 'index'])->name('home');
@@ -48,3 +49,9 @@ Route::post('contact', [ContactPageController::class, 'store'])->name('contact.s
// Legal pages... // Legal pages...
Route::get('terms-and-conditions', [LegalPageController::class, 'terms'])->name('terms'); Route::get('terms-and-conditions', [LegalPageController::class, 'terms'])->name('terms');
Route::get('privacy-and-policy', [LegalPageController::class, 'privacy'])->name('privacy'); Route::get('privacy-and-policy', [LegalPageController::class, 'privacy'])->name('privacy');
// Language Switcher
Route::get('locale/{locale}', function ($locale) {
Session::put('locale', $locale);
return redirect()->back();
})->name('locale.switch');