All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>, SE Linux <selinux@tycho.nsa.gov>
Subject: Translation patch for seobject.py
Date: Thu, 11 Jan 2007 09:08:31 -0500	[thread overview]
Message-ID: <45A644DF.9050005@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: policycoreuitls-seobject.patch --]
[-- Type: text/x-patch, Size: 4196 bytes --]

diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/semanage/seobject.py policycoreutils-1.33.10/semanage/seobject.py
--- nsapolicycoreutils/semanage/seobject.py	2007-01-11 08:56:30.000000000 -0500
+++ policycoreutils-1.33.10/semanage/seobject.py	2007-01-09 11:56:46.000000000 -0500
@@ -23,13 +23,16 @@
 
 import pwd, string, selinux, tempfile, os, re, sys
 from semanage import *;
-import gettext
+PROGNAME="policycoreutils"
 
+import gettext
+gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
+gettext.textdomain(PROGNAME)
 try:
-       t = gettext.translation('policycoreutils', '/usr/share/locale')
-       _ = t.ugettext
-except:
-       pass
+       gettext.install(PROGNAME, localedir="/usr/share/locale", unicode=1)
+except IOError:
+       import __builtin__
+       __builtin__.__dict__['_'] = unicode
 
 is_mls_enabled = selinux.is_selinux_mls_enabled()
 
@@ -168,7 +171,7 @@
 	
 	def list(self,heading = 1):
 		if heading:
-			print "\n%-25s %s\n" % ("Level", "Translation")
+			print "\n%-25s %s\n" % (_("Level"), _("Translation"))
 		keys = self.ddict.keys()
 		keys.sort()
 		for k in keys:
@@ -288,10 +289,10 @@
 				raise ValueError(_("Could not add login mapping for %s") % name)
 
 		except ValueError, error:
-			mylog.log(0, "add SELinux user mapping", name, sename, "", serange);
+			mylog.log(0, _("add SELinux user mapping"), name, sename, "", serange);
 			raise error
 		
-		mylog.log(1, "add SELinux user mapping", name, sename, "", serange);
+		mylog.log(1, _("add SELinux user mapping"), name, sename, "", serange);
 		semanage_seuser_key_free(k)
 		semanage_seuser_free(u)
 
@@ -403,12 +404,12 @@
 		keys.sort()
 		if is_mls_enabled == 1:
 			if heading:
-				print "\n%-25s %-25s %-25s\n" % ("Login Name", "SELinux User", "MLS/MCS Range")
+				print "\n%-25s %-25s %-25s\n" % (_("Login Name"), _("SELinux User"), _("MLS/MCS Range"))
 			for k in keys:
 				print "%-25s %-25s %-25s" % (k, ddict[k][0], translate(ddict[k][1]))
 		else:
 			if heading:
-				print "\n%-25s %-25s\n" % ("Login Name", "SELinux User")
+				print "\n%-25s %-25s\n" % (_("Login Name"), _("SELinux User"))
 			for k in keys:
 				print "%-25s %-25s" % (k, ddict[k][0])
 
@@ -617,13 +621,13 @@
 		keys.sort()
 		if is_mls_enabled == 1:
 			if heading:
-				print "\n%-15s %-10s %-10s %-30s" % ("", "Labeling", "MLS/", "MLS/")
-				print "%-15s %-10s %-10s %-30s %s\n" % ("SELinux User", "Prefix", "MCS Level", "MCS Range", "SELinux Roles")
+				print "\n%-15s %-10s %-10s %-30s" % ("", _("Labeling"), _("MLS/"), _("MLS/"))
+				print "%-15s %-10s %-10s %-30s %s\n" % (_("SELinux User"), _("Prefix"), _("MCS Level"), _("MCS Range"), _("SELinux Roles"))
 			for k in keys:
 				print "%-15s %-10s %-10s %-30s %s" % (k, ddict[k][0], translate(ddict[k][1]), translate(ddict[k][2]), ddict[k][3])
 		else:
 			if heading:
-				print "%-15s %s\n" % ("SELinux User", "SELinux Roles")
+				print "%-15s %s\n" % (_("SELinux User"), _("SELinux Roles"))
 			for k in keys:
 				print "%-15s %s" % (k, ddict[k][3])
 
@@ -832,7 +836,7 @@
 
 	def list(self, heading = 1):
 		if heading:
-			print "%-30s %-8s %s\n" % ("SELinux Port Type", "Proto", "Port Number")
+			print "%-30s %-8s %s\n" % (_("SELinux Port Type"), _("Proto"), _("Port Number"))
 		ddict = self.get_all_by_type()
 		keys = ddict.keys()
 		keys.sort()
@@ -1002,7 +1006,7 @@
 			
 	def list(self, heading = 1):
 		if heading:
-			print "%-30s %s\n" % ("SELinux Interface", "Context")
+			print "%-30s %s\n" % (_("SELinux Interface"), _("Context"))
 		ddict = self.get_all()
 		keys = ddict.keys()
 		keys.sort()
@@ -1186,7 +1190,7 @@
 			
 	def list(self, heading = 1):
 		if heading:
-			print "%-50s %-18s %s\n" % ("SELinux fcontext", "type", "Context")
+			print "%-50s %-18s %s\n" % (_("SELinux fcontext"), _("type"), _("Context"))
 		fcon_list = self.get_all()
 		for fcon in fcon_list:
 			if len(fcon) > 3:
@@ -1284,7 +1288,7 @@
 			
 	def list(self, heading = 1):
 		if heading:
-			print "%-50s %-18s\n" % ("SELinux boolean", "value")
+			print "%-50s %-18s\n" % (_("SELinux boolean"), _("value"))
 		ddict = self.get_all()
 		keys = ddict.keys()
 		for k in keys:

                 reply	other threads:[~2007-01-11 14:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45A644DF.9050005@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.