Setup for translation

To start translation, we need to initially import the
translation file - and place it at the proper place so that
the usual CI scripts can handle it.

The proper place is for all python projects
$PROJECT/locale/$PROJECT.pot - see setup.cfg.

Note that we were using _i18n.py from openstack/common
which is likely to go away, so created our own i18n.py
module per best practices:
http://docs.openstack.org/developer/oslo.i18n/usage.html#creating-an-integration-module

Further imports will be done by the OpenStack Proposal bot.

implements blueprint magnum-i18n-support
Change-Id: Ib34bfbe1ae47e077e92a4262642842c845d1a5d6
This commit is contained in:
Davanum Srinivas 2015-05-13 16:45:27 -04:00 committed by Davanum Srinivas (dims)
parent a34316f7b3
commit bf42ec94ef
24 changed files with 612 additions and 33 deletions

View File

@ -23,7 +23,7 @@ from wsme import types as wtypes
from magnum.common import exception
from magnum.common import utils
from magnum.openstack.common._i18n import _
from magnum.i18n import _
class MacAddressType(wtypes.UserType):

View File

@ -20,8 +20,8 @@ import wsme
from magnum.common import exception
from magnum.common import utils
from magnum.i18n import _
from magnum import objects
from magnum.openstack.common._i18n import _
CONF = cfg.CONF

View File

@ -16,7 +16,7 @@ from keystonemiddleware import auth_token
from magnum.common import exception
from magnum.common import utils
from magnum.openstack.common._i18n import _
from magnum.i18n import _
from magnum.openstack.common import log
LOG = log.getLogger(__name__)

View File

@ -23,8 +23,8 @@ from xml import etree as et
import webob
from magnum.openstack.common._i18n import _
from magnum.openstack.common._i18n import _LE
from magnum.i18n import _
from magnum.i18n import _LE
from magnum.openstack.common import log
LOG = log.getLogger(__name__)

View File

@ -23,7 +23,7 @@ from oslo_config import cfg
from magnum.api import app as api_app
from magnum.common import service
from magnum.openstack.common._i18n import _LI
from magnum.i18n import _LI
from magnum.openstack.common import log as logging

View File

@ -26,8 +26,8 @@ from magnum.conductor.handlers import bay_k8s_heat
from magnum.conductor.handlers import conductor_listener
from magnum.conductor.handlers import docker_conductor
from magnum.conductor.handlers import kube as k8s_conductor
from magnum.openstack.common._i18n import _LE
from magnum.openstack.common._i18n import _LI
from magnum.i18n import _LE
from magnum.i18n import _LI
from magnum.openstack.common import log as logging
LOG = logging.getLogger(__name__)

View File

@ -18,7 +18,7 @@ from oslo_config import cfg
from magnum.common import exception
from magnum.common import magnum_keystoneclient
from magnum.openstack.common._i18n import _
from magnum.i18n import _
from magnum.openstack.common import log as logging

View File

@ -30,8 +30,8 @@ import six
import wsme
from magnum.common import safe_utils
from magnum.openstack.common._i18n import _
from magnum.openstack.common._i18n import _LE
from magnum.i18n import _
from magnum.i18n import _LE
from magnum.openstack.common import log as logging

View File

@ -16,7 +16,7 @@ import json
import six
import yaml
from magnum.openstack.common._i18n import _
from magnum.i18n import _
if hasattr(yaml, 'CSafeDumper'):

View File

@ -21,9 +21,9 @@ from oslo_utils import importutils
from magnum.common import context as magnum_context
from magnum.common import exception
from magnum.openstack.common._i18n import _
from magnum.openstack.common._i18n import _LE
from magnum.openstack.common._i18n import _LI
from magnum.i18n import _
from magnum.i18n import _LE
from magnum.i18n import _LI
from magnum.openstack.common import log as logging
LOG = logging.getLogger(__name__)

View File

@ -21,7 +21,7 @@ import uuid
import six
from magnum.openstack.common._i18n import _
from magnum.i18n import _
def _to_byte_string(value, num_bits):

View File

@ -19,8 +19,8 @@ from requests import exceptions
from six.moves import urllib
from magnum.common import exception
from magnum.openstack.common._i18n import _
from magnum.openstack.common._i18n import _LI
from magnum.i18n import _
from magnum.i18n import _LI
from magnum.openstack.common import log as logging
URLFETCH_OPTS = [

View File

@ -37,9 +37,9 @@ import paramiko
import six
from magnum.common import exception
from magnum.openstack.common._i18n import _
from magnum.openstack.common._i18n import _LE
from magnum.openstack.common._i18n import _LW
from magnum.i18n import _
from magnum.i18n import _LE
from magnum.i18n import _LW
from magnum.openstack.common import log as logging
UTILS_OPTS = [

View File

@ -19,9 +19,9 @@ from oslo_utils import excutils
from magnum.common import exception
from magnum.conductor.api import ListenerAPI
from magnum.i18n import _LI
from magnum.i18n import _LW
from magnum import objects
from magnum.openstack.common._i18n import _LI
from magnum.openstack.common._i18n import _LW
from magnum.openstack.common import log as logging

View File

@ -20,10 +20,10 @@ from magnum.common import clients
from magnum.common import exception
from magnum.common import short_id
from magnum.conductor.template_definition import TemplateDefinition as TDef
from magnum.i18n import _
from magnum.i18n import _LE
from magnum.i18n import _LI
from magnum import objects
from magnum.openstack.common._i18n import _
from magnum.openstack.common._i18n import _LE
from magnum.openstack.common._i18n import _LI
from magnum.openstack.common import log as logging
from magnum.openstack.common import loopingcall

View File

@ -15,7 +15,7 @@
import tempfile
from magnum.common import exception
from magnum.openstack.common._i18n import _LE
from magnum.i18n import _LE
from magnum.openstack.common import log as logging
from magnum.openstack.common import utils

View File

@ -19,8 +19,8 @@ from magnum.common import exception
from magnum.common import k8s_manifest
from magnum.common.pythonk8sclient.client import ApivbetaApi
from magnum.common.pythonk8sclient.client import swagger
from magnum.i18n import _
from magnum import objects
from magnum.openstack.common._i18n import _
from magnum.openstack.common import log as logging
import ast

View File

@ -20,7 +20,7 @@ import requests
import six
from magnum.common import exception
from magnum.openstack.common._i18n import _
from magnum.i18n import _
from magnum.common import paths

View File

@ -26,7 +26,7 @@ from alembic import op
from oslo_config import cfg
import sqlalchemy as sa
from magnum.openstack.common._i18n import _
from magnum.i18n import _
k8s_heat_opts = [

View File

@ -26,7 +26,7 @@ from magnum.common import exception
from magnum.common import utils
from magnum.db import api
from magnum.db.sqlalchemy import models
from magnum.openstack.common._i18n import _
from magnum.i18n import _
from magnum.openstack.common import log
CONF = cfg.CONF

44
magnum/i18n.py Normal file
View File

@ -0,0 +1,44 @@
# 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.
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html .
"""
import oslo_i18n
DOMAIN = 'magnum'
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
def translate(value, user_locale):
return oslo_i18n.translate(value, user_locale)
def get_available_languages():
return oslo_i18n.get_available_languages(DOMAIN)

535
magnum/locale/magnum.pot Normal file
View File

@ -0,0 +1,535 @@
# Translations template for magnum.
# Copyright (C) 2015 ORGANIZATION
# This file is distributed under the same license as the magnum project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: magnum 2015.1.1.dev50\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-05-13 16:43-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: magnum/api/controllers/v1/types.py:147
#, python-format
msgid "Wrong type. Expected '%(type)s', got '%(value)s'"
msgstr ""
#: magnum/api/controllers/v1/types.py:190
#, python-format
msgid "'%s' is an internal attribute and can not be updated"
msgstr ""
#: magnum/api/controllers/v1/types.py:194
#, python-format
msgid "'%s' is a mandatory attribute and can not be removed"
msgstr ""
#: magnum/api/controllers/v1/types.py:199
msgid "'add' and 'replace' operations needs value"
msgstr ""
#: magnum/api/controllers/v1/utils.py:36
msgid "Limit must be positive"
msgstr ""
#: magnum/api/controllers/v1/utils.py:43
#, python-format
msgid "Invalid sort direction: %s. Acceptable values are 'asc' or 'desc'"
msgstr ""
#: magnum/api/controllers/v1/utils.py:53
#, python-format
msgid "Adding a new attribute (%s) to the root of the resource is not allowed"
msgstr ""
#: magnum/api/middleware/auth_token.py:39
#, python-format
msgid "Cannot compile public API routes: %s"
msgstr ""
#: magnum/api/middleware/parsable_error.py:49
#, python-format
msgid "ErrorDocumentMiddleware received an invalid status %s"
msgstr ""
#: magnum/common/clients.py:31 magnum/common/clients.py:53
msgid ""
"Region in Identity service catalog to use for communication with the "
"OpenStack service."
msgstr ""
#: magnum/common/clients.py:35 magnum/common/clients.py:57
msgid ""
"Type of endpoint in Identity service catalog to use for communication "
"with the OpenStack service."
msgstr ""
#: magnum/common/clients.py:39
msgid "Optional CA cert file to use in SSL connections."
msgstr ""
#: magnum/common/clients.py:41
msgid "Optional PEM-formatted certificate chain file."
msgstr ""
#: magnum/common/clients.py:43
msgid "Optional PEM-formatted file that contains the private key."
msgstr ""
#: magnum/common/clients.py:47
msgid "If set, then the server's certificate will not be verified."
msgstr ""
#: magnum/common/exception.py:98
#, python-format
msgid ""
"Your request could not be handled because of a problem in the server. "
"Error Correlation id is: %s"
msgstr ""
#: magnum/common/exception.py:196
msgid "An unknown exception occurred."
msgstr ""
#: magnum/common/exception.py:246
#, python-format
msgid "The %(name)s %(id)s could not be found."
msgstr ""
#: magnum/common/exception.py:250
#, python-format
msgid "The %(name)s already exists."
msgstr ""
#: magnum/common/exception.py:254
#, python-format
msgid "The %(name)s resource %(id)s could not be found."
msgstr ""
#: magnum/common/exception.py:259
#, python-format
msgid "The %(name)s resource already exists."
msgstr ""
#: magnum/common/exception.py:264
#, python-format
msgid "%(client)s connection failed. %(message)s"
msgstr ""
#: magnum/common/exception.py:268
#, python-format
msgid "Unsupported object type %(objtype)s"
msgstr ""
#: magnum/common/exception.py:272
#, python-format
msgid "Version %(objver)s of %(objname)s is not supported"
msgstr ""
#: magnum/common/exception.py:276
#, python-format
msgid "Cannot call %(method)s on orphaned %(objtype)s object"
msgstr ""
#: magnum/common/exception.py:280
msgid "Unacceptable parameters."
msgstr ""
#: magnum/common/exception.py:285
#, python-format
msgid "Expected a uuid but received %(uuid)s."
msgstr ""
#: magnum/common/exception.py:289
#, python-format
msgid "Expected a name but received %(uuid)s."
msgstr ""
#: magnum/common/exception.py:293
#, python-format
msgid "Expected a name or uuid but received %(uuid)s."
msgstr ""
#: magnum/common/exception.py:297
#, python-format
msgid "Expected an uuid or int but received %(identity)s."
msgstr ""
#: magnum/common/exception.py:305
msgid "Conflict."
msgstr ""
#: magnum/common/exception.py:310
msgid "Invalid resource state."
msgstr ""
#: magnum/common/exception.py:316
#, python-format
msgid "%(err)s"
msgstr ""
#: magnum/common/exception.py:320
#, python-format
msgid ""
"Instance %(instance_uuid)s is already associated with a node, it cannot "
"be associated with this other node %(node)s"
msgstr ""
#: magnum/common/exception.py:325
#, python-format
msgid "Instance %(instance)s could not be found."
msgstr ""
#: magnum/common/exception.py:329
#, python-format
msgid "Couldn't apply patch '%(patch)s'. Reason: %(reason)s"
msgstr ""
#: magnum/common/exception.py:333
msgid "Not authorized."
msgstr ""
#: magnum/common/exception.py:338
msgid "Operation not permitted."
msgstr ""
#: magnum/common/exception.py:342
#, python-format
msgid "Expected a MAC address but received %(mac)s."
msgstr ""
#: magnum/common/exception.py:346
#, python-format
msgid "Invalid configuration file. %(error_msg)s"
msgstr ""
#: magnum/common/exception.py:350 magnum/common/exception.py:387
#: magnum/common/exception.py:403 magnum/common/exception.py:419
#, python-format
msgid "A node with UUID %(uuid)s already exists."
msgstr ""
#: magnum/common/exception.py:354
#, python-format
msgid "Node %(node)s could not be found."
msgstr ""
#: magnum/common/exception.py:358
#, python-format
msgid "Node %(node)s is associated with instance %(instance)s."
msgstr ""
#: magnum/common/exception.py:362
#, python-format
msgid "Failed to establish SSH connection to host %(host)s."
msgstr ""
#: magnum/common/exception.py:366
#, python-format
msgid "Failed to create a file system. File system %(fs)s is not supported."
msgstr ""
#: magnum/common/exception.py:371
#, python-format
msgid "Baymodel %(baymodel)s could not be found."
msgstr ""
#: magnum/common/exception.py:375
#, python-format
msgid "A baymodel with UUID %(uuid)s already exists."
msgstr ""
#: magnum/common/exception.py:379
#, python-format
msgid "Baymodel %(baymodel)s is referenced by one or multiple bays."
msgstr ""
#: magnum/common/exception.py:383
#, python-format
msgid "Bay %(bay)s could not be found."
msgstr ""
#: magnum/common/exception.py:391
#, python-format
msgid "Container %(container)s could not be found."
msgstr ""
#: magnum/common/exception.py:395
#, python-format
msgid "A container with UUID %(uuid)s already exists."
msgstr ""
#: magnum/common/exception.py:399
#, python-format
msgid "Pod %(pod)s could not be found."
msgstr ""
#: magnum/common/exception.py:407
#, python-format
msgid "ReplicationController %(rc)s could not be found."
msgstr ""
#: magnum/common/exception.py:411
#, python-format
msgid "A ReplicationController with UUID %(uuid)s already exists."
msgstr ""
#: magnum/common/exception.py:415
#, python-format
msgid "Service %(service)s could not be found."
msgstr ""
#: magnum/common/exception.py:427
#, python-format
msgid "%(operation)s is not supported."
msgstr ""
#: magnum/common/exception.py:432
#, python-format
msgid "Bay type (%(platform)s, %(os)s, %(coe)s) not supported."
msgstr ""
#: magnum/common/exception.py:436
#, python-format
msgid "Bay type (%(platform)s, %(os)s, %(coe)s) not enabled."
msgstr ""
#: magnum/common/exception.py:440
#, python-format
msgid "Required parameter %(heat_param)s not provided."
msgstr ""
#: magnum/common/exception.py:444
msgid "The urllib2 URL %(url) has an invalid scheme."
msgstr ""
#: magnum/common/exception.py:448
#, python-format
msgid "Bay %(bay_name)s already has an operation in progress."
msgstr ""
#: magnum/common/exception.py:452
#, python-format
msgid "Image %(image_id)s could not be found."
msgstr ""
#: magnum/common/exception.py:456
#, python-format
msgid "Not authorized for image %(image_id)s."
msgstr ""
#: magnum/common/exception.py:460
#, python-format
msgid "Image %(image_id)s doesn't contain os-distro field."
msgstr ""
#: magnum/common/k8s_manifest.py:40
msgid "'manifest' can't be empty"
msgstr ""
#: magnum/common/k8s_manifest.py:49
#, python-format
msgid "Error parsing manifest: %s"
msgstr ""
#: magnum/common/k8s_manifest.py:56
msgid "The manifest is not a JSON object or YAML mapping."
msgstr ""
#: magnum/common/magnum_keystoneclient.py:34
msgid "Subset of trustor roles to be delegated to magnum."
msgstr ""
#: magnum/common/short_id.py:46
#, python-format
msgid "Invalid UUID version (%d)"
msgstr ""
#: magnum/common/urlfetch.py:29
msgid "Maximum raw byte size of any manifest."
msgstr ""
#: magnum/common/urlfetch.py:54
#, python-format
msgid "Invalid URL scheme %s"
msgstr ""
#: magnum/common/urlfetch.py:60 magnum/common/urlfetch.py:84
#, python-format
msgid "Failed to retrieve manifest: %s"
msgstr ""
#: magnum/common/utils.py:118
msgid "Invalid private key"
msgstr ""
#: magnum/conductor/template_definition.py:34
msgid "Location of template to build a k8s cluster on atomic. "
msgstr ""
#: magnum/conductor/template_definition.py:39
msgid "Location of template to build a k8s cluster on coreos. "
msgstr ""
#: magnum/conductor/template_definition.py:45
msgid "coreos discovery token url."
msgstr ""
#: magnum/conductor/template_definition.py:49
msgid "Location of template to build a swarm cluster on atomic. "
msgstr ""
#: magnum/conductor/template_definition.py:53
#, python-format
msgid ""
"Format string to use for swarm discovery url. Available values: bay_id, "
"bay_uuid. Example: \"etcd://etcd.example.com/\\%(bay_uuid)s\" "
msgstr ""
#: magnum/conductor/template_definition.py:58
msgid "Indicates Swarm discovery should use public endpoint."
msgstr ""
#: magnum/conductor/template_definition.py:62
msgid "Url for swarm public discovery endpoint."
msgstr ""
#: magnum/conductor/template_definition.py:66
msgid "Enabled bay definition entry points. "
msgstr ""
#: magnum/conductor/handlers/bay_k8s_heat.py:151
#, python-format
msgid "Updating a bay when stack status is \"%s\""
msgstr ""
#: magnum/conductor/handlers/kube.py:32
msgid "Default protocol of k8s master endpoint (http or https)."
msgstr ""
#: magnum/conductor/handlers/kube.py:36
msgid "Default port of the k8s master endpoint."
msgstr ""
#: magnum/db/sqlalchemy/api.py:230
msgid "Cannot overwrite UUID for an existing Bay."
msgstr ""
#: magnum/db/sqlalchemy/api.py:387
msgid "Cannot overwrite UUID for an existing BayModel."
msgstr ""
#: magnum/db/sqlalchemy/api.py:484
msgid "Cannot overwrite UUID for an existing Container."
msgstr ""
#: magnum/db/sqlalchemy/api.py:580
msgid "Cannot overwrite UUID for an existing Node."
msgstr ""
#: magnum/db/sqlalchemy/api.py:689
msgid "Cannot overwrite UUID for an existing Pod."
msgstr ""
#: magnum/db/sqlalchemy/api.py:795
msgid "Cannot overwrite UUID for an existing Service."
msgstr ""
#: magnum/db/sqlalchemy/api.py:899
msgid "Cannot overwrite UUID for an existing rc."
msgstr ""
#: magnum/db/sqlalchemy/alembic/versions/592131657ca1_add_coe_column_to_baymodel.py:35
msgid "Container Orchestration Environments are kubernetes or swarm. "
msgstr ""
#: magnum/objects/utils.py:40
msgid "A datetime.datetime is required here"
msgstr ""
#: magnum/objects/utils.py:105
#, python-format
msgid "An object of class %s is required here"
msgstr ""
#: magnum/openstack/common/cliutils.py:40
#, python-format
msgid "Missing arguments: %s"
msgstr ""
#: magnum/openstack/common/cliutils.py:158
#, python-format
msgid ""
"Field labels list %(labels)s has different number of elements than fields"
" list %(fields)s"
msgstr ""
#: magnum/openstack/common/log.py:298
#: magnum/openstack/common/versionutils.py:241
#, python-format
msgid "Deprecated: %s"
msgstr ""
#: magnum/openstack/common/log.py:406
#, python-format
msgid "Error loading logging config %(log_config)s: %(err_msg)s"
msgstr ""
#: magnum/openstack/common/log.py:467
#, python-format
msgid "syslog facility must be one of: %s"
msgstr ""
#: magnum/openstack/common/log.py:715
#: magnum/openstack/common/versionutils.py:259
#, python-format
msgid "Fatal call to deprecated config: %(msg)s"
msgstr ""
#: magnum/openstack/common/periodic_task.py:46
#, python-format
msgid "Unexpected argument for periodic task creation: %(arg)s."
msgstr ""
#: magnum/openstack/common/versionutils.py:108
#, python-format
msgid ""
"%(what)s is deprecated as of %(as_of)s in favor of %(in_favor_of)s and "
"may be removed in %(remove_in)s."
msgstr ""
#: magnum/openstack/common/versionutils.py:112
#, python-format
msgid ""
"%(what)s is deprecated as of %(as_of)s and may be removed in "
"%(remove_in)s. It will not be superseded."
msgstr ""
#: magnum/openstack/common/versionutils.py:116
#, python-format
msgid "%(what)s is deprecated as of %(as_of)s in favor of %(in_favor_of)s."
msgstr ""
#: magnum/openstack/common/versionutils.py:119
#, python-format
msgid "%(what)s is deprecated as of %(as_of)s. It will not be superseded."
msgstr ""
#: magnum/tests/unit/common/test_exception.py:21
#, python-format
msgid "templated %(name)s"
msgstr ""
#: magnum/tests/unit/common/test_exception.py:36
#, python-format
msgid "custom templated %(name)s"
msgstr ""

View File

@ -22,7 +22,7 @@ import netaddr
from oslo_utils import timeutils
import six
from magnum.openstack.common._i18n import _
from magnum.i18n import _
def datetime_or_none(dt):

View File

@ -13,7 +13,7 @@
import inspect
from magnum.common import exception
from magnum.openstack.common._i18n import _
from magnum.i18n import _
from magnum.tests import base