You surely know that the process of translating a whole website can be pretty difficult. For many years, I have used https://poedit.net/ and.po files for the translation of the static texts of my templates.

* * @return int */ public function handle() { $path_directories = resource_path('views'); $directories = File::directories($path_directories); // Parse all directories within the resources/views folder foreach ($directories as $dir): // Init translations global container $translations = []; foreach ($this->functions['singular'] as $strFunction): $translations[$strFunction] = []; endforeach; foreach ($this->functions['plural'] as $strFunction): $translations[$strFunction] = []; endforeach; // Parse all files from folder $files = File::allFiles($dir); foreach ($files as $file): // Parse all lines from file $lines = File::lines($file); foreach ($lines as $index => $line): // Get strings from line $strings = $this->parseLine($line); // Insert strings into global translations container foreach ($this->functions as $type => $functions): foreach ($functions as $strFunction): if (!empty($strings[$strFunction])): foreach ($strings[$strFunction] as $val): if (is_array($val)) { $string = $val.','.$val; } else { $string = $val; } if (isset($translations[$strFunction][$string])) { $translations[$strFunction][$string][] = $file->getPathname().':'.

This command will parse the files and create.pot files containing the source texts to be translated.

It is important to use msgmerge for updating as it will keep all the previous existing translations in your files.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners