Skip to content

Início / Optitravel / Core / Language

Create translations

Create new translation

To create a translation, you must first understand the translation structure.

The translation structure is the following:

online/backoffice/lang/
    en/
        module.php
    pt/
        module.php

The module file contains all translations related to that module and the idea is to divide the translations based on it's scope.

An example of a translation file (hotels.php):

<?php

/**
 * Hotels PT translations
 * 
 * Important:
 * - All translation keys must be in English and alphabetically ordered
 * - All translations must use HTML Entities
 *
 * @author  Miguel Monteiro <miguel.monteiro@optigest.net>
 * @since   2025/03
 * @version 2025/03
 */
return [
    'accepted'  => 'Aceite',
    'address'   => 'Morada',
    'blocked'   => 'Bloqueado',
    'city'      => 'Cidade',
    'code'      => 'C&oacute;digo',
];

As you can see, the return structure is an array with key and value. As stated in the description of the file it also need to follow some rules: - All translation keys must be in English and alphabetically ordered - All translations must use HTML Entities

This is mandatory!

The translation system also allows to pass variables, so you can have translations like this:

return [
    'mapped_hotel_found'    => 'Encontrado hotel mapeado: :hotel',
];

The :hotel variable can be used according to this example.

Create new modules

If a new module file must be created, it should be discussed with the coordination team.


(Última atualização: 10/04/2025)