How can i do language system with Livewire?

How can i do language system with Livewire ?

Not sure what you mean by “language system”, but the translation can be done in Livewire exactly in the same way as in Laravel

1 Like

https://laravel.com/docs/8.x/localization#introduction

1 Like

see an example in practice

public function submit() {
        $this->validate([
            'title' => 'required|min:4',
            'video_id' => 'required',
            'participants.*.full_name' => 'required',
            'participants.*.email' => 'required',
            'participants.*.role' => 'required',
            'participants.*.photo' => 'required',
        ],
        [
            'participants.*.full_name.required' => trans('app.name_required'),
            'participants.*.email.required' => trans('app.email_required'),
            'participants.*.role.required' => trans('app.role_required'),
            'participants.*.photo.required' => trans('app.photo_required'),
        ],
        [
            'participants.*.full_name' => trans('app.full_name'),
            'participants.*.email' => trans('app.email'),
            'participants.*.role' => trans('app.role'),
            'participants.*.photo' => trans('app.photo')
        ]
    );

the first parameter is the rules

the second the messages

the third the attributes (the field names)

ps. this is part of a code
of course after validating you need to do something with your data, for example, record it

1 Like

if your translations are in subfolders you can use like this
trans('folder::file.key')

and you can still use something like BabelEdit to help you with translations

1 Like