Bearsampp 2026.9.23
Loading...
Searching...
No Matches
class.tpl.app.lang.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (c) 2021-2026 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(
59 array($lang),
60 array(ucfirst($lang), $lang == $bearsamppLang->getCurrent() ? TplAestan::GLYPH_CHECK : ''),
61 false,
62 get_called_class()
63 );
64
65 // Item
66 $items .= $tplSwitchLang[TplApp::SECTION_CALL] . PHP_EOL;
67
68 // Action
69 $actions .= PHP_EOL . $tplSwitchLang[TplApp::SECTION_CONTENT] . PHP_EOL;
70 }
71
72 return $items . $actions;
73 }
74
86 public static function getActionSwitchLang($lang)
87 {
88 return TplApp::getActionRun(Action::SWITCH_LANG, array($lang)) . PHP_EOL .
90 }
91}
92
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)