mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-13 23:56:47 +00:00
🌐 Add language selection functionality with support for region-specific locales
This commit is contained in:
@@ -13,6 +13,7 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
$middleware->web(append: [
|
||||
\Stefro\LaravelLangCountry\Middleware\LangCountrySession::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"spatie/laravel-sluggable": "^3.7",
|
||||
"spatie/laravel-tags": "^4.10",
|
||||
"staudenmeir/eloquent-has-many-deep": "^1.21",
|
||||
"stefro/laravel-lang-country": "^4.1",
|
||||
"woodsandwalker/laravel-countries": "^1.5"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
66
composer.lock
generated
66
composer.lock
generated
@@ -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": "71cfd7a3c92c2083fc928354e95d456b",
|
||||
"content-hash": "2f835aeeb5cb6ca796bf1916be38cabf",
|
||||
"packages": [
|
||||
{
|
||||
"name": "akuechler/laravel-geoly",
|
||||
@@ -6289,6 +6289,70 @@
|
||||
},
|
||||
"time": "2025-02-15T17:11:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "stefro/laravel-lang-country",
|
||||
"version": "4.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/stefro/laravel-lang-country.git",
|
||||
"reference": "f8f5bddc4ff93ebee8bade292c7f75256ea1a841"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/stefro/laravel-lang-country/zipball/f8f5bddc4ff93ebee8bade292c7f75256ea1a841",
|
||||
"reference": "f8f5bddc4ff93ebee8bade292c7f75256ea1a841",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "^9.0|^10.0|^11.0|^12.0",
|
||||
"php": "^8.1|^8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-ide-helper": "^2.13|^3.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.22",
|
||||
"orchestra/testbench": "^7.0|^8.0|^9.0",
|
||||
"pestphp/pest": "^1.21 | ^2.0 | ^3.0",
|
||||
"pestphp/pest-plugin-type-coverage": "^2.0|^3.0",
|
||||
"spatie/laravel-ray": "^1.32"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"LangCountry": "Stefro\\LaravelLangCountry\\LangCountryFacade"
|
||||
},
|
||||
"providers": [
|
||||
"Stefro\\LaravelLangCountry\\LaravelLangCountryServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Stefro\\LaravelLangCountry\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Stef Rouschop",
|
||||
"email": "github@rouschop.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Setting the locale is not enough most of the time, some countries use more than one languages. Also, different countries use different date notation formats, names, flags and currencies. This package is here to help you with that!",
|
||||
"homepage": "https://github.com/stefro/laravel-lang-country",
|
||||
"keywords": [
|
||||
"LaravelLangCountry"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/stefro/laravel-lang-country/issues",
|
||||
"source": "https://github.com/stefro/laravel-lang-country/tree/4.1.6"
|
||||
},
|
||||
"time": "2025-11-13T06:15:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.3.0",
|
||||
|
||||
45
config/lang-country.php
Normal file
45
config/lang-country.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'fallback' => 'en-GB',
|
||||
|
||||
'allowed' => [
|
||||
'bn-BD',
|
||||
'bg-BG',
|
||||
'ca-ES',
|
||||
'da-DA',
|
||||
'de-AT',
|
||||
'de-CH',
|
||||
'de-DE',
|
||||
'en-AU',
|
||||
'en-CA',
|
||||
'en-CH',
|
||||
'en-GB',
|
||||
'en-US',
|
||||
'el-GR',
|
||||
'es-CL',
|
||||
'es-CO',
|
||||
'es-ES',
|
||||
'fr-BE',
|
||||
'fr-CA',
|
||||
'fr-CH',
|
||||
'fr-FR',
|
||||
'hu-HU',
|
||||
'id-ID',
|
||||
'it-CH',
|
||||
'it-IT',
|
||||
'lt-LT',
|
||||
'nl-BE',
|
||||
'nl-NL',
|
||||
'ps-AF',
|
||||
'pt-PT',
|
||||
'pl-PL',
|
||||
'ru-RU',
|
||||
],
|
||||
|
||||
'lang_switcher_middleware' => ['web'],
|
||||
|
||||
'lang_switcher_uri' => 'change_lang_country',
|
||||
|
||||
'fallback_based_on_current_locale' => false,
|
||||
];
|
||||
@@ -374,5 +374,8 @@
|
||||
"Basic Information": "",
|
||||
"Coordinates": "",
|
||||
"Demographics": "",
|
||||
"Venue Information": ""
|
||||
"Venue Information": "",
|
||||
"Sprache wechseln": "",
|
||||
"Spracheinstellungen": "",
|
||||
"Wähle deine Sprache aus...": ""
|
||||
}
|
||||
@@ -374,5 +374,8 @@
|
||||
"Basic Information": "Basic Information",
|
||||
"Coordinates": "Coordinates",
|
||||
"Demographics": "Demographics",
|
||||
"Venue Information": "Venue Information"
|
||||
"Venue Information": "Venue Information",
|
||||
"Sprache wechseln": "Change language",
|
||||
"Spracheinstellungen": "Language settings",
|
||||
"Wähle deine Sprache aus...": "Choose your language..."
|
||||
}
|
||||
|
||||
15
lang/es.json
15
lang/es.json
@@ -167,7 +167,7 @@
|
||||
"Längengrad": "Longitud",
|
||||
"Manage your profile and account settings": "Administre su perfil y la configuración de su cuenta",
|
||||
"Manage your two-factor authentication settings": "Administre su configuración de autenticación de dos factores",
|
||||
"Matrix": "",
|
||||
"Matrix": "Matrix",
|
||||
"Matrix Gruppe": "Grupo de Matrix",
|
||||
"Matrix-Raum Bezeichner oder Link": "Identificador o enlace de sala Matrix",
|
||||
"Meetup aktualisieren": "Actualizar encuentro",
|
||||
@@ -242,7 +242,7 @@
|
||||
"Signal": "Signal",
|
||||
"Signal Kontakt- oder Gruppeninformationen": "Información de contacto o grupo de Signal",
|
||||
"SimpleX": "SimpleX",
|
||||
"Simplex": "",
|
||||
"Simplex": "Simplex",
|
||||
"SimpleX Chat Kontaktinformationen": "Información de contacto de SimpleX Chat",
|
||||
"Soll dieses Meetup auf der Karte angezeigt werden?": "¿Debe mostrarse este encuentro en el mapa?",
|
||||
"Stadt": "Ciudad",
|
||||
@@ -264,7 +264,7 @@
|
||||
"System-generierte ID (nur lesbar)": "ID generado por el sistema (solo lectura)",
|
||||
"Systeminformationen": "Información del sistema",
|
||||
"Teilnahme": "Participación",
|
||||
"Telegram": "",
|
||||
"Telegram": "Telegram",
|
||||
"Telegram Link": "Enlace de Telegram",
|
||||
"The given data was invalid.": "Los datos proporcionados no son válidos.",
|
||||
"The response is not a streamed response.": "La respuesta no es una respuesta transmitida.",
|
||||
@@ -276,7 +276,7 @@
|
||||
"To finish enabling two-factor authentication, scan the QR code or enter the setup key in your authenticator app.": "Para terminar de habilitar la autenticación de dos factores, escanee el código QR o ingrese la clave de configuración en su aplicación de autenticación.",
|
||||
"Toggle navigation": "Alternar navegación",
|
||||
"Too Many Requests": "Demasiadas peticiones",
|
||||
"Twitter": "",
|
||||
"Twitter": "Twitter",
|
||||
"Twitter Benutzername": "Nombre de usuario de Twitter",
|
||||
"Twitter-Handle ohne @ Symbol": "Usuario de Twitter sin el símbolo @",
|
||||
"Two Factor Authentication": "Autenticación de Dos Factores",
|
||||
@@ -302,7 +302,7 @@
|
||||
"Wann dieses Meetup erstellt wurde": "Cuando se creó este encuentro",
|
||||
"Wann findet das Event statt?": "¿Cuándo tendrá lugar el evento?",
|
||||
"Webseite": "Sitio web",
|
||||
"Website": "",
|
||||
"Website": "Website",
|
||||
"When you enable two-factor authentication, you will be prompted for a secure pin during login. This pin can be retrieved from a TOTP-supported application on your phone.": "Al activar la autenticación de dos factores, se le solicitará un PIN seguro al iniciar sesión. Puede obtenerlo desde una aplicación compatible con TOTP en su teléfono.",
|
||||
"Whoops!": "¡Ups!",
|
||||
"Willkommen zurück": "Bienvenido de nuevo",
|
||||
@@ -373,5 +373,8 @@
|
||||
"Basic Information": "Información básica",
|
||||
"Coordinates": "Coordenadas",
|
||||
"Demographics": "Demografía",
|
||||
"Venue Information": "Información del lugar"
|
||||
"Venue Information": "Información del lugar",
|
||||
"Sprache wechseln": "Cambiar idioma",
|
||||
"Spracheinstellungen": "Configuración de idioma",
|
||||
"Wähle deine Sprache aus...": "Elige tu idioma..."
|
||||
}
|
||||
|
||||
@@ -69,6 +69,11 @@
|
||||
<flux:spacer/>
|
||||
|
||||
<flux:navlist variant="outline">
|
||||
<flux:navlist.item icon="language" :href="route('settings.profile')"
|
||||
:current="request()->routeIs('settings.profile')"
|
||||
wire:navigate>
|
||||
{{ __('Sprache wechseln') }}
|
||||
</flux:navlist.item>
|
||||
<flux:navlist.item icon="folder-git-2"
|
||||
href="https://gitworkshop.dev/holgerhatgarkeinenode@einundzwanzig.space/einundzwanzig-app"
|
||||
target="_blank">
|
||||
|
||||
@@ -109,6 +109,41 @@ new class extends Component {
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="my-8">
|
||||
<flux:heading size="lg" class="mb-4">{{ __('Spracheinstellungen') }}</flux:heading>
|
||||
<flux:subheading class="mb-6">{{ __('Wähle deine Sprache aus...') }}</flux:subheading>
|
||||
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||||
@php
|
||||
$languages = [
|
||||
'de' => ['name' => 'Deutsch', 'countries' => ['de-DE', 'de-AT', 'de-CH']],
|
||||
'en' => ['name' => 'English', 'countries' => ['en-GB', 'en-US', 'en-AU', 'en-CA']],
|
||||
'es' => ['name' => 'Español', 'countries' => ['es-ES', 'es-CL', 'es-CO']],
|
||||
];
|
||||
$currentLangCountry = session('lang_country', config('lang-country.fallback'));
|
||||
@endphp
|
||||
|
||||
@foreach($languages as $langCode => $langData)
|
||||
@foreach($langData['countries'] as $langCountry)
|
||||
@php
|
||||
[$lang, $countryCode] = explode('-', $langCountry);
|
||||
$isActive = $currentLangCountry === $langCountry;
|
||||
@endphp
|
||||
<a href="{{ route('lang_country.switch', ['lang_country' => $langCountry]) }}"
|
||||
class="flex flex-col items-center justify-center p-4 border rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors {{ $isActive ? 'border-blue-500 bg-blue-50 dark:bg-blue-950' : 'border-zinc-200 dark:border-zinc-700' }}">
|
||||
<img
|
||||
alt="{{ strtolower($countryCode) }}"
|
||||
src="{{ asset('vendor/blade-flags/country-'.strtolower($countryCode).'.svg') }}"
|
||||
class="w-12 h-8 mb-2 object-cover"
|
||||
/>
|
||||
<span class="text-sm font-medium">{{ $langData['name'] }}</span>
|
||||
<span class="text-xs text-zinc-500">{{ strtoupper($countryCode) }}</span>
|
||||
</a>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<livewire:settings.delete-user-form />
|
||||
</x-settings.layout>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user