mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 13:35:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-timecontrol
|
||||
#
|
||||
|
||||
logfile="/var/log/timecontrol.log"
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
if [ -z "$lang" ] || [[ "$lang" == "auto" ]]; then
|
||||
lang=$(echo "${LANG:-${LANGUAGE:-${LC_ALL:-${LC_MESSAGES:-zh_cn}}}}" | awk -F'[ .@]' '{print tolower($1)}' | sed 's/-/_/' 2>/dev/null)
|
||||
fi
|
||||
|
||||
translate() {
|
||||
# 处理特殊字符
|
||||
local lua_script=$(cat <<LUA
|
||||
require "luci.i18n".setlanguage("$lang")
|
||||
print(require "luci.i18n".translate([==[$1]==]))
|
||||
LUA
|
||||
)
|
||||
|
||||
lua -e "$lua_script"
|
||||
}
|
||||
|
||||
if [ "$1" == "clear_log" ]; then
|
||||
# 清空日志
|
||||
>"${logfile}"
|
||||
|
||||
elif [ "$1" == "child" ]; then
|
||||
shift
|
||||
command_name=$1
|
||||
shift
|
||||
"$command_name" "$@"
|
||||
fi
|
||||
Reference in new issue
Block a user