Skip to content

Commit

Permalink
enables option for language tagging #1178
Browse files Browse the repository at this point in the history
  • Loading branch information
dgershman committed Nov 3, 2024
1 parent 714d5f6 commit 611cd28
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/app/Http/Controllers/Api/V1/Admin/SettingsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Controllers\Api\V1\Admin;

use App\Http\Controllers\Controller;
use App\Services\SettingsService;

class SettingsController extends Controller
{
protected SettingsService $settingsService;

public function __construct(SettingsService $settingsService)
{
$this->settingsService = $settingsService;
}

public function index()
{
return response()->json(['languageSelections'=>$this->settingsService->languageSelections()]);
}
}
7 changes: 6 additions & 1 deletion src/app/Services/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/docs/docs/general/language-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
<option value="0">Unassigned</option>
<option value="1">Enabled</option>
</select>
@if ($settings->has('language_selections'))
@if ($settings->has('language_selections_tagging') || $settings->has('language_selections'))
Languages: <select multiple class="form-control form-control-sm" name="volunteer_language" id="volunteer_language">
@foreach ($settings->languageSelections() as $key => $available_language) {
<option value="<?php echo $available_language; ?>"><?php echo $available_language; ?></option>
Expand Down
Empty file.

0 comments on commit 611cd28

Please sign in to comment.