Is there a way to apply the right-to-left (RTL) direction to a form without duplicating code for every input, based on the locale of the language being used? Can the locale be changed in CSS to make the form RTL more efficiently?
For example:
<div class="form-group" id="form-group-name">
<label for="name" class=" control-label {{ app()->getLocale() == 'ar' ? 'float-right' : ''}}">{{ __('user.User') }}</label>
<div class="col-sm-12">
<input type="text" id="name" name="name"
value="{{ isset($user->name) ? $user->name :'' }}" maxlength="50" required=""
class="form-control {{ app()->getLocale() == 'ar' ? 'text-right' : ''}}">
<span style="color: red" class="help-block {{ app()->getLocale() == 'ar' ? 'float-right' : ''}}"></span>
</div>
</div>
How can we avoid repeating these conditions for each input field?