diff --git a/resources/lang/en/navigation.php b/resources/lang/en/navigation.php index 3b8cb537..c14ca0f8 100644 --- a/resources/lang/en/navigation.php +++ b/resources/lang/en/navigation.php @@ -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', diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index ed892360..007f17f8 100644 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -4,7 +4,6 @@ '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', @@ -12,7 +11,6 @@ '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', @@ -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' => [ diff --git a/src/Filament/Pages/Settings/ManageCachet.php b/src/Filament/Pages/Settings/ManageCachet.php index 73f7949e..1c7c57c3 100644 --- a/src/Filament/Pages/Settings/ManageCachet.php +++ b/src/Filament/Pages/Settings/ManageCachet.php @@ -6,7 +6,6 @@ use Filament\Forms; use Filament\Forms\Form; use Filament\Forms\Get; -use Illuminate\Support\Str; use function __; @@ -36,20 +35,6 @@ public function form(Form $form): Form ->label(__('cachet::settings.manage_cachet.about_this_site_label')) ->columnSpanFull(), - Forms\Components\Select::make('timezone') - ->label(__('cachet::settings.manage_cachet.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\TextInput::make('incident_days') ->numeric() ->label(__('cachet::settings.manage_cachet.incident_days_label')) @@ -73,8 +58,6 @@ public function form(Form $form): Form ->step(1) ->suffix(__('cachet::settings.manage_cachet.refresh_rate_label_input_suffix_seconds')), - Forms\Components\Toggle::make('show_timezone') - ->label(__('cachet::settings.manage_cachet.toggles.show_timezone')), Forms\Components\Toggle::make('only_disrupted_days') ->label(__('cachet::settings.manage_cachet.toggles.only_show_disrupted_days')), Forms\Components\Toggle::make('dashboard_login_link') diff --git a/src/Filament/Pages/Settings/ManageLocalization.php b/src/Filament/Pages/Settings/ManageLocalization.php new file mode 100644 index 00000000..0dfce4e3 --- /dev/null +++ b/src/Filament/Pages/Settings/ManageLocalization.php @@ -0,0 +1,57 @@ +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')), + ]), + ]); + } +} diff --git a/src/Settings/AppSettings.php b/src/Settings/AppSettings.php index c77e89b3..cc4a1929 100644 --- a/src/Settings/AppSettings.php +++ b/src/Settings/AppSettings.php @@ -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;