Introduction

The UpdateTranslationRequest form requestopen in new window will be used to validate data before a translation will be updated. It contains the common validation rules provided by Laravel I18n. You can use the form request in any method you want:

use Sirthxalot\Laravel\I18n\Http\Requests\UpdateTranslationRequest;

public function add(UpdateTranslationRequest $request) 
{
    //...
}

Validation Rules

locale

A string that determines a valid and existing locale, e.g. "en", "en_US" or "eng_US".

  • required
  • language must be existing

key

A string that determines a valid translation key, e.g. "Hello World", "animals.dog" or "i18n::animals.dog".

  • required
  • translation key must be existing

message

A string that determines a valid message, e.g. "Hello :Name", "A dog barks.", "".

  • max. 65'535 characters

Replacing Form Request

You can change the validation rules for new languages by creating your own form requestopen in new window. However, we do not recomend to do this.

After creating your form request you can register it within the I18n configuration (config/i18n.php):

return [
    'validation' => [
        'translation' => [
            'update' => \Sirthxalot\Laravel\I18n\Http\Requests\UpdateTranslationRequest::class,
        ]
    ]
]



 



WARNING

Changing the form request can be dangerous and may lead into problems. Please do not change the form requests if you are not 100% sure what you are doing - stick to our plan. We also may not support you if you are using custom form requests.

Last Updated:
Contributors: sirthxalot