Skip to content

Commit

Permalink
Merge pull request #362 from zarapico123/master
Browse files Browse the repository at this point in the history
event listen add $locale parameter
  • Loading branch information
Marc Cámara authored Sep 28, 2016
2 parents ff6d398 + 1357b96 commit c2436f8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Mcamara/LaravelLocalization/LaravelLocalization.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function getLocalizedURL( $locale = null, $url = null, $attributes = arra

if ( empty( $attributes ) )
{
$attributes = $this->extractAttributes($url);
$attributes = $this->extractAttributes($url, $locale);
}

if ( empty( $url ) )
Expand Down Expand Up @@ -761,12 +761,13 @@ public function setBaseUrl( $url )
/**
* Extract attributes for current url
*
* @param string|null|false $url to extract attributes, if not present, the system will look for attributes in the current call
* @param bool|false|null|string $url to extract attributes, if not present, the system will look for attributes in the current call
*
* @return array Array with attributes
* @param string $locale
* @return array Array with attributes
*
*/
protected function extractAttributes( $url = false )
protected function extractAttributes( $url = false, $locale='' )
{
if ( !empty( $url ) )
{
Expand Down Expand Up @@ -855,7 +856,7 @@ protected function extractAttributes( $url = false )
}

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

if ( !empty( $response ) )
{
Expand Down

0 comments on commit c2436f8

Please sign in to comment.