summaryrefslogtreecommitdiff
path: root/includes/sys_menu.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-28 22:23:59 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-29 23:46:31 +0200
commit427315195bdd379a0207fc9b2aaf69a5b5b86c79 (patch)
tree678245351333a16c5a5bca129aada4bfd311c23c /includes/sys_menu.php
parentdf6360044b5c2396b2bee0dfa9e8d744bfa424d5 (diff)
Moved translation/internationalization to Helpers\Translator class
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()