Merge lp:~kelemeng/software-properties/bug945245 into lp:software-properties

Proposed by Robert Roth
Status: Merged
Merged at revision: 757
Proposed branch: lp:~kelemeng/software-properties/bug945245
Merge into: lp:software-properties
Diff against target: 93 lines (+26/-14)
1 file modified
add-apt-repository (+26/-14)
To merge this branch: bzr merge lp:~kelemeng/software-properties/bug945245
Reviewer Review Type Date Requested Status
Timo Aaltonen Approve
Robert Roth (community) Approve
Review via email: mp+95726@code.launchpad.net

Description of the change

I18n fixes proposed by Gabor Kelemen for bug #945245.

To post a comment you must log in.
Revision history for this message
Robert Roth (evfool) wrote :

The fixes seem to be ok, and harmless.

review: Approve
Revision history for this message
Timo Aaltonen (tjaalton) :
review: Approve
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

needs a changelog entry though

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'add-apt-repository'
--- add-apt-repository 2012-01-26 20:41:08 +0000
+++ add-apt-repository 2012-03-03 08:16:18 +0000
@@ -30,16 +30,23 @@
30 lp = Launchpad.login_anonymously(lp_application_name, "production")30 lp = Launchpad.login_anonymously(lp_application_name, "production")
31 try:31 try:
32 user_inst = lp.people[user]32 user_inst = lp.people[user]
33 entity_name = "team" if user_inst.is_team else "user"33 entity_name = _("team") if user_inst.is_team else _("user")
34 if len(user_inst.ppas) > 0:34 if len(user_inst.ppas) > 0:
35 print _("The %s named '%s' has no PPA named '%s'" 35 # Translators: %(entity)s is either "team" or "user"
36 %(entity_name, user, ppa_name))36 print _("The %(entity)s named '%(user)s' has no PPA named '%(ppa)s'") % {
37 'entity' : entity_name,
38 'user' : user,
39 'ppa' : ppa_name}
37 print _("Please choose from the following available PPAs:")40 print _("Please choose from the following available PPAs:")
38 for ppa in user_inst.ppas:41 for ppa in user_inst.ppas:
39 print _(" * '%s': %s" %(ppa.name, ppa.displayname))42 print _(" * '%(name)s': %(displayname)s") % {
43 'name' : ppa.name,
44 'displayname' : ppa.displayname}
40 else:45 else:
41 print _("The %s named '%s' does not have any PPA"46 # Translators: %(entity)s is either "team" or "user"
42 %(entity_name, user))47 print _("The %(entity)s named '%(user)s' does not have any PPA") % {
48 'entity' : entity_name,
49 'user' : user}
43 except KeyError:50 except KeyError:
44 pass51 pass
45 except ImportError:52 except ImportError:
@@ -63,6 +70,11 @@
63 locale.setlocale(locale.LC_ALL, "")70 locale.setlocale(locale.LC_ALL, "")
64 except:71 except:
65 pass72 pass
73 gettext.textdomain("software-properties")
74 #FIXME: Workaround a bug in optparser which doesn't handle unicode/str
75 # correctly, see http://bugs.python.org/issue4391
76 # Shoudl be resolved by Python3
77 enc = locale.getpreferredencoding()
66 usage = """Usage: %prog <sourceline>78 usage = """Usage: %prog <sourceline>
6779
68%prog is a script for adding apt sources.list entries. 80%prog is a script for adding apt sources.list entries.
@@ -90,16 +102,16 @@
90 # puts the line into a specific file in sources.list.d102 # puts the line into a specific file in sources.list.d
91 parser.add_option ("-m", "--massive-debug", action="store_true",103 parser.add_option ("-m", "--massive-debug", action="store_true",
92 dest="massive_debug", default=False,104 dest="massive_debug", default=False,
93 help="Print a lot of debug information to the command line")105 help=_("Print a lot of debug information to the command line").decode(enc))
94 parser.add_option("-r", "--remove", action="store_true",106 parser.add_option("-r", "--remove", action="store_true",
95 dest="remove", default=False,107 dest="remove", default=False,
96 help="remove repository from sources.list.d directory")108 help=_("remove repository from sources.list.d directory").decode(enc))
97 parser.add_option("-k", "--keyserver",109 parser.add_option("-k", "--keyserver",
98 dest="keyserver", default=DEFAULT_KEYSERVER,110 dest="keyserver", default=DEFAULT_KEYSERVER,
99 help="URL of keyserver. Default: %default")111 help=_("URL of keyserver. Default: %default").decode(enc))
100 parser.add_option("-y", "--yes", action="store_true",112 parser.add_option("-y", "--yes", action="store_true",
101 dest="assume_yes", default=False,113 dest="assume_yes", default=False,
102 help="Assume yes to all queries")114 help=_("Assume yes to all queries").decode(enc))
103 (options, args) = parser.parse_args()115 (options, args) = parser.parse_args()
104116
105 if os.geteuid() != 0:117 if os.geteuid() != 0:
@@ -126,7 +138,7 @@
126 except HTTPError:138 except HTTPError:
127 print _("Cannot add PPA: '%s'.") % line139 print _("Cannot add PPA: '%s'.") % line
128 if user.startswith("~"):140 if user.startswith("~"):
129 print _("Did you mean 'ppa:%s/%s' ?" %(user[1:], ppa_name))141 print _("Did you mean 'ppa:%s/%s' ?") %(user[1:], ppa_name)
130 sys.exit(1) # Exit because the user cannot be correct142 sys.exit(1) # Exit because the user cannot be correct
131 # If the PPA does not exist, then try to find if the user/team 143 # If the PPA does not exist, then try to find if the user/team
132 # exists. If it exists, list down the PPAs144 # exists. If it exists, list down the PPAs
@@ -167,14 +179,14 @@
167 try:179 try:
168 sp.remove_source(deb_entry)180 sp.remove_source(deb_entry)
169 except ValueError:181 except ValueError:
170 print _("Error: '%s' doesn't exist in a sourcelist file" % deb_line)182 print _("Error: '%s' doesn't exist in a sourcelist file") % deb_line
171 try:183 try:
172 sp.remove_source(debsrc_entry)184 sp.remove_source(debsrc_entry)
173 except ValueError:185 except ValueError:
174 print _("Error: '%s' doesn't exist in a sourcelist file" % debsrc_line)186 print _("Error: '%s' doesn't exist in a sourcelist file") % debsrc_line
175187
176 else:188 else:
177 if not sp.add_source_from_line(line):189 if not sp.add_source_from_line(line):
178 print _("Error: '%s' invalid" % line)190 print _("Error: '%s' invalid") % line
179 sys.exit(1)191 sys.exit(1)
180 sp.sourceslist.save()192 sp.sourceslist.save()

Subscribers

People subscribed via source and target branches

to status/vote changes: