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.
Continue reading «Localization in Laravel»

How to setup a master-master replication system between two MySQL servers

In this post, I will go to explain how to set up a master-master replication system between two MySQL to replicate an existing database.

The MySQL master-master configuration is a master-slave configuration in both directions and allows us to get a high availability configuration because you have the same data in both servers and if one goes down you can still work with the live server.

Continue reading «How to setup a master-master replication system between two MySQL servers»

Problem updating Grafana in a Debian 9

Updating a Debian 9 I get this error with the «grafana» update:

$ apt update
Ign:7 https://packagecloud.io/grafana/stable/debian stretch InRelease
Err:9 https://packagecloud.io/grafana/stable/debian stretch Release
404 Not Found
Reading package lists... Done
E: The repository 'https://packagecloud.io/grafana/stable/debian stretch Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Continue reading «Problem updating Grafana in a Debian 9»

Guía sobre el registro de la jornada laboral

En el siguiente enlace (PDF, 344 KB) dejo una «Guía sobre el registro de la jornada laboral» del Ministerio de Trabajo que aclara las dudas introducidas por el Real Decreto-ley 8/2019, de 8 de marzo, de medidas urgentes de protección social y de lucha contra la precariedad laboral en la jornada de trabajo. Además en el siguiente enlace (PDF, 130 KB) dejo el «Criterio técnico 101/2019 sobre actuación de la inspección de trabajo y seguridad social en materia de registro de jornada».