Form Translation (#616)
* Form Translation * Support for other languages * Support locale for datepicker * Apply translation on select input * Apply translation on select input * Improve translation --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -252,6 +252,12 @@ class AnswerFormRequest extends FormRequest
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
// Set locale based on form language
|
||||
if ($this->form?->language && in_array($this->form->language, Form::LANGUAGES)) {
|
||||
app()->setLocale($this->form->language);
|
||||
}
|
||||
|
||||
|
||||
$receivedData = $this->toArray();
|
||||
$mergeData = [];
|
||||
$countryCodeMapper = json_decode(file_get_contents(resource_path('data/country_code_mapper.json')), true);
|
||||
|
||||
@@ -29,6 +29,7 @@ abstract class UserFormRequest extends \Illuminate\Foundation\Http\FormRequest
|
||||
'visibility' => ['required', Rule::in(Form::VISIBILITY)],
|
||||
|
||||
// Customization
|
||||
'language' => ['required', Rule::in(Form::LANGUAGES)],
|
||||
'font_family' => 'string|nullable',
|
||||
'theme' => ['required', Rule::in(Form::THEMES)],
|
||||
'width' => ['required', Rule::in(Form::WIDTHS)],
|
||||
|
||||
@@ -70,6 +70,7 @@ class FormResource extends JsonResource
|
||||
'dark_mode' => $this->dark_mode,
|
||||
'transparent_background' => $this->transparent_background,
|
||||
'color' => $this->color,
|
||||
'language' => $this->language,
|
||||
'theme' => $this->theme,
|
||||
'is_password_protected' => true,
|
||||
'has_password' => $this->has_password,
|
||||
|
||||
Reference in New Issue
Block a user