1. Go to this page and download the library: Download gboquizosanchez/icu-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/ */
gboquizosanchez / icu-i18n example snippets
// config/icu.php
return [
'regionals' => [
/*
* Allowlisted Namespaces.
* These will use the full regional locale (e.g. es_MX).
* '*' represents your application's local files (lang/es_MX/...).
* Vendor packages are excluded by default to prevent missing translation errors.
*/
'namespaces' => [
'*',
],
/*
* Blocklisted Files.
* These will ALWAYS force the base locale (e.g. es).
* Useful for standard Laravel files that usually come in generic locale folders.
*/
'files' => [
// 'validation',
// 'auth',
// 'passwords',
],
],
];
$user = new User(['name' => 'Alice']); // implements __toString
$date = new DateTime('2023-10-01');
echo __('messages.audit', ['user' => $user, 'date' => $date]);
// Output (en_US): Alice performed an action on October 1, 2023
// Output (es_ES): Alice realizó una acción el 1 de octubre de 2023
// Output (ar_SA): أجرت Alice إجراءً في ١ أكتوبر ٢٠٢٣