Bearsampp 2025.8.29
Loading...
Searching...
No Matches
class.tpl.app.lang.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (c) 2021-2024 Bearsampp
4 * License: GNU General Public License version 3 or later; see LICENSE.txt
5 * Author: bear
6 * Website: https://bearsampp.com
7 * Github: https://github.com/Bearsampp
8 */
9
18{
19 // Constant for the language menu identifier
20 const MENU = 'lang';
21
32 public static function process()
33 {
34 global $bearsamppLang;
35
36 return TplApp::getMenu($bearsamppLang->getValue(Lang::LANG), self::MENU, get_called_class());
37 }
38
50 public static function getMenuLang()
51 {
52 global $bearsamppLang;
53 $items = '';
54 $actions = '';
55
56 foreach ($bearsamppLang->getList() as $lang) {
57 $tplSwitchLang = TplApp::getActionMulti(
58 Action::SWITCH_LANG, array($lang),
59 array(ucfirst($lang), $lang == $bearsamppLang->getCurrent() ? TplAestan::GLYPH_CHECK : ''),
60 false, get_called_class()
61 );
62
63 // Item
64 $items .= $tplSwitchLang[TplApp::SECTION_CALL] . PHP_EOL;
65
66 // Action
67 $actions .= PHP_EOL . $tplSwitchLang[TplApp::SECTION_CONTENT] . PHP_EOL;
68 }
69
70 return $items . $actions;
71 }
72
84 public static function getActionSwitchLang($lang)
85 {
86 return TplApp::getActionRun(Action::SWITCH_LANG, array($lang)) . PHP_EOL .
88 }
89}
global $bearsamppLang
const SWITCH_LANG
const LANG
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
static getMenu($caption, $menu, $class)
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)
const SECTION_CALL
const SECTION_CONTENT
static getActionSwitchLang($lang)