[ English | 한국어 (대한민국) | Indonesia | русский | 中文 (简体, 中国) | Deutsch | English (United Kingdom) | 日本語 ]

如何检查翻译

It is important to validate your translations by applying them in a real situation where they are rendered and visualized. This page describes how to check your translations.

备注

translation check refers to build OpenStack artifacts with translated strings and check how the translated strings are shown on an actual screen as part of the translation process.

文档

Translated documents are available at the OpenStack Documentation site. It is updated daily. Most contents are linked from:

The documents are maintained in the doc directory using reStructuredText and built by Sphinx. Translated strings are stored as Gettext PO file format in locale/<lang>/LC_MESSAGES directory.

Documents on openstack-manuals

For OpenStack documentation, openstack-manuals git repository hosts essential OpenStack documents such as Installation Guide, and Virtual Machine Image Guide.

To build a translated document on this repository, you need to update the file doc-tools-check-languages.conf in each repository, and add an entry to BOOKS like ["ja"]="install-guide".

如果是任何稳定分支的文档,例如Liberty安装指南,你需要直接更新该稳定分支的``doc-tools-check-languages.conf``文件。

You can check a generated document for a specified branch on https://docs.openstack.org/<branch>/<language>/<document>. For example, the link of Japanese Ubuntu Installation Guide for Liberty is https://docs.openstack.org/liberty/ja/install-guide-ubuntu/.

为了给生成的文档增加连接,你需要在``master`` branch of the ``openstack-manuals``库里更新``www/<lang>/index.html``这个文件。注意这些页面是从``master``分支发布的,里面包含了所有发布版本的页面,如Liberty。因此,你不需要在稳定分支里更新``www/<lang>/index.html``这个文件

你也可以参考:

OpenStack project documentation

Currently, we support translations for small set of OpenStack project documentations like Horizon, OpenStack-Ansible, and OpenStack-Helm upon requests and available bandwidth. Top-level directory structure on doc/source/ follows with Documentation Contributor Guide - Project guide setup and the corresponding generated documents for master branch are available at https://docs.openstack.org/<project>/latest/<language>/<document> URL. For project team documents in stable branch, you can check the documents with https://docs.openstack.org/<project>/<branch>/<language>/<document> URL.

Here are sample document links as examples:

OpenStack仪表盘

运行OpenStack-Ansible

OpenStack-Ansible (OSA) 提供Ansible 剧本(playbooks)以及OpenStack环境部署与配置的角色(roles)。作为此项目的一部分,一个叫“翻译检查站(Translation Check Site)”的功能被开发了。一个 OSA 实例会从`翻译平台 <https://translate.openstack.org/>`__下载已翻译的字符串,然后在Horizon中编译并提供这些字符串。你需要一台有二到四核的CPU、至少8 GB内存、以及70 GB硬盘存储的计算机才能运行OSA。

$ BRANCH=master
$ git clone -b ${BRANCH} https://github.com/openstack/openstack-ansible /opt/openstack-ansible
$ cd /opt/openstack-ansible
$ ./scripts/gate-check-commit.sh translations

你可以在 tests/vars/bootstrap-aio-vars.yml 中设置一体化安装的组件。 取决于你的环境,安装需要1-2个小时。 有关一体化配置的更多详细信息,请参阅`OSA AIO 文档 <https://docs.openstack.org/openstack-ansible/latest/user/aio/quickstart.html#building-an-aio>`_。

要定期获取已翻译的文件,请手动或以cron身份执行此命令:

$ cd /opt/openstack-ansible/playbooks; \
  openstack-ansible os-horizon-install.yml \
  -e horizon_translations_update=True \
  -e horizon_translations_project_version=master \
  --tags "horizon-config"

运行DevStack

还有一种便捷的方式可以检查仪表盘的翻译,就是在你本地环境里运行DevStack。为了运行DevStack,你需要准备``local.conf``文件,但不要担心。互联网上有许多分享出来的``local.conf``文件,下文中也有一个最小示例。按照我们的经验,你需要一台配置了2-4核CPU,8GB内存和20GB硬盘的机器才能流畅地运行DevStack。如果你只启用OpenStack的主要项目,那对机器配置的要求还能再小一些,如2-4GB内存。

$ BRANCH=master
$ git clone https://opendev.org/openstack/devstack.git
$ cd devstack
$ git checkout $BRANCH
<prepare local.conf>
$ ./stack.sh
<wait and wait... it takes 20 or 30 minutes>

$BRANCH 替换为一个合适的分支名称如 master, stable/newton``或者``stable/mitaka

下面给出了Newton发布版的一个例子,其中包含了核心组件(keystone,nova,glance,neutron,cinder),horizon,swift和heat。所有horizon主代码支持的组件都被选在内。

[[local|localrc]]
BRANCH=stable/newton
# NOTE: We need to specify a branch explicitly until DevStack stable branch
# is prepared. At now, swift has no stable/newton branch.
CINDER_BRANCH=$BRANCH
GLANCE_BRANCH=$BRANCH
HEAT_BRANCH=$BRANCH
HORIZON_BRANCH=$BRANCH
KEYSTONE_BRANCH=$BRANCH
NEUTRON_BRANCH=$BRANCH
NOVA_BRANCH=$BRANCH
SWIFT_BRANCH=master

# When OS_CLOUD envvar is set, DevStack will be confused.
unset OS_CLOUD

# Ensure to fetch the latest repository when rerunning DevStack
RECLONE=True

# Translation check site usually does not use tempest.
disable_service tempest

enable_service heat h-api h-api-cfn h-api-cw h-eng
enable_service s-proxy s-object s-container s-account

enable_plugin neutron https://git.openstack.org/openstack/neutron $BRANCH
enable_service q-qos

enable_plugin neutron-vpnaas https://git.openstack.org/openstack/neutron-vpnaas $BRANCH

LOGFILE=$DEST/logs/devstack.log
SCREEN_HARDSTATUS="%{= rw} %H %{= wk} %L=%-w%{= bw}%30L> %n%f %t*%{= wk}%+Lw%-17< %-=%{= gk} %y/%m    /%d %c"
LOGDAYS=2
IDENTITY_API_VERSION=3

ADMIN_PASSWORD=change_me
MYSQL_PASSWORD=change_me
RABBIT_PASSWORD=change_me
SERVICE_PASSWORD=change_me

导入最新的翻译

由于每天都会把翻译的内容导入项目库中,所以大多数情况下你不需要手动从Zanata中拉翻译内容。你只要把最新的horizon代码拉下来就可以了。

如果你有一台运行了DevStack的机器,那有两种途径。

其中一种是只更新horizon的代码。下面给出的shell脚本可以获取到最新的horizon代码,编译翻译信息目录并且重启apache httpd服务器。请将``$BRANCH``用一个合适的分支名称替换,如``master``,stable/newton``或者``stable/mitaka

#!/bin/bash

# Target branch: master, stable/pike, ...
BRANCH=stable/pike

cd /opt/stack/horizon

# Remove stale compiled python files
find horizon -name '*.pyc' | xargs rm
find openstack_dashboard -name '*.pyc' | xargs rm

# Fetch the latest code from git
git checkout $BRANCH
git remote update origin
git merge origin/$BRANCH

python manage.py compilemessages
python manage.py collectstatic --noinput
python manage.py compress --force
sudo service apache2 reload

另外一种方式是重新运行DevStack。在运行``stack.sh``前请再次确保``local.conf``文件中有配置项:RECLONE=True,这样DevStack就可以自动获取最新的horizon和其他项目的代码了。

$ cd devstack
$ ./unstack.sh
<Ensure RECLONE=True in your local.conf>
$ ./stack.sh
<It takes 10 or 15 minutes>

CLI(命令行接口)

待决定

服务器项目

待决定