public static function CarbonInterval::setLocale in Persian Date for Drupal 8 8.4
Set the current translator locale
Parameters
string $locale:
1 call to CarbonInterval::setLocale()
- CarbonInterval::translator in src/
Library/ Carbon/ CarbonInterval.php - Initialize the translator instance if necessary.
File
- src/
Library/ Carbon/ CarbonInterval.php, line 296
Class
- CarbonInterval
- A simple API extension for DateInterval. The implementation provides helpers to handle weeks but only days are saved. Weeks are calculated based on the total days of the current instance.
Namespace
Drupal\persian_date\Library\CarbonCode
public static function setLocale($locale) {
$translator = static::translator();
$translator
->setLocale($locale);
if ($translator instanceof Translator) {
// Ensure the locale has been loaded.
$translator
->addResource('array', require __DIR__ . '/Lang/' . $locale . '.php', $locale);
}
}