Localization

Laravel's localization features provide a convenient way to retrieve strings in various languages, allowing you to easily support multiple languages within your application.

Laravel provides two ways to manage translation strings. First, language strings may be stored in files within the resources/lang directory. Within this directory, there may be subdirectories for each language supported by the application. This is the approach Laravel uses to manage translation strings for built-in Laravel features such as validation error messages:

Read Documentation

# Configure Localization from Backend

VaahCms provide us a User Interface from which you can manage Localization.

Visit following url you will see the Localization section:

<project-url>/backend#/vaah/settings/localization


# Steps to generate Lang Files
  1. Click on Add Language Button. The two fields will appear: Name and Locale ISO 639 Code. Enter detail and click on Save button. A New Tab will appear in Language Tab of that Language code.
  2. You can select language category from category dropdown. If you did not found your category, you can also create by clicking on Add Category Button. One field will appear: Category Name. Enter detail and click on Save button. This will add a new option in category dropdown.
  3. Now you have to add a new string. Click on Add String Button. The two fields will appear: Type Slug and Type value. Enter detail and click on Save button. This will create a new string in all Language Tab. If you select any category in dropdown, then string will create in that category otherwise it will create in General category.
  4. Click on Generate Language Files Button. It will generate files in resources/lang directory.
  5. Copy the code and paste it to retrieve strings within your application.

Note: Step 4 / Generate Lang Files is a most important step. This button generate the lang files in resources/lang directory. If you are adding new Language, Category or Add, Update, Delete operation on Lang String then you will have to click on generate lang file to reflect your changes. Without this step you will not retrieve you string.


# Retrieve Code
trans('messages.welcome')

If you are using the Blade templating engine, you may use the {!! !!} echo syntax to display the translation string:

{!! trans('messages.welcome') !!}