From 201e727a1fc571f3a56763dc044a58504cc89af6 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 25 May 2007 17:40:23 -0400 Subject: Starting to add i18n to cobbler using rhpl --- MANIFEST.in | 18 ++++++------------ Makefile | 11 +++++++++-- cobbler.spec | 1 + cobbler/action_check.py | 1 + cobbler/action_enchant.py | 2 ++ cobbler/action_import.py | 1 + cobbler/action_litesync.py | 2 ++ cobbler/action_status.py | 3 +++ cobbler/action_sync.py | 3 +++ cobbler/cexceptions.py | 3 +++ cobbler/cobbler.py | 5 +++++ cobbler/cobbler_msg.py | 3 +++ cobbler/cobblerd.py | 2 ++ cobbler/collection_distros.py | 1 + cobbler/collection_profiles.py | 2 ++ cobbler/collection_repos.py | 2 ++ cobbler/collection_systems.py | 2 ++ cobbler/config.py | 3 +++ cobbler/item.py | 1 + cobbler/item_distro.py | 2 ++ cobbler/item_profile.py | 2 ++ cobbler/item_repo.py | 1 + cobbler/item_system.py | 2 ++ cobbler/serializable.py | 1 + cobbler/serializer.py | 2 ++ cobbler/settings.py | 1 + cobbler/utils.py | 2 ++ po/Makefile | 14 ++++++++++++++ 28 files changed, 79 insertions(+), 14 deletions(-) create mode 100644 po/Makefile diff --git a/MANIFEST.in b/MANIFEST.in index e15b0394..eda9acd5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,19 +2,13 @@ include loaders/COPYING_ELILO include loaders/elilo-3.6-ia64.efi include loaders/menu.c32 include config/cobbler.conf -include templates/dhcp.template -include templates/dnsmasq.template -include templates/pxeprofile.template -include templates/pxedefault.template -include templates/pxesystem.template -include templates/pxesystem_ia64.template -include kickstarts/kickstart_fc5.ks -include kickstarts/kickstart_fc6.ks -include kickstarts/kickstart_fc6_domU.ks -include kickstarts/default.ks +include config/rsync.exclude +include config/cobblerd +recursive-include templates *.template +recursive-include kickstarts *.ks include docs/cobbler.1.gz include COPYING AUTHORS README CHANGELOG NEWS -include config/rsync.exclude include scripts/watcher.py include scripts/cobblerd -include config/cobblerd +recursive-include po *.pot +recursive-include po *.po diff --git a/Makefile b/Makefile index 6fa532a4..769bbb0a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +MESSAGESPOT=po/messages.pot + all: rpms clean: @@ -15,15 +17,20 @@ test: python tests/tests.py -rm -rf /tmp/_cobbler-* -build: clean +build: clean messages python setup.py build -f install: clean python setup.py install -f -sdist: clean +sdist: clean messages python setup.py sdist +messages: cobbler/*.py + xgettext -k_ -kN_ -o $(MESSAGESPOT) cobbler/*.py + sed -i'~' -e 's/SOME DESCRIPTIVE TITLE/cobbler/g' -e 's/YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/2007 Red Hat, Inc. /g' -e 's/FIRST AUTHOR , YEAR/Michael DeHaan , 2007/g' -e 's/PACKAGE VERSION/cobbler $(VERSION)-$(RELEASE)/g' -e 's/PACKAGE/cobbler/g' $(MESSAGESPOT) + + rpms: manpage sdist mkdir -p rpm-build cp dist/*.gz rpm-build/ diff --git a/cobbler.spec b/cobbler.spec index c2809b4b..a18a0539 100644 --- a/cobbler.spec +++ b/cobbler.spec @@ -14,6 +14,7 @@ Requires: createrepo Requires: mod_python Requires: python-cheetah Requires: yum-utils +Requires: rhpl %ifarch i386 i686 x86_64 Requires: syslinux %endif diff --git a/cobbler/action_check.py b/cobbler/action_check.py index 49ba1743..17f4292a 100644 --- a/cobbler/action_check.py +++ b/cobbler/action_check.py @@ -17,6 +17,7 @@ import os import re import cobbler_msg import action_sync +from rhpl.translate import _, N_, textdomain, utf8 class BootCheck: diff --git a/cobbler/action_enchant.py b/cobbler/action_enchant.py index a911c94d..260d1348 100644 --- a/cobbler/action_enchant.py +++ b/cobbler/action_enchant.py @@ -18,6 +18,8 @@ import os import os.path import sub_process import traceback +from rhpl.translate import _, N_, textdomain, utf8 + class Enchant: diff --git a/cobbler/action_import.py b/cobbler/action_import.py index cd623a0c..61c2d84b 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -23,6 +23,7 @@ import glob import api import utils import shutil +from rhpl.translate import _, N_, textdomain, utf8 WGET_CMD = "wget --mirror --no-parent --no-host-directories --directory-prefix %s/%s %s" RSYNC_CMD = "rsync -a %s %s %s/ks_mirror/%s --exclude-from=/etc/cobbler/rsync.exclude --delete --delete-excluded --progress" diff --git a/cobbler/action_litesync.py b/cobbler/action_litesync.py index c08690b6..51369eec 100644 --- a/cobbler/action_litesync.py +++ b/cobbler/action_litesync.py @@ -32,6 +32,8 @@ import cexceptions import traceback import errno +from rhpl.translate import _, N_, textdomain, utf8 + class BootLiteSync: """ diff --git a/cobbler/action_status.py b/cobbler/action_status.py index b3e94a2e..9571d938 100644 --- a/cobbler/action_status.py +++ b/cobbler/action_status.py @@ -19,6 +19,9 @@ import glob import time import cobbler_msg +from rhpl.translate import _, N_, textdomain, utf8 + + class BootStatusReport: def __init__(self,config,mode): diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index d263aa3d..226f5c05 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -34,6 +34,9 @@ import item_system from Cheetah.Template import Template +from rhpl.translate import _, N_, textdomain, utf8 + + class BootSync: """ Handles conversion of internal state to the tftpboot tree layout diff --git a/cobbler/cexceptions.py b/cobbler/cexceptions.py index 1052abec..a6e03dc1 100644 --- a/cobbler/cexceptions.py +++ b/cobbler/cexceptions.py @@ -15,6 +15,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import exceptions import cobbler_msg +from rhpl.translate import _, N_, textdomain, utf8 + + class CobblerException(exceptions.Exception): def __init__(self, value, *args): diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py index 77e8a81b..1264d230 100755 --- a/cobbler/cobbler.py +++ b/cobbler/cobbler.py @@ -23,6 +23,9 @@ import traceback import cobbler_msg import cexceptions +from rhpl.translate import _, N_, textdomain, utf8 +I18N_DOMAIN = "cobbler" + LOCKING_ENABLED = True LOCKFILE="/var/lib/cobbler/lock" @@ -33,6 +36,7 @@ class BootCLI: """ Build the command line parser and API instances, etc. """ + textdomain(I18N_DOMAIN) self.args = args self.api = api.BootAPI() self.commands = {} @@ -680,4 +684,5 @@ def main(): return exitcode if __name__ == "__main__": + print _("Testing") sys.exit(main()) diff --git a/cobbler/cobbler_msg.py b/cobbler/cobbler_msg.py index d9f3183d..a98ca774 100644 --- a/cobbler/cobbler_msg.py +++ b/cobbler/cobbler_msg.py @@ -16,6 +16,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ +from rhpl.translate import _, N_, textdomain, utf8 + + USAGE = """cobbler provisioning tool basic usage guide / see "man cobbler" for more. diff --git a/cobbler/cobblerd.py b/cobbler/cobblerd.py index 263c9d52..9a384e98 100644 --- a/cobbler/cobblerd.py +++ b/cobbler/cobblerd.py @@ -17,6 +17,8 @@ import SimpleXMLRPCServer import yaml # Howell Clark version import api as cobbler_api +from rhpl.translate import _, N_, textdomain, utf8 + # hack to make xmlrpclib tolerate None: # http://www.thescripts.com/forum/thread499321.html diff --git a/cobbler/collection_distros.py b/cobbler/collection_distros.py index 8662adf9..dfcf8d4e 100644 --- a/cobbler/collection_distros.py +++ b/cobbler/collection_distros.py @@ -18,6 +18,7 @@ import collection import item_distro as distro import cexceptions import action_litesync +from rhpl.translate import _, N_, textdomain, utf8 TESTMODE = False diff --git a/cobbler/collection_profiles.py b/cobbler/collection_profiles.py index 84253912..8a43b0ee 100644 --- a/cobbler/collection_profiles.py +++ b/cobbler/collection_profiles.py @@ -20,6 +20,8 @@ import utils import collection import cexceptions import action_litesync +from rhpl.translate import _, N_, textdomain, utf8 + TESTMODE = False diff --git a/cobbler/collection_repos.py b/cobbler/collection_repos.py index 18d41790..6596a661 100644 --- a/cobbler/collection_repos.py +++ b/cobbler/collection_repos.py @@ -18,6 +18,8 @@ import item_repo as repo import utils import collection import cexceptions +from rhpl.translate import _, N_, textdomain, utf8 + TESTMODE = False diff --git a/cobbler/collection_systems.py b/cobbler/collection_systems.py index 139a71d3..a336487f 100644 --- a/cobbler/collection_systems.py +++ b/cobbler/collection_systems.py @@ -18,6 +18,8 @@ import utils import collection import cexceptions import action_litesync +from rhpl.translate import _, N_, textdomain, utf8 + TESTMODE = False diff --git a/cobbler/config.py b/cobbler/config.py index 3a9bd79a..92bd9b5d 100644 --- a/cobbler/config.py +++ b/cobbler/config.py @@ -28,6 +28,9 @@ import collection_repos as repos import settings import serializer +from rhpl.translate import _, N_, textdomain, utf8 + + class Config: has_loaded = False diff --git a/cobbler/item.py b/cobbler/item.py index 1ccc84db..d4be1c7f 100644 --- a/cobbler/item.py +++ b/cobbler/item.py @@ -15,6 +15,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import exceptions import serializable import utils +from rhpl.translate import _, N_, textdomain, utf8 class Item(serializable.Serializable): diff --git a/cobbler/item_distro.py b/cobbler/item_distro.py index 3f5dcce6..40a8a7eb 100644 --- a/cobbler/item_distro.py +++ b/cobbler/item_distro.py @@ -20,6 +20,8 @@ import weakref import os import cexceptions +from rhpl.translate import _, N_, textdomain, utf8 + class Distro(item.Item): #def __init__(self,config): diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py index 0bd4b05e..9e5f23d0 100644 --- a/cobbler/item_profile.py +++ b/cobbler/item_profile.py @@ -16,6 +16,8 @@ import utils import item import cexceptions +from rhpl.translate import _, N_, textdomain, utf8 + class Profile(item.Item): #def __init__(self,config): diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py index 04327ec4..9592ad2c 100644 --- a/cobbler/item_repo.py +++ b/cobbler/item_repo.py @@ -15,6 +15,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import utils import item import cexceptions +from rhpl.translate import _, N_, textdomain, utf8 # TODO: if distribution is detected FC6 or greater, auto-add the mirror stanza # to the kickstart. diff --git a/cobbler/item_system.py b/cobbler/item_system.py index e4810979..10a95936 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -15,6 +15,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import utils import item import cexceptions +from rhpl.translate import _, N_, textdomain, utf8 + class System(item.Item): diff --git a/cobbler/serializable.py b/cobbler/serializable.py index 62dfd012..ba8f0156 100644 --- a/cobbler/serializable.py +++ b/cobbler/serializable.py @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ +from rhpl.translate import _, N_, textdomain, utf8 import exceptions class Serializable: diff --git a/cobbler/serializer.py b/cobbler/serializer.py index 9a4925c7..b74d6aa3 100644 --- a/cobbler/serializer.py +++ b/cobbler/serializer.py @@ -19,6 +19,8 @@ import os import cexceptions import utils +from rhpl.translate import _, N_, textdomain, utf8 + def serialize(obj): """ Save an object to disk. Object must "implement" Serializable. diff --git a/cobbler/settings.py b/cobbler/settings.py index 58995a43..406da12a 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -14,6 +14,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import serializable import utils +from rhpl.translate import _, N_, textdomain, utf8 TESTMODE = False diff --git a/cobbler/utils.py b/cobbler/utils.py index e6585835..3acf4c6e 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -20,6 +20,8 @@ import sub_process import shutil import string import traceback +from rhpl.translate import _, N_, textdomain, utf8 + _re_kernel = re.compile(r'vmlinuz(.*)') _re_initrd = re.compile(r'initrd(.*).img') diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 00000000..ac8f6b9d --- /dev/null +++ b/po/Makefile @@ -0,0 +1,14 @@ +# +# copied from the gpodder makefile by Thomas Perl, also GPL + +update: + for langfile in *.po; do echo 'Compiling translation:' $${langfile}; mkdir -p ../locale/`basename $${langfile} .po`/LC_MESSAGES/; msgfmt $${langfile} -o ../locale/`basename $${langfile} .po`/LC_MESSAGES/vf_node_server.mo; done + +generators: + for langfile in *.po; do echo -n $${langfile}; msgmerge -U $${langfile} ../messages.pot; done + +clean: + rm -rf ../locale *~ *.mo + +.PHONY: update generators clean + -- cgit