Skip to content

Commit

Permalink
Merge branch 'master' of github.com:spatie/laravel-translation-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Oct 19, 2017
2 parents a9cc0d8 + 18879ae commit 77cd30f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TranslationLoaderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function load($locale, $group, $namespace = null): array

$loaderTranslations = $this->getTranslationsForTranslationLoaders($locale, $group, $namespace);

return $loaderTranslations + $fileTranslations;
return array_replace_recursive($fileTranslations, $loaderTranslations);
}

protected function getTranslationsForTranslationLoaders(
Expand Down
3 changes: 3 additions & 0 deletions tests/TransTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function it_can_get_translations_for_language_files()
{
$this->assertEquals('en value', trans('file.key'));
$this->assertEquals('page not found', trans('file.404.title'));
$this->assertEquals('This page does not exists', trans('file.404.message'));
}

/** @test */
Expand All @@ -30,6 +31,7 @@ public function it_can_get_translations_for_language_files_for_the_current_local

$this->assertEquals('nl value', trans('file.key'));
$this->assertEquals('pagina niet gevonden', trans('file.404.title'));
$this->assertEquals('Deze pagina bestaat niet', trans('file.404.message'));
}

/** @test */
Expand All @@ -40,6 +42,7 @@ public function by_default_it_will_prefer_a_db_translation_over_a_file_translati

$this->assertEquals('en value from db', trans('file.key'));
$this->assertEquals('page not found from db', trans('file.404.title'));
$this->assertEquals('This page does not exists', trans('file.404.message'));
}

/** @test */
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/lang/en/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
'key' => 'en value',
'404' => [
'title' => 'page not found',
'message' => 'This page does not exists',
],
];
1 change: 1 addition & 0 deletions tests/fixtures/lang/nl/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
'key' => 'nl value',
'404' => [
'title' => 'pagina niet gevonden',
'message' => 'Deze pagina bestaat niet',
],
];

0 comments on commit 77cd30f

Please sign in to comment.