Skip to content

Commit

Permalink
Updating docs and doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Mar 20, 2017
1 parent ac38fcf commit 0f9cb76
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
15 changes: 15 additions & 0 deletions _docs/3-Usage.md
Expand Up @@ -170,6 +170,21 @@ It returns a route, localized to the desired locale using the locale passed.

If the translation key does not exist in the locale given, this function will return `false`.

For a quick use, you can use the `localized_route()` helper:

```
/**
* Get a localized URL with a given trans route name.
*
* @param string $transRoute
* @param array $attributes
* @param string|null $locale
*
* @return string
*/
function localized_route($transRoute, array $attributes = [], $locale = null)
```

##### Get Supported Locales Collection

```php
Expand Down
8 changes: 6 additions & 2 deletions helpers.php
Expand Up @@ -16,13 +16,17 @@ function localization()
/**
* Get a localized URL with a given trans route name.
*
* @param string $transRoute
* @param array $attributes
* @param string|null $locale
*
* @return string
*/
function localized_route($route, $parameters = [], $locale = null)
function localized_route($transRoute, array $attributes = [], $locale = null)
{
if (is_null($locale))
$locale = localization()->getCurrentLocale();

return localization()->getUrlFromRouteName($locale, $route, $parameters);
return localization()->getUrlFromRouteName($locale, $transRoute, $attributes);
}
}

0 comments on commit 0f9cb76

Please sign in to comment.