From eceb6c0f7cc63a4c34390bd4b0e3ca6f526f4358 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 21 Jan 2021 19:34:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/4_install_jumpserver.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/4_install_jumpserver.sh b/scripts/4_install_jumpserver.sh index 7f60d81b..ed65109c 100755 --- a/scripts/4_install_jumpserver.sh +++ b/scripts/4_install_jumpserver.sh @@ -44,8 +44,29 @@ 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 + 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") From 9461f3ad4fecc911705b0ca5d3a0750f45d6acc3 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 21 Jan 2021 19:39:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Decho=E4=B8=8D?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static.env b/static.env index 8a131931..fe82e3fd 100644 --- a/static.env +++ b/static.env @@ -1 +1 @@ -export VERSION=dev \ No newline at end of file +export VERSION=dev From b31cc526a0526d135ccb5aff47e88641fd91c5a5 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 21 Jan 2021 19:44:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?perf:=20=E6=B7=BB=E5=8A=A0=E5=A4=87?= =?UTF-8?q?=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/4_install_jumpserver.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/4_install_jumpserver.sh b/scripts/4_install_jumpserver.sh index ed65109c..87cb840e 100755 --- a/scripts/4_install_jumpserver.sh +++ b/scripts/4_install_jumpserver.sh @@ -60,7 +60,8 @@ function set_lang() { LANG='en_US.UTF-8' fi echo "export LANG=${LANG}" >> ~/.bashrc - echo "export LANG=${LANG}" >> ${PROJECT_DIR}/static.env + # 之所以这么设置,是因为设置完 ~/.bashrc,就不会再询问,然而 LANG 环境变量,在用户当前 bash 进程中不生效 + echo "export LANG=${LANG}" >> "${PROJECT_DIR}"/static.env export LANG }