1. Go to this page and download the library: Download glueful/i18n library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// In your extension's ServiceProvider:
public function boot(ApplicationContext $context): void
{
// Loads resources/lang/messages.en.php, messages.fr.php, ... into the
// "my-extension" domain via translation.manager (no-op when i18n is absent).
$this->loadMessageCatalogs(__DIR__ . '/../resources/lang', 'my-extension');
}
// resources/lang/messages.en.php
return [
'welcome.title' => 'Welcome, {name}',
'inbox.count' => '{count, plural, one {# message} other {# messages}}',
];