gitlab改成中文版(汉化)

上一篇文章介绍了如何安装gitlab《centos安装gitlab》,有心的朋友会发现,我的是中文版,因为部分人可能对英文不熟,那么我们开始把英文改成中文吧!

我总结了两种方式:

1. 用git比对出英文与中文的补丁,将英文打补丁

2. 直接下载中文版,替换英文

一、

手工安装与升级

推荐按照 gitlab-ce 源代码中 doc/install/installation.md 的内容手工安装 GitLab 中文版本。

相关修改只需要在 Clone the Source 步骤中使用 https://gitlab.com/larryli/gitlab.git 仓库和当前版本的 8-8-zh 即可。

对于中国大陆境内的服务器用户,可以使用 https://git.coding.net/larryli/gitlab.git 镜像(镜像手工同步,比 gitlab.com 上略有延迟)。

另外也可以在 Install Gems 步骤中使用 https://gems.ruby-china.org 镜像加快 gems 安装。具体步骤如下:

cd /home/git/gitlab

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时,就是中文的了。

 

访问页面中文版

 

二、

我们看到第一种方式中,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
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

转载于:https://my.oschina.net/u/4000302/blog/3030894

Docker是一种容器化技术,可以将应用程序和其依赖的环境打包成一个标准化的容器镜像。GitLab是一个开源的代码托管平台,汉化后可以方便中文用户使用。 要在Docker中安装并汉化GitLab,需要按照以下步骤进行操作: 1. 安装Docker:首先,需要在服务器上安装Docker引擎。可以根据系统类型和版本在Docker官方网站上找到相应的安装指南,按照指南一步一步进行安装。 2. 下载GitLab Docker镜像:使用Docker命令从Docker Hub上下载GitLab的官方镜像。命令如下: ``` docker pull gitlab/gitlab-ce:latest ``` 这将下载最新版本的GitLab CE镜像。 3. 创建GitLab容器:使用Docker命令创建一个GitLab容器,并同时开放HTTP和SSH的端口。命令如下: ``` docker run -d \ --hostname gitlab.example.com \ -p 80:80 \ -p 22:22 \ --name gitlab \ --restart always \ -v /srv/gitlab/config:/etc/gitlab \ -v /srv/gitlab/logs:/var/log/gitlab \ -v /srv/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest ``` 以上命令将创建一个名为gitlab的容器,并将配置、日志和数据分别映射到宿主机的指定目录中。 4. 进入GitLab容器:使用Docker命令进入GitLab容器中。命令如下: ``` docker exec -it gitlab bash ``` 这将打开一个交互式的终端窗口,允许您在容器中执行命令。 5. 下载并安装汉化文件:在GitLab容器中执行命令来下载并安装汉化文件。命令如下: ``` mkdir /tmp/locale cd /tmp/locale git clone https://gitlab.com/xhang/gitlab.git cp gitlab/locale/* /opt/gitlab/embedded/service/gitlab-rails/locale/ ``` 这将下载汉化文件,并将其复制到GitLab容器中相应的目录中。 6. 解决权限问题:在GitLab容器中执行以下命令以解决权限问题。命令如下: ``` chown -R git:root /opt/gitlab/embedded/service/gitlab-rails/locale/ ``` 7. 重新启动GitLab容器:在GitLab容器中执行以下命令以重新启动GitLab。命令如下: ``` gitlab-ctl restart ``` 这将重新启动GitLab,并应用汉化文件。 现在,您已经成功在Docker中安装并汉化GitLab。您可以通过浏览器访问http://gitlab.example.com来使用中文界面的GitLab
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值