Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
eddbb6be
Commit
eddbb6be
authored
Nov 10, 2014
by
pana1990
Committed by
Qiang Xue
Nov 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dropped locale option
parent
d86da1d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
BaseArrayHelper.php
framework/helpers/BaseArrayHelper.php
+3
-7
No files found.
framework/helpers/BaseArrayHelper.php
View file @
eddbb6be
...
@@ -597,18 +597,14 @@ class BaseArrayHelper
...
@@ -597,18 +597,14 @@ 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
=
[])
{
{
$default_options
=
[
$default_options
=
[
'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
];
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment