Commit eddbb6be by pana1990 Committed by Qiang Xue

dropped locale option

parent d86da1d3
...@@ -597,9 +597,6 @@ class BaseArrayHelper ...@@ -597,9 +597,6 @@ class BaseArrayHelper
* - lastWordConnector: The sign or word used to join the last element in arrays with * - lastWordConnector: The sign or word used to join the last element in arrays with
* three or more elements. By default ', and '. * three or more elements. By default ', and '.
* *
* - locale: If i18n is available, you can set a locale and use the traslation file defined
* on the path 'messages/yii.php'.By default language defined in configuration file.
*
* @return string * @return string
*/ */
public static function sentence($array, $options = []) public static function sentence($array, $options = [])
...@@ -608,7 +605,6 @@ class BaseArrayHelper ...@@ -608,7 +605,6 @@ class BaseArrayHelper
'wordsConnector' => ', ', 'wordsConnector' => ', ',
'twoWordsConnector' => ' and ', 'twoWordsConnector' => ' and ',
'lastWordConnector' => ', and ', 'lastWordConnector' => ', and ',
'locale' => Yii::$app->language
]; ];
$options = array_merge($default_options, $options); $options = array_merge($default_options, $options);
...@@ -621,9 +617,9 @@ class BaseArrayHelper ...@@ -621,9 +617,9 @@ class BaseArrayHelper
case 1: case 1:
return $array[0]; return $array[0];
case 2: case 2:
return $array[0] . \Yii::t('yii', $options['twoWordsConnector'], [], $options['locale']) . $array[1]; return $array[0] . $options['twoWordsConnector'] . $array[1];
default: default:
return implode($options['wordsConnector'], array_slice($array, 0, -1)) . \Yii::t('yii', $options['lastWordConnector'], [], $options['locale']) . $array[$count - 1]; return implode($options['wordsConnector'], array_slice($array, 0, -1)) . $options['lastWordConnector'] . $array[$count - 1];
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment