Skip to content

Commit c2436f8

Browse files
author
Marc Cámara
authored
Merge pull request #362 from zarapico123/master
event listen add $locale parameter
2 parents ff6d398 + 1357b96 commit c2436f8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Mcamara/LaravelLocalization/LaravelLocalization.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function getLocalizedURL( $locale = null, $url = null, $attributes = arra
228228

229229
if ( empty( $attributes ) )
230230
{
231-
$attributes = $this->extractAttributes($url);
231+
$attributes = $this->extractAttributes($url, $locale);
232232
}
233233

234234
if ( empty( $url ) )
@@ -761,12 +761,13 @@ public function setBaseUrl( $url )
761761
/**
762762
* Extract attributes for current url
763763
*
764-
* @param string|null|false $url to extract attributes, if not present, the system will look for attributes in the current call
764+
* @param bool|false|null|string $url to extract attributes, if not present, the system will look for attributes in the current call
765765
*
766-
* @return array Array with attributes
766+
* @param string $locale
767+
* @return array Array with attributes
767768
*
768769
*/
769-
protected function extractAttributes( $url = false )
770+
protected function extractAttributes( $url = false, $locale='' )
770771
{
771772
if ( !empty( $url ) )
772773
{
@@ -855,7 +856,7 @@ protected function extractAttributes( $url = false )
855856
}
856857

857858
$attributes = $this->router->current()->parameters();
858-
$response = event('routes.translation', [ $attributes ]);
859+
$response = event('routes.translation', [ $locale, $attributes ]);
859860

860861
if ( !empty( $response ) )
861862
{

0 commit comments

Comments
 (0)