[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: drop XenAPI error message translation



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302276171 -3600
# Node ID 892e611b47d89bf351430a0e8015fd9c9061a431
# Parent  8e9f52ea8866f183b7f0bf2f437646d71e9d04c8
xend: drop XenAPI error message translation

The only "translation" is to the C locale (e.g. the NUL
translation). I think it very unlikely we are going to see any new
translations of the XenAPI error messages at this point so the only
purpose of this code appears to be to periodically regenerate
xen-xm.pot with a new embedded timestamp, to the detriment of those of
us who use a version control system.

After much beating with sticks I mananged to enable XenAPI support in
xend and configure xm such that it returns "Permission denied." (AKA
the SESSION_AUTHENTICATION_FAILED message) which I take to be a sign
I've not broken things too badly.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 8e9f52ea8866 -r 892e611b47d8 tools/python/Makefile
--- a/tools/python/Makefile     Fri Apr 08 16:21:12 2011 +0100
+++ b/tools/python/Makefile     Fri Apr 08 16:22:51 2011 +0100
@@ -4,22 +4,13 @@
 .PHONY: all
 all: build
 
-# For each new supported translation, add its name here, eg 'fr_FR'
-# to cause the .po file to be built & installed, eg
-LINGUAS :=
-POPACKAGE := xen-xm
-PODIR := xen/xm/messages
-POTFILE := $(PODIR)/xen-xm.pot
-I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
-CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
-NLSDIR = $(SHAREDIR)/locale
 XENPATH = "xen/util/path.py"
 
 genpath-target = $(call buildmakevars2file,$(XENPATH))
 $(eval $(genpath-target))
 
-.PHONY: build buildpy
-buildpy: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl.idl \
+.PHONY: build
+build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl.idl \
                $(XEN_ROOT)/tools/libxl/libxltypes.py
        PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
                $(XEN_ROOT)/tools/libxl/libxl.idl \
@@ -27,43 +18,8 @@
                xen/lowlevel/xl/_pyxl_types.c
        CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
 
-build: buildpy refresh-pot refresh-po $(CATALOGS)
-
-# NB we take care to only update the .pot file it strings have
-# actually changed. This is complicated by the embedded date
-# string, hence the sed black magic. This avoids the expensive
-# re-generation of .po files on every single build
-refresh-pot: $(I18NSRCFILES)
-       xgettext --default-domain=$(POPACKAGE) \
-               --keyword=N_ \
-               --keyword=_ \
-               -o $(POTFILE)-tmp \
-               $(I18NSRCFILES)
-       sed -f remove-potcdate.sed < $(POTFILE) > $(POTFILE)-1
-       sed -f remove-potcdate.sed < $(POTFILE)-tmp > $(POTFILE)-2
-       set -e; if cmp -s $(POTFILE)-1 $(POTFILE)-2; then \
-               rm -f $(POTFILE)-tmp $(POTFILE)-1 $(POTFILE)-2; \
-       else \
-               mv $(POTFILE)-tmp $(POTFILE); \
-                rm -f $(POTFILE)-1 $(POTFILE)-2; \
-       fi
-
-refresh-po: $(POTFILE)
-       set -e; for l in $(LINGUAS); do \
-               if $(MSGMERGE) $(PODIR)/$$l.po $(POTFILE) > $(PODIR)/$$l-tmp ; 
then \
-                       mv -f $(PODIR)/$$l-tmp $(PODIR)/$$l.po ; \
-                       echo "$(MSGMERGE) of $$l.po succeeded" ; \
-               else \
-                       echo "$(MSGMERGE) of $$l.po failed" ; \
-                       rm -f $(PODIR)/$$l-tmp ; \
-               fi \
-       done
-
-%.mo: %.po
-       $(MSGFMT) -c -o $@ $<
-
 .PHONY: install
-install: install-messages install-dtd
+install: install-dtd
        CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
                $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
 
@@ -71,17 +27,6 @@
        $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/xen
        $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)$(SHAREDIR)/xen
 
-install-messages: all
-       set -e; if which $(MSGFMT) >/dev/null ; then \
-               $(INSTALL_DIR) $(DESTDIR)$(NLSDIR); \
-               for l in $(LINGUAS); do \
-                       $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l; \
-                       $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES; \
-                       $(INSTALL_DATA) $(PODIR)/$$l.mo \
-                               
$(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES/$(POPACKAGE).mo; \
-               done ; \
-       fi
-
 .PHONY: test
 test:
        export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f 
../xenstore); $(PYTHON) test.py -b -u
@@ -89,7 +34,7 @@
 .PHONY: clean
 clean:
        rm -f $(XENPATH)
-       rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/auxbin.pyc
+       rm -rf *.pyc *.pyo *.o *.a *~ xen/util/auxbin.pyc
        rm -f xen/lowlevel/xl/_pyxl_types.h
        rm -f xen/lowlevel/xl/_pyxl_types.c
        rm -f $(DEPS)
diff -r 8e9f52ea8866 -r 892e611b47d8 tools/python/remove-potcdate.sed
--- a/tools/python/remove-potcdate.sed  Fri Apr 08 16:21:12 2011 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-# Sed script that remove the POT-Creation-Date line in the header entry
-# from a POT file.
-#
-# The distinction between the first and the following occurrences of the
-# pattern is achieved by looking at the hold space.
-/^"POT-Creation-Date: .*"$/{
-x
-# Test if the hold space is empty.
-s/P/P/
-ta
-# Yes it was empty. First occurrence. Remove the line.
-g
-d
-bb
-:a
-# The hold space was nonempty. Following occurrences. Do nothing.
-x
-:b
-}
diff -r 8e9f52ea8866 -r 892e611b47d8 tools/python/xen/xm/XenAPI.py
--- a/tools/python/xen/xm/XenAPI.py     Fri Apr 08 16:21:12 2011 +0100
+++ b/tools/python/xen/xm/XenAPI.py     Fri Apr 08 16:22:51 2011 +0100
@@ -44,31 +44,23 @@
 # OF THIS SOFTWARE.
 # --------------------------------------------------------------------
 
-import gettext
 import xmlrpclib
 
 import xen.util.xmlrpcclient as xmlrpcclient
 
-def gettext_noop(str):
-    return str
-
-N_ = gettext_noop
-
 errormap = {
-    "INTERNAL_ERROR": N_("Internal error: %(1)s."),
-    "MAP_DUPLICATE_KEY": N_("This map already contains %(1)s -> %(2)s."),
-    "MESSAGE_METHOD_UNKNOWN": N_("The method %(1)s is unsupported."),
-    "MESSAGE_PARAMETER_COUNT_MISMATCH": N_("The method %(1)s takes %(2)s 
argument(s) (%(3)s given)."),
-    "SESSION_AUTHENTICATION_FAILED": N_("Permission denied."),
-    "VALUE_NOT_SUPPORTED": N_("Value \"%(2)s\" for %(1)s is not supported by 
this server.  The server said \"%(3)s\"."),
-    "HANDLE_INVALID": N_("The %(1)s handle %(2)s is invalid."),
-    "OPERATION_NOT_ALLOWED": N_("You attempted an operation that was not 
allowed."),
-    "NETWORK_ALREADY_CONNECTED": N_("The network you specified already has a 
PIF attached to it, and so another one may not be attached."),
-    "SECURITY_ERROR": N_("%(2)s"),
+    "INTERNAL_ERROR": "Internal error: %(1)s.",
+    "MAP_DUPLICATE_KEY": "This map already contains %(1)s -> %(2)s.",
+    "MESSAGE_METHOD_UNKNOWN": "The method %(1)s is unsupported.",
+    "MESSAGE_PARAMETER_COUNT_MISMATCH": "The method %(1)s takes %(2)s 
argument(s) (%(3)s given).",
+    "SESSION_AUTHENTICATION_FAILED": "Permission denied.",
+    "VALUE_NOT_SUPPORTED": "Value \"%(2)s\" for %(1)s is not supported by this 
server.  The server said \"%(3)s\".",
+    "HANDLE_INVALID": "The %(1)s handle %(2)s is invalid.",
+    "OPERATION_NOT_ALLOWED": "You attempted an operation that was not 
allowed.",
+    "NETWORK_ALREADY_CONNECTED": "The network you specified already has a PIF 
attached to it, and so another one may not be attached.",
+    "SECURITY_ERROR": "%(2)s",
     }
 
-translation = gettext.translation('xen-xm', fallback = True)
-
 class Failure(Exception):
     def __init__(self, details):
         try:
@@ -85,7 +77,7 @@
 
     def __str__(self):
         try:
-            return translation.ugettext(errormap[self.details[0]]) % 
self._details_map()
+            return errormap[self.details[0]] % self._details_map()
         except TypeError, exn:
             return "Message database broken: %s.\nXen-API failure: %s" % \
                    (exn, str(self.details))
diff -r 8e9f52ea8866 -r 892e611b47d8 tools/python/xen/xm/messages/en/xen-xm.po
--- a/tools/python/xen/xm/messages/en/xen-xm.po Fri Apr 08 16:21:12 2011 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-# ============================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-# 
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-# ============================================================================
-# Copyright (c) 2006-2007 XenSource Inc.
-# ============================================================================
-# 
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Xen-xm 3.0\n"
-"PO-Revision-Date: 2007-03-29 16:13+0100\n"
-"Last-Translator: Ewan Mellor <ewan@xxxxxxxxxxxxx>\n"
-"Language-Team: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ASCII\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "INTERNAL_ERROR"
-msgstr "Internal error: %(1)s."
-
-msgid "MAP_DUPLICATE_KEY"
-msgstr "This map already contains %(1)s -> %(2)s."
-
-msgid "MESSAGE_METHOD_UNKNOWN"
-msgstr "The method %(1)s is unsupported."
-
-msgid "MESSAGE_PARAMETER_COUNT_MISMATCH"
-msgstr "The method %(1)s takes %(2)s argument(s) (%(3)s given)."
-
-msgid "SESSION_AUTHENTICATION_FAILED"
-msgstr "Permission denied."
-
-msgid "VALUE_NOT_SUPPORTED"
-msgstr "Value \"%(2)s\" for %(1)s is not supported by this server.  The server 
said \"%(3)s\"."
-
-msgid "HANDLE_INVALID"
-msgstr "The %(1)s handle %(2)s is invalid."
-
-msgid "OPERATION_NOT_ALLOWED"
-msgstr "You attempted an operation that was not allowed."
-
-msgid "NETWORK_ALREADY_CONNECTED"
-msgstr "The network you specified already has a PIF attached to it, and so 
another one may not be attached."
-
-msgid "PIF_IS_PHYSICAL"
-msgstr "The PIF %(1)s corresponds to a physical interface, and so may not be 
destroyed."
-
-msgid "VLAN_TAG_INVALID"
-msgstr "The VLAN tag you gave (%(1)s) is invalid -- it must be between 0 and 
4095."
-
-msgid "VM_BAD_POWER_STATE"
-msgstr "The VM must be %(2)s to perform the requested operation (it is 
currently %(3)s)."
-
-msgid "VM_HVM_REQUIRED"
-msgstr "HVM guest support is unavailable: is VT/AMD-V supported by your CPU 
and enabled in your BIOS?"
-
-msgid "SESSION_NOT_REGISTERED"
-msgstr "This session is not registered to receive events.  You must call 
event.register before event.next.  (Session handle is %(1)s.)"
-
-msgid "CREATE_UNSPECIFIED_ATTRIBUTE"
-msgstr "You need to specify %s when creating a new %s"
- 
-msgid "UNMANAGED_NETWORK_ERROR"
-msgstr "Cannot change %s on an unmanaged network"
- 
-msgid "UNIQUE_NAME_ERROR"
-msgstr "Name %s for class %s is not unique"
-
-msgid "INVALID_DEVICE_ERROR"
-msgstr "Invalid device %s"
-
-msgid "DEVICE_EXISTS_ERROR"
-msgstr "Device already exists %s"
-
-msgid "IMPLEMENTATION_ERROR"
-msgstr "Class %s does not implement %s"
-
-msgid "VLAN_TAG_INVALID"
-msgstr "VLAN tag invalid %s"
-
-msgid "NETWORK_ERROR"
-msgstr "Network Error: %s - %s"
\ No newline at end of file
diff -r 8e9f52ea8866 -r 892e611b47d8 tools/python/xen/xm/messages/xen-xm.pot
--- a/tools/python/xen/xm/messages/xen-xm.pot   Fri Apr 08 16:21:12 2011 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-31 18:00+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@xxxxxx>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: xen/xm/XenAPI.py:58
-#, python-format
-msgid "Internal error: %(1)s."
-msgstr ""
-
-#: xen/xm/XenAPI.py:59
-#, python-format
-msgid "This map already contains %(1)s -> %(2)s."
-msgstr ""
-
-#: xen/xm/XenAPI.py:60
-#, python-format
-msgid "The method %(1)s is unsupported."
-msgstr ""
-
-#: xen/xm/XenAPI.py:61
-#, python-format
-msgid "The method %(1)s takes %(2)s argument(s) (%(3)s given)."
-msgstr ""
-
-#: xen/xm/XenAPI.py:62
-msgid "Permission denied."
-msgstr ""
-
-#: xen/xm/XenAPI.py:63
-#, python-format
-msgid ""
-"Value \"%(2)s\" for %(1)s is not supported by this server.  The server said "
-"\"%(3)s\"."
-msgstr ""
-
-#: xen/xm/XenAPI.py:64
-#, python-format
-msgid "The %(1)s handle %(2)s is invalid."
-msgstr ""
-
-#: xen/xm/XenAPI.py:65
-msgid "You attempted an operation that was not allowed."
-msgstr ""
-
-#: xen/xm/XenAPI.py:66
-msgid ""
-"The network you specified already has a PIF attached to it, and so another "
-"one may not be attached."
-msgstr ""
-
-#: xen/xm/XenAPI.py:67
-#, python-format
-msgid "%(2)s"
-msgstr ""

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.