The function "helper" __() Standard performs the translation of the string or translation key according to the user’s location, as informed in the official documentation. You can spend both configuring according to your files localization:
Example:
Resources/lang/en/messages.php:
return [
'welcome' => 'Seja bem-vindo a site!'
];
Resources/lang/es/messages.php:
return [
'welcome' => 'Bienvenido al sitio!'
];
To display the snippet with translation:
echo __('messages.welcome'); //se espanhol: 'Bienvenido al sitio!', se português: 'Seja bem-vindo ao site!'
You can also use literal strings to perform the translation, using files .json within the same directory:
Resources/lang/es.json:
{
"Eu amo programar.": "Me encanta programar."
}
To display:
echo __('Eu amo programar'); //se espanhol: 'Me encanta programar.'
This is in the new installation?
– Leandro RR