gitlab改爲中文版(漢化)

上一篇文章介紹瞭如何安裝gitlab《centos安裝gitlab》,有心的朋友會發現,個人是中文版,由於部分人可能對英文不熟,那麼咱們開始把英文改爲中文吧!mysql

我總結了兩種方式:git

1. 用git比對出英文與中文的補丁,將英文打補丁sql

2. 直接下載中文版,替換英文centos

1、ruby

手工安裝與升級

推薦按照 gitlab-ce 源代碼中 doc/install/installation.md 的內容手工安裝 GitLab 中文版本。服務器

相關修改只須要在 Clone the Source 步驟中使用 https://gitlab.com/larryli/gitlab.git 倉庫和當前版本的 8-8-zh 便可。app

對於中國大陸境內的服務器用戶,能夠使用 https://git.coding.net/larryli/gitlab.git 鏡像(鏡像手工同步,比 gitlab.com 上略有延遲)。gitlab

另外也能夠在 Install Gems 步驟中使用 https://gems.ruby-china.org 鏡像加快 gems 安裝。具體步驟以下:post

cd /home/git/gitlabfetch

sudo -u git -H bundle config mirror.https://rubygems.org https://gems.ruby-china.org

# For PostgreSQL (note, the option says "without ... mysql")

sudo -u git -H bundle install --deployment --without development test mysql aws kerberos

# Or if you use MySQL (note, the option says "without ... postgres")

sudo -u git -H bundle install --deployment --without development test postgres aws kerberos

對於升級操做也能夠按照相應的 update.md 相似處理便可。

官方推薦的 Omnibus 安裝

請先使用官方包安裝或升級完成,確認當前版本。

sudo cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

並確認當前漢化版本的 VERSION 是否相同。

若是安裝版本小於當前漢化版本,請先升級。若是安裝版本大於當前漢化版本,請在本項目中提交新的 issue。

若是版本相同,首先在本地 clone 倉庫。

# GitLab.com 倉庫

git clone https://gitlab.com/larryli/gitlab.git

# 或 Coder.net 鏡像

git clone https://git.coding.net/larryli/gitlab.git

上面步驟中遠程倉庫中文版,可能沒有英文版更新的那麼快。能夠用另一個源

# 克隆漢化版本庫

git clone https://gitlab.com/xhang/gitlab.git

# 若是已經克隆過,則進行更新

git fetch

# 8.8版本的漢化補丁

git diff origin/8-8-stable..8-8-zh > ../8.8.diff

而後給gitlab打補丁。

# 中止 gitlab

sudo gitlab-ctl stop

sudo patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 8.8.diff

此步驟也能夠用git自帶打補丁方式進行以下:

cd /opt/gitlab/embedded/service/gitlab-rails

git apply /tmp/8.8.diff

肯定沒有 .rej 文件,重啓 GitLab 便可。

sudo gitlab-ctl start

若是漢化中出現問題,請從新安裝 GitLab(注意備份數據)。

再次訪問gitlab時,就是中文的了。

 

訪問頁面中文版

 

2、

咱們看到第一種方式中,clone 漢化版本時,可能你沒有權限clone最新版的漢化。因此得手動下載tar包或者zip包。

手動下載zip包 https://gitlab.com/xhang/gitlab.git

下載速度可能比較慢,能夠下載到電腦,再上傳到服務器。

cd  /usr/local/src 

wget https://gitlab.com/xhang/gitlab/-/archive/10-7-stable-zh/gitlab-10-7-stable-zh.zip

unzip gitlab-v10.7.0-zh.zip

解壓以後查看版本

[root@iZbp168wizifbaeiyjofhlZ src]# cat gitlab-v10.7.0-zh/VERSION

10.7.0

跟英文版相比對,若是版本同樣,進行下面

##備份英文版

[root@iZbp168wizifbaeiyjofhlZ src]# cp -r /opt/gitlab/embedded/service/gitlab-rails{,.ori}

##中文版覆蓋英文版

[root@iZbp168wizifbaeiyjofhlZ src]#  /bin/cp -rf gitlab-v10.7.0-zh/* /opt/gitlab/embedded/service/gitlab-rails/

cp: cannot overwrite non-directory `/opt/gitlab/embedded/service/gitlab-rails/log' with directory `gitlab-v10.7.0-zh/log'

cp: cannot overwrite non-directory `/opt/gitlab/embedded/service/gitlab-rails/tmp' with directory `gitlab-v10.7.0-zh/tmp'

此報錯不用管,由於已經設置root密碼,登陸過,因此會報錯。

從新配置gitlab

gitlab-ctl reconfigure

重啓啓動gitlab

gitlab-ctl restart

再次訪問 ,即是中文版了。

 

小禮物走一走,來簡書關注我

讚揚支持

做者:流浪姥爺 連接:https://www.jianshu.com/p/136068fe44e2 來源:簡書 簡書著做權歸做者全部,任何形式的轉載都請聯繫做者得到受權並註明出處。

相關文章
相關標籤/搜索