diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2017-08-29 16:21:25 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-08-29 21:52:07 +0200 |
commit | cc01c906ba63b3797bf2b9ef92a6854fe2ddbefb (patch) | |
tree | ea819678100f6a50d67f1f8516e82fdef8a9196b /includes/helper | |
parent | 73175e2b64c85c7a8c528c76452cd82ffa99f925 (diff) |
#336: Integration of symfony/http-foundation request
Diffstat (limited to 'includes/helper')
-rw-r--r-- | includes/helper/internationalization_helper.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php index d2dbcdbd..83faabb0 100644 --- a/includes/helper/internationalization_helper.php +++ b/includes/helper/internationalization_helper.php @@ -1,5 +1,7 @@ <?php +use Engelsystem\Http\Request; + /** * Return currently active locale * @@ -62,14 +64,20 @@ function gettext_locale($locale = null) */ function make_langselect() { - $url = $_SERVER['REQUEST_URI'] . (strpos($_SERVER['REQUEST_URI'], '?') > 0 ? '&' : '?') . 'set_locale='; + $request = Request::getInstance(); $items = []; foreach (config('locales') as $locale => $name) { + $url = url($request->getPathInfo(), ['set_locale' => $locale]); + $items[] = toolbar_item_link( - htmlspecialchars($url) . $locale, + htmlspecialchars($url), '', - '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name + sprintf( + '<img src="%s" alt="%s" title="%2$s"> %2$s', + url('pic/flag/' . $locale . '.png'), + $name + ) ); } return $items; |