【干貨】gitlab-11.10.4版本漢化


1、YUM安裝gitlab-11.10.4

  • 下載gitlab-ce的repo
[root@localhost ~]# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[root@localhost ~]# yum makecache fast
[root@localhost ~]# yum list gitlab-ce
  • 安裝gitlab
[root@localhost ~]# yum install -y gitlab-ce

#安裝完成后,需要進行配置url和unicorn的進程項,避免內存占用過高,如下:
[root@localhost ~]# grep -Ev "^$|#" /etc/gitlab/gitlab.rb 
external_url 'http://192.168.0.130'
unicorn['worker_processes'] = 2

[root@localhost ~]# gitlab-ctl reconfigure
這一步,如果出現重新配置一直卡頁面,需要檢查gitlab-runsvdir服務是否已經啟動,如果未啟動,或者已經啟動,進行啟動或重啟操作,如下:

[root@localhost ~]# systemctl status gitlab-runsvdir
[root@localhost ~]# systemctl restart gitlab-runsvdir

[root@localhost ~]# gitlab-ctl restart    #重啟gitlab服務

訪問192.168.0.130會有英文界面,用戶名為root,首次登陸需要修改密碼,修改完成后,進入頁面。點擊右上角的Settings進行Preferences設置,在語言項選擇中文,此時刷新后,可以看到標題和右側的導航欄是變為中文的,但是具體的項目並沒有中文顯示,所以會變成中文+英文的LOW爆顯示。如圖:

2、gitlab漢化技能

找到漢化補丁,地址如下:
https://gitlab.com/xhang/gitlab (延續Larry Li的8-8-zh中文版本 gitlab.com/larryli/gitlab 進行更新),目前該補丁最新為11.10.2的漢化補丁,所以在安裝版本時最好是找到對應的版本進行安裝,這里使用的版本是11.10.4,暫用未發現異常
找到對應的版本這里直接使用11.10的漢化補丁包,下載下來:

[root@localhost ~]# wget https://gitlab.com/xhang/gitlab/-/archive/11-10-stable-zh/gitlab-11-10-stable-zh.tar.gz
[root@localhost ~]# tar -zxf gitlab-11-10-stable-zh.tar.gz
[root@localhost ~]# cp -rp /opt/gitlab/embedded/service/gitlab-rails{,.bak_$(date +%F)}    #備份需要漢化的目錄
[root@localhost ~]# cp -rf gitlab-11-10-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/    #拷貝漢化補丁進行覆蓋

這里cp會一直詢問是否覆蓋,可以直接用unalias cp取消掉cp的別名設置,然后加上-rf強制覆蓋文件,覆蓋完成后,執行重載配置
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart

再次訪問gitlab頁面,已然是我們熟悉的中文啦,如圖:



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM