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
1=== modified file 'add-apt-repository'
2--- add-apt-repository 2012-01-26 20:41:08 +0000
3+++ add-apt-repository 2012-03-03 08:16:18 +0000
4@@ -30,16 +30,23 @@
5 lp = Launchpad.login_anonymously(lp_application_name, "production")
6 try:
7 user_inst = lp.people[user]
8- entity_name = "team" if user_inst.is_team else "user"
9+ entity_name = _("team") if user_inst.is_team else _("user")
10 if len(user_inst.ppas) > 0:
11- print _("The %s named '%s' has no PPA named '%s'"
12- %(entity_name, user, ppa_name))
13+ # Translators: %(entity)s is either "team" or "user"
14+ print _("The %(entity)s named '%(user)s' has no PPA named '%(ppa)s'") % {
15+ 'entity' : entity_name,
16+ 'user' : user,
17+ 'ppa' : ppa_name}
18 print _("Please choose from the following available PPAs:")
19 for ppa in user_inst.ppas:
20- print _(" * '%s': %s" %(ppa.name, ppa.displayname))
21+ print _(" * '%(name)s': %(displayname)s") % {
22+ 'name' : ppa.name,
23+ 'displayname' : ppa.displayname}
24 else:
25- print _("The %s named '%s' does not have any PPA"
26- %(entity_name, user))
27+ # Translators: %(entity)s is either "team" or "user"
28+ print _("The %(entity)s named '%(user)s' does not have any PPA") % {
29+ 'entity' : entity_name,
30+ 'user' : user}
31 except KeyError:
32 pass
33 except ImportError:
34@@ -63,6 +70,11 @@
35 locale.setlocale(locale.LC_ALL, "")
36 except:
37 pass
38+ gettext.textdomain("software-properties")
39+ #FIXME: Workaround a bug in optparser which doesn't handle unicode/str
40+ # correctly, see http://bugs.python.org/issue4391
41+ # Shoudl be resolved by Python3
42+ enc = locale.getpreferredencoding()
43 usage = """Usage: %prog <sourceline>
44
45 %prog is a script for adding apt sources.list entries.
46@@ -90,16 +102,16 @@
47 # puts the line into a specific file in sources.list.d
48 parser.add_option ("-m", "--massive-debug", action="store_true",
49 dest="massive_debug", default=False,
50- help="Print a lot of debug information to the command line")
51+ help=_("Print a lot of debug information to the command line").decode(enc))
52 parser.add_option("-r", "--remove", action="store_true",
53 dest="remove", default=False,
54- help="remove repository from sources.list.d directory")
55+ help=_("remove repository from sources.list.d directory").decode(enc))
56 parser.add_option("-k", "--keyserver",
57 dest="keyserver", default=DEFAULT_KEYSERVER,
58- help="URL of keyserver. Default: %default")
59+ help=_("URL of keyserver. Default: %default").decode(enc))
60 parser.add_option("-y", "--yes", action="store_true",
61 dest="assume_yes", default=False,
62- help="Assume yes to all queries")
63+ help=_("Assume yes to all queries").decode(enc))
64 (options, args) = parser.parse_args()
65
66 if os.geteuid() != 0:
67@@ -126,7 +138,7 @@
68 except HTTPError:
69 print _("Cannot add PPA: '%s'.") % line
70 if user.startswith("~"):
71- print _("Did you mean 'ppa:%s/%s' ?" %(user[1:], ppa_name))
72+ print _("Did you mean 'ppa:%s/%s' ?") %(user[1:], ppa_name)
73 sys.exit(1) # Exit because the user cannot be correct
74 # If the PPA does not exist, then try to find if the user/team
75 # exists. If it exists, list down the PPAs
76@@ -167,14 +179,14 @@
77 try:
78 sp.remove_source(deb_entry)
79 except ValueError:
80- print _("Error: '%s' doesn't exist in a sourcelist file" % deb_line)
81+ print _("Error: '%s' doesn't exist in a sourcelist file") % deb_line
82 try:
83 sp.remove_source(debsrc_entry)
84 except ValueError:
85- print _("Error: '%s' doesn't exist in a sourcelist file" % debsrc_line)
86+ print _("Error: '%s' doesn't exist in a sourcelist file") % debsrc_line
87
88 else:
89 if not sp.add_source_from_line(line):
90- print _("Error: '%s' invalid" % line)
91+ print _("Error: '%s' invalid") % line
92 sys.exit(1)
93 sp.sourceslist.save()

Subscribers

People subscribed via source and target branches

to status/vote changes: