Another Yii3 family package is released. This time it is yiisoft/i18n. The package provides common internationalization utilities and currently includes a Locale class. It stores locale information created from BCP 47 formatted string. Can parse locale string, modify locale parts, form locale string from parts, and derive fallback locale.
$locale = new \Yiisoft\I18n\Locale('es-CL');
echo $locale->language();
echo $locale->region();
$locale = $locale->withLanguage('en');
echo $locale->asString();
echo $locale->fallbackLocale()->asString();
The package has 100% code coverage and 100% mutation score.