proxmox ve tools script(debian9+ can use it).Including email, samba, NFS set zfs max ram, nested virtualization ,docker , pci passthrough etc. for english user,please look the end of readme.
function i18n() {
local result
local line
local content
local text_file="./text"
result=$(grep -n "^$1" $text_file)
if [ -z "$result" ]; then
echo "$1(not translate)"
else
line=$(echo "$result" | cut -d ':' -f 1)
if [ "$L" = 'zh' ];then
line=$(($line + 1))
fi
content=$(sed -n "$line"p "$text_file")
echo $content
fi
}
我模仿了该项目为公司开发部署底层软件的tui 将单文件拆成了,业务代码1,2,3,翻译文件和界面逻辑,这样更清晰,也更方便别人贡献代码。
这是我的翻译函数 cat text
翻译函数
界面逻辑文件中具体使用