Thanks to visit codestin.com
Credit goes to github.com

Skip to content
1 change: 1 addition & 0 deletions resources/lang/en/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'items' => [
'manage_cachet' => 'Manage Cachet',
'manage_customization' => 'Manage Customization',
'manage_localization' => 'Manage Localization',
'manage_theme' => 'Manage Theme',
'manage_api_keys' => 'Manage API Keys',
'manage_webhooks' => 'Manage Webhooks',
Expand Down
9 changes: 7 additions & 2 deletions resources/lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
'manage_cachet' => [
'site_name_label' => 'Site Name',
'about_this_site_label' => 'About This Site',
'timezone_label' => 'Timezone',
'incident_days_label' => 'Incident Days',
'major_outage_threshold_label' => 'Major Outage Threshold',
'refresh_rate_label' => 'Automatically Refresh Page',
'refresh_rate_label_input_suffix_seconds' => 'seconds',
'recent_incidents_days_suffix_days' => 'days',
'toggles' => [
'support_cachet' => 'Support Cachet',
'show_timezone' => 'Show Timezone',
'show_dashboard_link' => 'Show Dashboard Link',
'display_graphs' => 'Display Graphs',
'enable_external_dependencies' => 'Enable External Dependencies',
Expand All @@ -27,6 +25,13 @@
'footer_label' => 'Custom Footer HTML',
'stylesheet_label' => 'Custom CSS',
],
'manage_localization' => [
'locale_label' => 'Locale',
'timezone_label' => 'Timezone',
'toggles' => [
'show_timezone' => 'Show Timezone',
],
],
'manage_theme' => [
'app_banner_label' => 'Banner Image',
'status_page_accent' => [
Expand Down
57 changes: 57 additions & 0 deletions src/Filament/Pages/Settings/ManageLocalization.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace Cachet\Filament\Pages\Settings;

use Cachet\Settings\AppSettings;
use Filament\Forms;
use Filament\Forms\Form;
use Illuminate\Support\Str;

class ManageLocalization extends SettingsPage
{
protected static string $settings = AppSettings::class;

public static function getNavigationGroup(): ?string
{
return __('cachet::navigation.settings.label');
}

public static function getNavigationLabel(): string
{
return __('cachet::navigation.settings.items.manage_localization');
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make()->columns(2)->schema([
Forms\Components\Select::make('locale')
->label(__('cachet::settings.manage_localization.locale_label'))
->options(
config('cachet.supported_locales', [
'en' => 'English',
])
)->searchable()
->suffixIcon('heroicon-o-language'),

Forms\Components\Select::make('timezone')
->label(__('cachet::settings.manage_localization.timezone_label'))
->options(fn () => collect(timezone_identifiers_list())
->mapToGroups(
fn ($timezone) => [
Str::of($timezone)
->before('/')
->toString() => [$timezone => $timezone],
]
)
->map(fn ($group) => $group->collapse()))
->searchable()
->suffixIcon('heroicon-o-globe-alt'),

Forms\Components\Toggle::make('show_timezone')
->label(__('cachet::settings.manage_localization.toggles.show_timezone')),
]),
]);
}
}
2 changes: 2 additions & 0 deletions src/Settings/AppSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class AppSettings extends Settings

public bool $show_support = true;

public string $locale = 'en';

public string $timezone = 'UTC';

public bool $show_timezone = false;
Expand Down
Loading