diff --git a/src/I18n/I18n.php b/src/I18n/I18n.php index 7fd6f0534f2..cf46e29c3c0 100644 --- a/src/I18n/I18n.php +++ b/src/I18n/I18n.php @@ -72,7 +72,7 @@ public static function translators() { /** * Returns an instance of a translator that was configured for the name and passed - * locale. If no locale is passed the it takes the value returned by the `defaultLocale()` method. + * locale. If no locale is passed then it takes the value returned by the `defaultLocale()` method. * * This method can be used to configure future translators, this is achieved by passing a callable * as the last argument of this function. diff --git a/src/I18n/MessagesFileLoader.php b/src/I18n/MessagesFileLoader.php index 12bcd9489ea..8daaad14f61 100644 --- a/src/I18n/MessagesFileLoader.php +++ b/src/I18n/MessagesFileLoader.php @@ -18,6 +18,7 @@ use Cake\Core\App; use Cake\Core\Plugin; use Cake\Utility\Inflector; +use \Locale; /** * A generic translations package factory that will load translations files @@ -91,7 +92,7 @@ public function __invoke() { $class = App::classname($name, 'I18n\Parser', 'FileParser'); if (!$class) { - throw new \RuntimeException(sprintf('Could not find class %s'), "{$name}FileParser"); + throw new \RuntimeException(sprintf('Could not find class %s', "{$name}FileParser")); } $messages = (new $class)->parse($folder . $this->_name . ".$ext"); @@ -107,7 +108,7 @@ public function __invoke() { * if it does not exists. */ public function translationsFolder() { - $locale = locale_parse($this->_locale) + ['region' => null]; + $locale = Locale::parseLocale($this->_locale) + ['region' => null]; $folders = [ implode('_', [$locale['language'], $locale['region']]),