Localization

Vanguard - Advanced PHP Login and User Management Vanguard - Advanced PHP Login and User Management / Last updated on October 29, 2018

Vanguard utilizes Laravel's default localization mechanism to allow you to translate it to any language you want. All translation files are located inside resources/lang folder. Within this directory there should be a subdirectory for each language supported by the application:

/resources
    /lang
        /en
            app.php
        /es
            app.php

Available Locales

Out of the box, you can switch among following locales:

  • English
  • Serbian Latin
  • German

More locales will be added in the future.

Translating Vanguard

If you want to translate Vanguard application, all you need to do is to create subfolder inside resources/lang directory that match your locale, copy the files from existing locale (en for example), and translate them to your language.

Note! Vanguard specific files are app.php and log.php. All other files are Laravel's default localization files, and there is a big chance that someone has already translated those files for you. Check it here.

For example, if we want to translate Vanguard to Russian, we will do the following:

  1. Create a new folder inside resources/lang called ru.

  2. Copy app.php and log.php files from resources/lang/en to your newly created ru folder.

  3. Translate all copied files to Russian.

  4. Download Laravel's default translation files for Russian language from here and put them inside your newly created ru folder.

Setting Application Locale

Now, when you have your translations ready, you just need to change the currently active language by defining APP_LOCALE environment variable inside your .env file.

For example, if we want to set our language to Russian, we would set that variable as following:

//...
APP_LOCALE=ru
//...