diff --git a/app/Http/Middleware/SetLocale.php b/app/Http/Middleware/SetLocale.php new file mode 100644 index 0000000..be2fb00 --- /dev/null +++ b/app/Http/Middleware/SetLocale.php @@ -0,0 +1,28 @@ +withMiddleware(function (Middleware $middleware) { // + $middleware->web(append: [ + \App\Http\Middleware\SetLocale::class, + ]); }) ->withExceptions(function (Exceptions $exceptions) { // diff --git a/composer.json b/composer.json index 711181e..d2493f0 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "filament/spatie-laravel-settings-plugin": "^3.2", "laravel/framework": "^12.0", "laravel/tinker": "^2.10.1", + "spatie/laravel-translatable": "^6.11", "z3d0x/filament-logger": "^0.8.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index f22d1d4..22446fb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "083e990c0eec83189874544dae9a4776", + "content-hash": "eb170ca2ffc7e53c6f0867f0d04d9f13", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -5270,6 +5270,89 @@ ], "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", "version": "2.3.0", diff --git a/resources/lang/en/app.php b/resources/lang/en/app.php new file mode 100644 index 0000000..6ff81fb --- /dev/null +++ b/resources/lang/en/app.php @@ -0,0 +1,40 @@ + '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', +]; \ No newline at end of file diff --git a/resources/lang/ru/app.php b/resources/lang/ru/app.php new file mode 100644 index 0000000..ee33371 --- /dev/null +++ b/resources/lang/ru/app.php @@ -0,0 +1,40 @@ + 'Искать здесь', + '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' => 'Настройки', +]; \ No newline at end of file diff --git a/resources/lang/tk/app.php b/resources/lang/tk/app.php new file mode 100644 index 0000000..cdf4a3e --- /dev/null +++ b/resources/lang/tk/app.php @@ -0,0 +1,40 @@ + 'Ş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', +]; \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 588c429..ee4432c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,6 +11,7 @@ use App\Http\Controllers\NewsPageController; use App\Http\Controllers\OurSolutionPageController; use App\Http\Controllers\Web\SuccessPageController; use Illuminate\Support\Facades\Route; +use Illuminate\Support\Facades\Session; // Homepage... Route::get('/', [HomePageController::class, 'index'])->name('home'); @@ -48,3 +49,9 @@ Route::post('contact', [ContactPageController::class, 'store'])->name('contact.s // Legal pages... Route::get('terms-and-conditions', [LegalPageController::class, 'terms'])->name('terms'); 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');