From 611cd28e24c42b88d4317ce8e929aa3fe9aa6191 Mon Sep 17 00:00:00 2001 From: Danny Gershman Date: Sun, 3 Nov 2024 15:48:46 -0500 Subject: [PATCH] enables option for language tagging #1178 --- .../Api/V1/Admin/SettingsController.php | 21 +++++++++++++++++++ src/app/Services/SettingsService.php | 7 ++++++- src/docs/docs/general/language-options.md | 6 ++++++ .../partials/volunteersControl.blade.php | 2 +- src/tests/Feature/SettingsTest.php | 0 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/app/Http/Controllers/Api/V1/Admin/SettingsController.php create mode 100644 src/tests/Feature/SettingsTest.php diff --git a/src/app/Http/Controllers/Api/V1/Admin/SettingsController.php b/src/app/Http/Controllers/Api/V1/Admin/SettingsController.php new file mode 100644 index 000000000..7a63c39eb --- /dev/null +++ b/src/app/Http/Controllers/Api/V1/Admin/SettingsController.php @@ -0,0 +1,21 @@ +settingsService = $settingsService; + } + + public function index() + { + return response()->json(['languageSelections'=>$this->settingsService->languageSelections()]); + } +} diff --git a/src/app/Services/SettingsService.php b/src/app/Services/SettingsService.php index 6729ee19d..f5202b47e 100644 --- a/src/app/Services/SettingsService.php +++ b/src/app/Services/SettingsService.php @@ -46,6 +46,7 @@ class SettingsService 'jft_option' => ['description' => '/miscellaneous/playback-for-readings' , 'default' => false, 'overridable' => true, 'hidden' => false], 'language' => ['description' => '/general/language-options' , 'default' => 'en-US', 'overridable' => true, 'hidden' => false], 'language_selections' => ['description' => '/general/language-options', 'default' => null, 'overridable' => true, 'hidden' => false], + 'language_selections_tagging' => ['description' => '/general/language-options', 'default' => null, 'overridable' => true, 'hidden' => false], 'location_lookup_bias' => ['description' => '/general/location-lookup-bias' , 'default' => 'country:us', 'overridable' => true, 'hidden' => false], 'meeting_result_sort' => ['description' => '/meeting-search/sorting-results' , 'default' => MeetingResultSort::TODAY, 'overridable' => true, 'hidden' => false], 'meeting_search_radius' => ['description' => '/meeting-search/meeting-search-radius' , 'default' => -50, 'overridable' => true, 'hidden' => false], @@ -332,7 +333,11 @@ public function availableLanguages(): array public function languageSelections(): array { - return explode(",", $this->get('language_selections')); + if ($this->has('language_selections_tagging') && $this->get('language_selections_tagging') !== "") { + return explode(",", $this->get('language_selections_tagging')); + } else { + return explode(",", $this->get('language_selections')); + } } public function getNumberForWord($name) diff --git a/src/docs/docs/general/language-options.md b/src/docs/docs/general/language-options.md index 08d2c5ffa..c25cc8f7b 100644 --- a/src/docs/docs/general/language-options.md +++ b/src/docs/docs/general/language-options.md @@ -39,6 +39,12 @@ static $language_selections = "en-US,pig-latin"; This example will make option 1, English and option 2, pig latin. +You can also tag volunteers ahead of time before enabling the option by using this setting. Either option will work, except this one will not enable the voice prompt menu. + +```php +static $language_selections_tagging = "en-US,pig-latin"; +``` + ### Mixing languages and voices Voices can be configured for every language option. For example for Spanish: diff --git a/src/resources/views/admin/partials/volunteersControl.blade.php b/src/resources/views/admin/partials/volunteersControl.blade.php index 292bc281b..0264576bf 100644 --- a/src/resources/views/admin/partials/volunteersControl.blade.php +++ b/src/resources/views/admin/partials/volunteersControl.blade.php @@ -204,7 +204,7 @@ - @if ($settings->has('language_selections')) + @if ($settings->has('language_selections_tagging') || $settings->has('language_selections')) Languages: