PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

Ejecutando

composer update

en una máquina virtual Linux (Laravel Homestead), obtengo este error:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 64

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 64

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

Localization in Laravel

In this post, I will go to explain how to localize a Laravel application. The application will support English, Spanish and Galician languages. This is a real example to translate the https://wptranslator.jesusamieiro.com web app. You can find the source code on GitHub.

The steps to localize the application will be:

  1. Create a configuration file to store the languages that will be used by the application.
  2. Define the default language for the application.
  3. Add the translation functions in the views.
  4. Create the JSON translation files.
  5. Create the middleware that updates the application language.
  6. Add the selector in the main view to enable the end-user to change the application language.
  7. Add the route for the change event of the previous selector.
  8. Add the controller to receive the change event from the previous selector.