# Localization

## Definition

A localization file is used to translate all the labels present in a module. To do this it is necessary to create a translation file per module and per language.

{% hint style="info" %}
You can have more information about localization in the [Laravel official documentation](https://laravel.com/docs/5.7/localization).
{% endhint %}

## Example

Here is the english localization file of the User module.

```php
<?php

return [
    'user' => 'Users',
    'block' => [
        'auth' => 'Authentication',
        'contact' => 'Contact',
        'roles' => 'Roles',
    ],
    'field' => [
        'username' => 'Username',
        'name' => 'Name',
        'is_admin' => 'Is admin?',
        'password' => 'Password',
        'password_confirmation' => 'Password (confirmation)',
        'email' => 'Email',
        'current_password' => 'Current password',
        'new_password' => 'New password',
        'new_password_confirm' => 'New password (confirmation)',
    ],
    'relatedlist' => [
        'groups' => 'Groups',
    ],
    'label' => [
        'no_role' => 'No related role',
        'my_account' => 'My account',
        'avatar_type' => 'Avatar type',
    ],
    'account' => [
        'profile' => 'Profile',
        'avatar' => 'Avatar',
        'password' => 'Password',
        'upload_image' => 'Upload an image',
        'avatar_type' => [
            'initials' => 'Initials',
            'gravatar' => 'Gravatar',
            'image' => 'Image',
        ],
        'avatar_description' => [
            'initials' => 'An avatar containing initials will be generated from the user name.',
            'gravatar' => 'Go to :url to configure your avatar. It will be associated to your email address.',
            'image' => 'Upload an image from your computer.',
        ],
    ],
    'error' => [
        'current_password' => 'The current password is not correct.',
    ],
    'success' => [
        'profile_updated' => 'The profile has been updated!',
        'avatar_updated' => 'The avatar has been updated!',
        'password_updated' => 'The password has been updated!'
    ],
];
```

The field named `field.name` is translated into **Name**.\
The block name `block.auth` is translated into **Authentication**.

## Create a localization file

For each module you have to create a localization file for each language you want to use.

To do this, simply create a file located at `resources/lang/{lang_code}/{module_name}.php`.\
Add a translation key for the module's name like (e.g. `'person' => 'People'`). This translation is used in several places, like in the menu.

## Override a localization file

You can easily override a localization file from another package. For more information, please refer to the [Overriding documentation](/doc/customize-your-application/overriding.md#override-a-localization-file).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://uccello.gitbook.io/doc/the-basics/translations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
