Ground work for transifex-ify ceilometer.

Following http://wiki.openstack.org/Translations to integrate transifex
translation into ceilometer and to fix bug 1082805.

This is the ground work to enable translation jobs using transifex and
Jenkin's in ceilometer. We added the empty file
ceilometer/locale/ceilometer.pot to avoid the failure of the Jenkin'
translation-jobs because git doesn't allow empty directory to be added
into the repository.

We still need to do the following things once this patch gets accepted:

1. Make the transifex ceilometer project
(https://www.transifex.com/projects/p/ceilometer/) as part of the
openstack transifex project hub and give access to the transifex
openstack Jenkins account.

2. Add the translation-jobs into openstack/openstack-ci-puppet for
ceilometer.

3. Recheck and/or clean the LOG.foobar strings in ceilometer so that
only the useful and necessary strings would be extracted into the .pot
file.

NOTE:
1. Don't use '_' as the variable name for "don't care", since it clashes
with gettext module.

2. Wrap the string with the underscore function to make it ready for
translation, e.g.

  internationalized_string = _("I'm internationalized!")
  LOG.debug(_('I speak the language of %(language)s'), locals())

Change-Id: I9732e424b374afa8f0650baf4e3537109e7520d1
This commit is contained in:
Lianhao Lu 2012-12-12 20:13:34 +08:00
parent 07eaed241c
commit baad3c800f
7 changed files with 38 additions and 0 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ dist
*.egg
ceilometer/versioninfo
doc/source/api/*.rst
*.mo

View File

@ -6,3 +6,4 @@ exclude .gitreview
global-exclude *.pyc
recursive-include public *
recursive-include ceilometer/locale *

2
babel.cfg Normal file
View File

@ -0,0 +1,2 @@
[python: **.py]

View File

@ -0,0 +1,19 @@
#
# Copyright 2012 Intel Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import gettext
gettext.install('ceilometer', unicode=1)

View File

View File

@ -11,3 +11,17 @@ where=tests
all_files = 1
build-dir = doc/build
source-dir = doc/source
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = ceilometer/locale/ceilometer.pot
[compile_catalog]
directory = ceilometer/locale
domain = ceilometer
[update_catalog]
domain = ceilometer
output_dir = ceilometer/locale
input_file = ceilometer/locale/ceilometer.pot

View File

@ -3,6 +3,7 @@ coverage
pep8>=1.0
mock
mox
Babel>=0.9.6
# NOTE(dhellmann): Ming is necessary to provide the Mongo-in-memory
# implementation of MongoDB. The original source for Ming is at
# http://sourceforge.net/project/merciless but there does not seem to