Browse Source

Fixing some small issues

Jose Lorenzo Rodriguez 11 years ago
parent
commit
b199b45653
2 changed files with 4 additions and 3 deletions
  1. 1 1
      src/I18n/I18n.php
  2. 3 2
      src/I18n/MessagesFileLoader.php

+ 1 - 1
src/I18n/I18n.php

@@ -72,7 +72,7 @@ class I18n {
 
 /**
  * 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.

+ 3 - 2
src/I18n/MessagesFileLoader.php

@@ -18,6 +18,7 @@ use Aura\Intl\Package;
 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 @@ class MessagesFileLoader {
 		$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 @@ class MessagesFileLoader {
  * 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']]),