Skip to content

Commit 58f513b

Browse files
committed
Add test for namespaced translations
1 parent f3d46c4 commit 58f513b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

tests/TestCase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,14 @@ protected function setUseLocalizer($value)
120120
* for each language with the given translations.
121121
*
122122
* @param $translations
123+
* @param string $namespace
123124
*
124125
* @return void
125126
*/
126-
protected function setTranslations($translations)
127+
protected function setTranslations($translations, $namespace = '*')
127128
{
128129
Lang::setLoaded([
129-
'*' => [
130+
$namespace => [
130131
'routes' => $translations
131132
]
132133
]);

tests/Unit/Macros/UriTranslationMacroTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,16 @@ public function you_can_translate_a_full_uri()
9292

9393
$this->assertEquals('producten/glazen', Lang::uri('products/glass', 'nl'));
9494
}
95+
96+
/** @test */
97+
public function you_can_specify_a_namespace()
98+
{
99+
$this->setTranslations([
100+
'nl' => [
101+
'articles' => 'artikels',
102+
]
103+
], 'blog');
104+
105+
$this->assertEquals('artikels/{article}', Lang::uri('articles/{article}', 'nl', 'blog'));
106+
}
95107
}

0 commit comments

Comments
 (0)