Text Part Language

textPartLanguage

ArgumentTypeRequiredDefault

languages

array

This method enables you to mark the language of selected text fragments, making it convenient to work with multilingual content. It ensures that user agents, such as graphical browsers and screen readers, correctly present and interpret the content written in multiple languages.

By utilizing the textPartLanguage method, you can specify the language for selected text fragments within the CKEditor field. The method accepts an argument called languages, which is an array allowing you to provide multiple language codes.

use Mostafaznv\NovaCkEditor\CkEditor;

class Article extends Resource
{
    public function fields(Request $request): array
    {
        return [
            CkEditor::make(trans('Content'), 'content')
                ->textPartLanguage([
                    ['title' => 'Farsi', 'languageCode' => 'fa'],
                    ['title' => 'English', 'languageCode' => 'en']
                ])
        ];
    }
}

Last updated