Skip to content

Commit

Permalink
Merge pull request #54 from jumpserver/pr@master@perf_i18n
Browse files Browse the repository at this point in the history
perf: 优化i18n
  • Loading branch information
BaiJiangJie authored Jan 21, 2021
2 parents 2e4c318 + b31cc52 commit fcada95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions scripts/4_install_jumpserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,30 @@ function post_install() {
echo -e "\n\n"
}

function set_lang() {
# 安装默认不会为中文,所以直接用中文
if [[ "${LANG-''}" == "zh_CN.UTF-8" ]];then
return
fi
# 设置过就不用改了
if grep "export LANG=" ~/.bashrc &> /dev/null;then
return
fi
lang="cn"
read_from_input lang "语言 Language " "cn/en" "${lang}"
LANG='zh_CN.UTF-8'
if [[ "${lang}" == "en" ]];then
LANG='en_US.UTF-8'
fi
echo "export LANG=${LANG}" >> ~/.bashrc
# 之所以这么设置,是因为设置完 ~/.bashrc,就不会再询问,然而 LANG 环境变量,在用户当前 bash 进程中不生效
echo "export LANG=${LANG}" >> "${PROJECT_DIR}"/static.env
export LANG
}

function main() {
echo_logo
set_lang
pre_install
echo_green "\n>>> $(gettext -s 'Install and Configure JumpServer')"
(bash "${BASE_DIR}/1_config_jumpserver.sh")
Expand Down
2 changes: 1 addition & 1 deletion static.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export VERSION=dev
export VERSION=dev

0 comments on commit fcada95

Please sign in to comment.