Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
a7116e71
Commit
a7116e71
authored
Aug 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring the lang class.
parent
2e482d31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
14 deletions
+3
-14
lang.php
system/lang.php
+3
-14
No files found.
system/lang.php
View file @
a7116e71
...
@@ -63,10 +63,7 @@ class Lang {
...
@@ -63,10 +63,7 @@ class Lang {
*/
*/
public
function
get
(
$language
=
null
,
$default
=
null
)
public
function
get
(
$language
=
null
,
$default
=
null
)
{
{
if
(
is_null
(
$language
))
if
(
is_null
(
$language
))
$language
=
Config
::
get
(
'application.language'
);
{
$language
=
Config
::
get
(
'application.language'
);
}
list
(
$module
,
$file
,
$line
)
=
$this
->
parse
(
$this
->
key
,
$language
);
list
(
$module
,
$file
,
$line
)
=
$this
->
parse
(
$this
->
key
,
$language
);
...
@@ -99,21 +96,13 @@ class Lang {
...
@@ -99,21 +96,13 @@ class Lang {
*/
*/
private
function
parse
(
$key
,
$language
)
private
function
parse
(
$key
,
$language
)
{
{
// Check for a module qualifier. If a module name is present, we need to extract it from
// the language line, otherwise, we will use "application" as the module.
$module
=
(
strpos
(
$key
,
'::'
)
!==
false
)
?
substr
(
$key
,
0
,
strpos
(
$key
,
':'
))
:
'application'
;
$module
=
(
strpos
(
$key
,
'::'
)
!==
false
)
?
substr
(
$key
,
0
,
strpos
(
$key
,
':'
))
:
'application'
;
if
(
$module
!=
'application'
)
if
(
$module
!=
'application'
)
$key
=
substr
(
$key
,
strpos
(
$key
,
':'
)
+
2
);
{
$key
=
substr
(
$key
,
strpos
(
$key
,
':'
)
+
2
);
}
$segments
=
explode
(
'.'
,
$key
);
$segments
=
explode
(
'.'
,
$key
);
if
(
count
(
$segments
)
>
1
)
if
(
count
(
$segments
=
explode
(
'.'
,
$key
))
>
1
)
return
array
(
$module
,
$segments
[
0
],
$segments
[
1
]);
{
return
array
(
$module
,
$segments
[
0
],
$segments
[
1
]);
}
throw
new
\Exception
(
"Invalid language line [
$key
]. A specific line must be specified."
);
throw
new
\Exception
(
"Invalid language line [
$key
]. A specific line must be specified."
);
}
}
...
...
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