Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Platform
Commits
d8175f24
Unverified
Commit
d8175f24
authored
Jul 18, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't overwrite the Translator class anymore
parent
602b6ab2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
35 deletions
+2
-35
TranslationServiceProvider.php
Modules/Translation/Providers/TranslationServiceProvider.php
+2
-6
Translator.php
Modules/Translation/Services/Translator.php
+0
-29
No files found.
Modules/Translation/Providers/TranslationServiceProvider.php
View file @
d8175f24
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Modules\Translation\Providers
;
namespace
Modules\Translation\Providers
;
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Support\Facades\Validator
;
use
Illuminate\Support\Facades\Validator
;
use
Illuminate\Support\ServiceProvider
;
use
Illuminate\Support\ServiceProvider
;
use
Modules\Core\Composers\CurrentUserViewComposer
;
use
Modules\Core\Composers\CurrentUserViewComposer
;
...
@@ -14,8 +15,6 @@ use Modules\Translation\Repositories\File\FileTranslationRepository as FileDiskT
...
@@ -14,8 +15,6 @@ use Modules\Translation\Repositories\File\FileTranslationRepository as FileDiskT
use
Modules\Translation\Repositories\FileTranslationRepository
;
use
Modules\Translation\Repositories\FileTranslationRepository
;
use
Modules\Translation\Repositories\TranslationRepository
;
use
Modules\Translation\Repositories\TranslationRepository
;
use
Modules\Translation\Services\TranslationLoader
;
use
Modules\Translation\Services\TranslationLoader
;
use
Modules\Translation\Services\Translator
;
use
Schema
;
class
TranslationServiceProvider
extends
ServiceProvider
class
TranslationServiceProvider
extends
ServiceProvider
{
{
...
@@ -111,9 +110,6 @@ class TranslationServiceProvider extends ServiceProvider
...
@@ -111,9 +110,6 @@ class TranslationServiceProvider extends ServiceProvider
protected
function
registerCustomTranslator
()
protected
function
registerCustomTranslator
()
{
{
$this
->
app
->
offsetUnset
(
'translation.loader'
);
$this
->
app
->
offsetUnset
(
'translator'
);
$this
->
app
->
singleton
(
'translation.loader'
,
function
(
$app
)
{
$this
->
app
->
singleton
(
'translation.loader'
,
function
(
$app
)
{
return
new
TranslationLoader
(
$app
[
'files'
],
$app
[
'path.lang'
]);
return
new
TranslationLoader
(
$app
[
'files'
],
$app
[
'path.lang'
]);
});
});
...
@@ -122,7 +118,7 @@ class TranslationServiceProvider extends ServiceProvider
...
@@ -122,7 +118,7 @@ class TranslationServiceProvider extends ServiceProvider
$locale
=
$app
[
'config'
][
'app.locale'
];
$locale
=
$app
[
'config'
][
'app.locale'
];
$trans
=
new
Translator
(
$loader
,
$locale
);
$trans
=
new
\Illuminate\Translation\
Translator
(
$loader
,
$locale
);
$trans
->
setFallback
(
$app
[
'config'
][
'app.fallback_locale'
]);
$trans
->
setFallback
(
$app
[
'config'
][
'app.fallback_locale'
]);
...
...
Modules/Translation/Services/Translator.php
deleted
100644 → 0
View file @
602b6ab2
<?php
namespace
Modules\Translation\Services
;
use
Illuminate\Foundation\Bus\DispatchesJobs
;
use
Modules\Translation\Repositories\TranslationRepository
;
class
Translator
extends
\Illuminate\Translation\Translator
{
use
DispatchesJobs
;
/**
* Get the translation for the given key.
*
* @param string $key
* @param array $replace
* @param string $locale
* @param bool $fallback
* @return string
*/
public
function
get
(
$key
,
array
$replace
=
[],
$locale
=
null
,
$fallback
=
true
)
{
$translationRepository
=
app
(
TranslationRepository
::
class
);
if
(
$translation
=
$translationRepository
->
findByKeyAndLocale
(
$key
,
$locale
))
{
return
$this
->
makeReplacements
(
$translation
,
$replace
);
}
return
parent
::
get
(
$key
,
$replace
,
$locale
);
}
}
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