summaryrefslogtreecommitdiff
path: root/includes/sys_menu.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/sys_menu.php')
-rw-r--r--includes/sys_menu.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index 85ef1287..58d4bab3 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -110,7 +110,7 @@ function make_user_submenu()
{
global $privileges, $page;
- $user_submenu = make_langselect();
+ $user_submenu = make_language_select();
if (in_array('user_settings', $privileges) || in_array('logout', $privileges)) {
$user_submenu[] = toolbar_item_divider();
@@ -228,6 +228,30 @@ function make_room_navigation($menu)
}
/**
+ * Renders language selection.
+ *
+ * @return array
+ */
+function make_language_select()
+{
+ $request = app('request');
+ $activeLocale = session()->get('locale');
+
+ $items = [];
+ foreach (config('locales') as $locale => $name) {
+ $url = url($request->getPathInfo(), ['set-locale' => $locale]);
+
+ $items[] = toolbar_item_link(
+ htmlspecialchars($url),
+ '',
+ $name,
+ $locale == $activeLocale
+ );
+ }
+ return $items;
+}
+
+/**
* @return string
*/
function make_menu()