Merge lp:~ken-brotherton/boots/localization into lp:boots

Proposed by KenBrotherton
Status: Rejected
Rejected by: Max Goodhart
Proposed branch: lp:~ken-brotherton/boots/localization
Merge into: lp:boots
Diff against target: 1071 lines (+416/-69)
26 files modified
boots.py (+1/-1)
boots/api/errors.py (+2/-2)
boots/api/nodes/node.py (+36/-2)
boots/app/client_config.py (+19/-15)
boots/lib/console.py (+8/-4)
boots/lib/hook.py (+2/-2)
boots/lib/lingos/bash_external.py (+1/-1)
boots/lib/lingos/external.py (+1/-1)
boots/lib/lingos/lingo.py (+1/-1)
boots/lib/lingos/lisp/builtins.py (+7/-3)
boots/lib/lingos/lisp/lexer.py (+6/-2)
boots/lib/lingos/lisp/lisp.py (+7/-3)
boots/lib/lingos/lisp/objects.py (+10/-6)
boots/lib/lingos/lisp/parser.py (+6/-2)
boots/lib/lingos/piped_sql.py (+10/-6)
boots/lib/lingos/python.py (+1/-1)
boots/lib/lingos/sql.py (+1/-1)
boots/lib/ui/components/help.py (+37/-2)
boots/lib/ui/components/metacommands.py (+6/-2)
boots/lib/ui/generic.py (+2/-7)
boots/lib/ui/plain.py (+8/-4)
localizations/README.txt (+22/-0)
localizations/createpots.sh (+3/-0)
localizations/pot.cms (+206/-0)
localizations/potfiles.txt (+12/-0)
setup.py (+1/-1)
To merge this branch: bzr merge lp:~ken-brotherton/boots/localization
Reviewer Review Type Date Requested Status
Max Goodhart Needs Fixing
David Rosenbaum Approve
Review via email: mp+19918@code.launchpad.net
To post a comment you must log in.
Revision history for this message
KenBrotherton (ken-brotherton) wrote :

Please ignore prev prop, it was empty. hehe. Have added localization to the code.

80. By Ken Brotherton <kennyb@capstone11>

fixed localization syntax error

Revision history for this message
KenBrotherton (ken-brotherton) wrote :

Have fixed the syntax error. should be good to go.

Revision history for this message
David Rosenbaum (davidjrosenbaum) wrote :

Merging.

review: Approve
Revision history for this message
Max Goodhart (chromakode) wrote :

This branch is not ready!

It currently uses the localization domain "fslint", apparently ripped straight from an example. In addition, it munges already corrected headers, and steps on the definition of is_interactive in boots/lib/ui/generic.py -- reintroducing a bug.

Please make sure to review the complete diffs every time you merge -- and critically look at the code! This was a bit sloppy.

review: Needs Fixing
Revision history for this message
Max Goodhart (chromakode) wrote :

I tried creating a reverse commit of this merge, but because the commit was immediately followed by more header changes, the undo commit had ~20 conflicts. The easiest way to fix this was to simply uncommit the last 3 commits and redo David's last two commits. I then forced those changes, overwriting lp:boots. This means that if you've pulled lp:boots since, you'll need to force the pull with --overwrite (WARNING: this will remove any commits you've added locally. Make sure you won't lose any data before proceeding, and only do it if bzr pull gives an error first).

(David -- you put a GPL header on constructors.py, rather than LGPL. I assumed this was a mistake, and corrected it.)

Revision history for this message
KenBrotherton (ken-brotherton) wrote :

Ripped straight from an example? Munges? Steps on? Can you be more
specific? All the testing that I did showed no problems.

On Sat, 2010-02-27 at 04:35 +0000, Chromakode wrote:
> Review: Needs Fixing
> This branch is not ready!
>
> It currently uses the localization domain "fslint", apparently ripped straight from an example. In addition, it munges already corrected headers, and steps on the definition of is_interactive in boots/lib/ui/generic.py -- reintroducing a bug.
>
> Please make sure to review the complete diffs every time you merge -- and critically look at the code! This was a bit sloppy.

--

*You can find me on IM as well
bedlamoid (Yahoo,AIM, MSN)
ken.brotherton@gmail (GTalk)
http://www.myspace.com/broken_broken
http://www.facebook.com/people/Ken-Brotherton/691662047

Revision history for this message
Max Goodhart (chromakode) wrote :

> Ripped straight from an example?

Googling "gettext fslint" yields this tutorial: http://www.pixelbeat.org/programming/i18n.html

The code in this branch matches the tutorial in using "fslint" as the gettext domain. If you had read this tutorial closely, at the top of the page, you'd have seen that "domain=fslint" accords to "your app".

Did you read the gettext module documentation before writing this code? http://docs.python.org/library/gettext.html

This section shows a much better approach for using the gettext module: http://docs.python.org/library/gettext.html#localizing-your-application

Please make those changes and resubmit your merge proposal.

> Munges? Steps on? Can you be more specific? All the testing that I did showed no problems.

The headers will already corrected by Andreas, whose branch I already merged. You were not assigned that task.

In addition, if you look at the diff, it reverts the definition of the "is_interactive" function in boots/lib/ui/generic.py. This is something David should have caught at merge time, and removed.

-M

Unmerged revisions

80. By Ken Brotherton <kennyb@capstone11>

fixed localization syntax error

79. By Ken Brotherton <kennyb@capstone11>

added localization

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'boots.py'
2--- boots.py 2010-02-17 03:49:02 +0000
3+++ boots.py 2010-02-23 04:05:24 +0000
4@@ -2,7 +2,7 @@
5 # Boots Client
6 # www.launchpad.net/boots
7 # www.launchpad.net/drizzle
8-# boots.py
9+# boots/boots.py
10 #
11 # ##### BEGIN LICENSE BLOCK #####
12 # Version: MPL 1.1
13
14=== modified file 'boots/api/errors.py'
15--- boots/api/errors.py 2010-02-20 23:22:10 +0000
16+++ boots/api/errors.py 2010-02-23 04:05:24 +0000
17@@ -1,7 +1,7 @@
18 # Boots Client
19 # www.launchpad.net/boots
20 # www.launchpad.net/drizzle
21-# errors.py
22+# boots/api/errors.py
23 #
24 # ##### BEGIN LICENSE BLOCK #####
25 # Version: MPL 1.1
26@@ -36,4 +36,4 @@
27
28 class ConsoleError(BootsError):
29 """Errors to be displayed to be displayed on the console"""
30- pass
31\ No newline at end of file
32+ pass
33
34=== modified file 'boots/api/nodes/node.py'
35--- boots/api/nodes/node.py 2010-02-21 03:57:45 +0000
36+++ boots/api/nodes/node.py 2010-02-23 04:05:24 +0000
37@@ -1,7 +1,41 @@
38+# Boots API
39+# www.launchpad.net/boots
40+# www.launchpad.net/drizzle
41+# boots/api/nodes/node.py
42+#
43+# ##### BEGIN LICENSE BLOCK #####
44+# Version: MPL 1.1
45+#
46+# The contents of this file are subject to the Mozilla Public License
47+# Version 1.1 (the "License"); you may not use this file except in
48+# compliance with the License. You may obtain a copy of the License at
49+# http://www.mozilla.org/MPL/
50+#
51+# Software distributed under the License is distributed on an "AS IS"
52+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
53+# License for the specific language governing rights and limitations
54+# under the License.
55+#
56+# The Original Code is Boots Client code.
57+#
58+# The Initial Developer of the Original Code is Clark Boylan, Ken
59+# Brotherton, Max Goodman, Victoria Lewis, David Rosenbaum, and Andreas
60+# Turriff. Portions created by Clark Boylan, Ken Brotherton, Max Goodman,
61+# Victoria Lewis, David Rosenbaum, and Andreas Turriff are Copyright (C)
62+# 2009. All Rights Reserved.
63+#
64+# Contributor(s):
65+#
66+# ##### END LICENSE BLOCK #####
67+
68 from Queue import Queue
69 from itertools import chain, tee, repeat
70 from threading import Thread, Event, Lock
71 from types import GeneratorType
72+import gettext
73+gettext.bindtextdomain("fslint", "/usr/share/locale") #sys default used if localedir=None
74+gettext.textdomain("fslint")
75+_ = gettext.gettext
76
77 def catch_exceptions(iterable):
78 try:
79@@ -441,12 +475,12 @@
80 def test():
81 def wait(x):
82 import time
83- print "waiting: {0}".format(x)
84+ print _("waiting")+": {0}".format(x)
85 time.sleep(1)
86 return x
87
88 def print_it(foo):
89- print "printing: {0}".format(foo)
90+ print _("printing")+": {0}".format(foo)
91 return foo
92
93 nodes = NodeGraph.from_sequence([SyncNode(lambda x:xrange(10), name="count"),
94
95=== modified file 'boots/app/client_config.py'
96--- boots/app/client_config.py 2010-02-21 00:00:41 +0000
97+++ boots/app/client_config.py 2010-02-23 04:05:24 +0000
98@@ -34,6 +34,10 @@
99 import optparse
100 import os
101 import info
102+import gettext
103+gettext.bindtextdomain("fslint", "/usr/share/locale") #sys default used if localedir=None
104+gettext.textdomain("fslint")
105+_ = gettext.gettext
106
107 class ClientConfig(object):
108 """Class used to read client configuration from files and the cli."""
109@@ -70,17 +74,17 @@
110 action = "store",
111 type = "string",
112 dest = "command",
113- help = "Execute command and exit")
114+ help = _("Execute command and exit"))
115 self._cli_parser.add_option("-D", "--database",
116 action = "store",
117 type = "string",
118 dest = "database",
119- help = "Use database")
120+ help = _("Use database"))
121 self._cli_parser.add_option("-f", "--script",
122 action = "store",
123 type = "string",
124 dest = "script",
125- help = "Execute commands from file and exit")
126+ help = _("Execute commands from file and exit"))
127 self._cli_parser.add_option('-l', '--lingo',
128 action = 'store',
129 type = 'string',
130@@ -89,47 +93,47 @@
131 self._cli_parser.add_option("-X", "--norc",
132 action = "store_true",
133 dest = "norc",
134- help = "Do not read user configuration file")
135+ help = _("Do not read user configuration file"))
136 self._cli_parser.add_option("-r", "--rc",
137 action = "store",
138 type = "string",
139 dest = "rcfile",
140- help = "Filename of user configuration file")
141+ help = _("Filename of user configuration file"))
142 self._cli_parser.add_option("-H", "--host",
143 action = "store",
144 type = "string",
145 dest = "host",
146- help = "Connect to host")
147+ help = _("Connect to host"))
148 self._cli_parser.add_option("-p", "--port",
149 action = "store",
150 type = "int",
151 dest = "port",
152- help = "Use port number")
153+ help = _("Use port number"))
154 self._cli_parser.add_option("-u", "--user",
155 action = "store",
156 type = "string",
157 dest = "username",
158- help = "Login with username")
159+ help = _("Login with username"))
160 self._cli_parser.add_option("-P", "--password",
161 action = "store",
162 type = "string",
163 dest = "password",
164- help = "Connect using password. If none is given, query for password")
165+ help = _("Connect using password. If none is given, query for password"))
166 self._cli_parser.add_option("-t", "--terminatingchar",
167 action = "store",
168 type = "string",
169 dest = "terminating_char",
170- help = "Specify the SQL statement terminating character. Default is ';'.")
171+ help = _("Specify the SQL statement terminating character. Default is ';'."))
172 self._cli_parser.add_option("-F", "--historyfile",
173 action = "store",
174 type = "string",
175 dest = "history_file",
176- help = "Specify file to save history to")
177+ help = _("Specify file to save history to"))
178 self._cli_parser.add_option("-L", "--historylength",
179 action = "store",
180 type = "int",
181 dest = "history_length",
182- help = "Specify max history file length")
183+ help = _("Specify max history file length"))
184
185 def __getitem__(self, key):
186 """Allows one to use the [] operator to get config items."""
187@@ -169,11 +173,11 @@
188 except IOError:
189 if filepath != info.RCFILE:
190 # Only print an error if a non-default rc file was specified.
191- print("rcfile {0} not found".format(filepath))
192+ print("rcfile {0} "+_("not found").format(filepath))
193 except SyntaxError:
194- print("rcfile {0} contains a syntax error".format(filepath))
195+ print(_("rcfile ")+"{0} "+_("contains a syntax error").format(filepath))
196 except Exception as e:
197- print("rcfile {0} contains an error: {1}".format(filepath, e))
198+ print(_("rcfile ")+"{0} "+_("contains an error:")+ " {1}".format(filepath, e))
199 return file_dict
200
201 def get_cli_conf(self):
202
203=== modified file 'boots/lib/console.py'
204--- boots/lib/console.py 2010-02-21 10:23:44 +0000
205+++ boots/lib/console.py 2010-02-23 04:05:24 +0000
206@@ -1,7 +1,7 @@
207 # Boots Client
208 # www.launchpad.net/boots
209 # www.launchpad.net/drizzle
210-# lib/console.py
211+# boots/lib/console.py
212 #
213 # ##### BEGIN LICENSE BLOCK #####
214 # Version: MPL 1.1
215@@ -44,6 +44,10 @@
216 from boots.lib.lingos import piped_sql
217 from boots.lib.lingos import sql
218 import sys
219+import gettext
220+gettext.bindtextdomain("fslint", "/usr/share/locale")
221+gettext.textdomain("fslint")
222+_ = gettext.gettext
223
224 # Utility function.
225 def iterable(obj):
226@@ -93,7 +97,7 @@
227 if lingo in self.lingos:
228 return self.lingos[lingo].execute(command)
229 else:
230- return ConsoleError("Invalid lingo \"{0}\" specified.".format(lingo))
231+ return ConsoleError(_("Invalid lingo")+" \"{0}\" "+_("specified.").format(lingo))
232
233 def connect(self, host, port, database):
234 try:
235@@ -106,7 +110,7 @@
236 self.servers.append(server)
237 return True
238 else:
239- error = ConsoleError("Could not connect to {0}:{1}".format(host, port))
240+ error = ConsoleError(_("Could not connect to")+" {0}:{1}".format(host, port))
241 self.presenter.presenter_graph.put(error)
242 return False
243
244@@ -147,7 +151,7 @@
245
246 def quit(self):
247 if self.driver.is_interactive:
248- self.presenter.presenter_graph.put("Boots quit.")
249+ self.presenter.presenter_graph.put(_("Boots quit."))
250
251 self.hooks["unload"].call()
252 self.disconnect(None, None)
253
254=== modified file 'boots/lib/hook.py'
255--- boots/lib/hook.py 2010-02-21 10:04:23 +0000
256+++ boots/lib/hook.py 2010-02-23 04:05:24 +0000
257@@ -1,7 +1,7 @@
258 # Boots Client
259 # www.launchpad.net/boots
260 # www.launchpad.net/drizzle
261-# lib/hook.py
262+# boots/lib/hook.py
263 #
264 # ##### BEGIN LICENSE BLOCK #####
265 # Version: MPL 1.1
266@@ -59,4 +59,4 @@
267 else:
268 dead_refs.add(callback)
269 self.callbacks -= dead_refs
270-
271\ No newline at end of file
272+
273
274=== modified file 'boots/lib/lingos/bash_external.py'
275--- boots/lib/lingos/bash_external.py 2010-02-08 00:06:50 +0000
276+++ boots/lib/lingos/bash_external.py 2010-02-23 04:05:24 +0000
277@@ -1,7 +1,7 @@
278 # Boots Client
279 # www.launchpad.net/boots
280 # www.launchpad.net/drizzle
281-# lib/lingos/python.py
282+# boots/lib/lingos/python.py
283 #
284 # ##### BEGIN LICENSE BLOCK #####
285 # Version: MPL 1.1
286
287=== modified file 'boots/lib/lingos/external.py'
288--- boots/lib/lingos/external.py 2010-02-08 19:04:36 +0000
289+++ boots/lib/lingos/external.py 2010-02-23 04:05:24 +0000
290@@ -1,7 +1,7 @@
291 # Boots Client
292 # www.launchpad.net/boots
293 # www.launchpad.net/drizzle
294-# lib/lingos/python.py
295+# boots/lib/lingos/python.py
296 #
297 # ##### BEGIN LICENSE BLOCK #####
298 # Version: MPL 1.1
299
300=== modified file 'boots/lib/lingos/lingo.py'
301--- boots/lib/lingos/lingo.py 2010-02-21 10:11:22 +0000
302+++ boots/lib/lingos/lingo.py 2010-02-23 04:05:24 +0000
303@@ -1,7 +1,7 @@
304 # Boots Client
305 # www.launchpad.net/boots
306 # www.launchpad.net/drizzle
307-# lib/lingos/lingo.py
308+# boots/lib/lingos/lingo.py
309 #
310 # ##### BEGIN LICENSE BLOCK #####
311 # Version: MPL 1.1
312
313=== modified file 'boots/lib/lingos/lisp/builtins.py'
314--- boots/lib/lingos/lisp/builtins.py 2010-01-31 06:48:28 +0000
315+++ boots/lib/lingos/lisp/builtins.py 2010-02-23 04:05:24 +0000
316@@ -1,7 +1,7 @@
317 # Boots Client
318 # www.launchpad.net/boots
319 # www.launchpad.net/drizzle
320-# lib/lingos/lisp/builtins.py
321+# boots/lib/lingos/lisp/builtins.py
322 #
323 # ##### BEGIN LICENSE BLOCK #####
324 # Version: MPL 1.1
325@@ -31,6 +31,10 @@
326
327 from boots.lib.lingos.lisp import objects
328 import sys
329+import gettext
330+gettext.bindtextdomain("fslint", "/usr/share/locale")
331+gettext.textdomain("fslint")
332+_ = gettext.gettext
333
334 nil = objects.Null()
335 t = objects.T()
336@@ -65,7 +69,7 @@
337 elif isinstance(s, objects.String):
338 return objects.Integer(len(s.python_string()))
339 else:
340- raise TypeError('Expected a cons, nil or a string')
341+ raise TypeError(_('Expected a cons, nil or a string'))
342
343 def elt_function(s, i):
344 """Returns the ith element of the sequence s."""
345@@ -74,7 +78,7 @@
346 elif isinstance(s, objects.String):
347 return s.python_string()[i.python_integer()]
348 else:
349- raise TypeError('Expected a cons or string')
350+ raise TypeError(_('Expected a cons or string'))
351
352 def gensym_function():
353 """Returns a unique symbol that will never be the same as any other symbol even if it has the same name."""
354
355=== modified file 'boots/lib/lingos/lisp/lexer.py'
356--- boots/lib/lingos/lisp/lexer.py 2010-01-22 05:58:25 +0000
357+++ boots/lib/lingos/lisp/lexer.py 2010-02-23 04:05:24 +0000
358@@ -1,7 +1,7 @@
359 # Boots Client
360 # www.launchpad.net/boots
361 # www.launchpad.net/drizzle
362-# lib/lingos/lisp/lexer.py
363+# boots/lib/lingos/lisp/lexer.py
364 #
365 # ##### BEGIN LICENSE BLOCK #####
366 # Version: MPL 1.1
367@@ -30,6 +30,10 @@
368 # Defines the lisp lexer.
369
370 import ply.lex as lex
371+import gettext
372+gettext.bindtextdomain("fslint", "/usr/share/locale")
373+gettext.textdomain("fslint")
374+_ = gettext.gettext
375
376 tokens = ('INTEGER', 'STRING', 'SYMBOL', 'QUOTE', 'LEFT_PAREN', 'RIGHT_PAREN')
377
378@@ -42,7 +46,7 @@
379 t_ignore = ' \t\n'
380
381 def t_error(t):
382- print('illegal character {0} found'.format(t.value))
383+ print(_('illegal character')+' {0} '+_('found').format(t.value))
384 token.lexer.skip(1)
385
386 lexer = lex.lex()
387
388=== modified file 'boots/lib/lingos/lisp/lisp.py'
389--- boots/lib/lingos/lisp/lisp.py 2010-02-07 08:52:29 +0000
390+++ boots/lib/lingos/lisp/lisp.py 2010-02-23 04:05:24 +0000
391@@ -2,7 +2,7 @@
392 # Boots Client
393 # www.launchpad.net/boots
394 # www.launchpad.net/drizzle
395-# lib/lingos/lisp/lisp.py
396+# boots/lib/lingos/lisp/lisp.py
397 #
398 # ##### BEGIN LICENSE BLOCK #####
399 # Version: MPL 1.1
400@@ -54,6 +54,10 @@
401 from boots.lib.lingos.lisp import parser
402 import re
403 import readline
404+import gettext
405+gettext.bindtextdomain("fslint", "/usr/share/locale")
406+gettext.textdomain("fslint")
407+_ = gettext.gettext
408
409 def input_complete(string):
410 """Returns string if string is a complete lisp expression. Otherwise, None is returned."""
411@@ -64,7 +68,7 @@
412 paren_level = left_parens - right_parens
413
414 if paren_level < 0:
415- raise SyntaxError('unmatched closing ")"')
416+ raise SyntaxError(_('unmatched closing')+' ")"')
417 elif paren_level > 0:
418 return None
419 else:
420@@ -83,7 +87,7 @@
421 if isinstance(stream, file):
422 stream = stream.readline
423 elif not callable(stream):
424- raise TypeError('{0} is not a stream or a callable'.format(stream))
425+ raise TypeError('{0} '+_('is not a stream or a callable').format(stream))
426 # Read lines until all open lisp expressions have been closed.
427 while True:
428 line = stream()
429
430=== modified file 'boots/lib/lingos/lisp/objects.py'
431--- boots/lib/lingos/lisp/objects.py 2010-01-31 06:34:57 +0000
432+++ boots/lib/lingos/lisp/objects.py 2010-02-23 04:05:24 +0000
433@@ -1,7 +1,7 @@
434 # Boots Client
435 # www.launchpad.net/boots
436 # www.launchpad.net/drizzle
437-# lib/lingos/lisp/objects.py
438+# boots/lib/lingos/lisp/objects.py
439 #
440 # ##### BEGIN LICENSE BLOCK #####
441 # Version: MPL 1.1
442@@ -32,6 +32,10 @@
443 import abc
444 import copy
445 import sys
446+import gettext
447+gettext.bindtextdomain("fslint", "/usr/share/locale")
448+gettext.textdomain("fslint")
449+_ = gettext.gettext
450
451 _gensym_count = 1
452 _symbols = {}
453@@ -104,7 +108,7 @@
454 else_expression = car(cdr(cdr(cdr(self))))
455
456 if then_expression is Null() or cdr(cdr(cdr(cdr(self)))) is not Null():
457- raise SyntaxError('wrong number of arguments for if special form {0}'.format(self))
458+ raise SyntaxError(_('wrong number of arguments for if special form')+' {0}'.format(self))
459
460 if condition_expression.evaluate(environment) != Null():
461 return then_expression.evaluate(environment)
462@@ -123,7 +127,7 @@
463 values = arguments[2::2]
464
465 if len(symbols) != len(values) or len(symbols) == 0:
466- raise SyntaxError('The number of symbols must equal the number of values and must be non-zero')
467+ raise SyntaxError(_('The number of symbols must equal the number of values and must be non-zero'))
468
469 for symbol, value in zip(symbols, values):
470 value = value.evaluate(environment)
471@@ -137,7 +141,7 @@
472 else: # Handle function calls.
473 function = self.car.evaluate(environment)
474 if not isinstance(function, Lambda):
475- raise TypeError('Expected a function')
476+ raise TypeError(_('Expected a function'))
477 else:
478 return function.call((argument.evaluate(environment) for argument in self.python_list()[1:]), environment)
479
480@@ -196,7 +200,7 @@
481 # def __delitem__(self, symbol):
482 # """Removes the first binding found for symbol. Returns True if the symbol is found and False otherwise."""
483 # if not isinstance(symbol, Symbol):
484- # raise TypeError('Expected a symbol')
485+ # raise TypeError(_('Expected a symbol'))
486
487 # if symbol in self._environment:
488 # self._environment[symbol].pop()
489@@ -223,7 +227,7 @@
490 def pop(self):
491 """Removes the innermost scope and returns a dictionary that corresponds to its bindings."""
492 if len(self._scopes) <= 1:
493- raise RuntimeError('Cannot pop the innermost scope because then no scopes would remain')
494+ raise RuntimeError(_('Cannot pop the innermost scope because then no scopes would remain'))
495 symbols = self._scopes.pop()
496
497 for symbol in symbols:
498
499=== modified file 'boots/lib/lingos/lisp/parser.py'
500--- boots/lib/lingos/lisp/parser.py 2010-01-23 23:32:39 +0000
501+++ boots/lib/lingos/lisp/parser.py 2010-02-23 04:05:24 +0000
502@@ -1,7 +1,7 @@
503 # Boots Client
504 # www.launchpad.net/boots
505 # www.launchpad.net/drizzle
506-# lib/lingos/lisp/parser.py
507+# boots/lib/lingos/lisp/parser.py
508 #
509 # ##### BEGIN LICENSE BLOCK #####
510 # Version: MPL 1.1
511@@ -33,6 +33,10 @@
512 from boots.lib.lingos.lisp import builtins
513 from boots.lib.lingos.lisp import objects
514 import ply.yacc as yacc
515+import gettext
516+gettext.bindtextdomain("fslint", "/usr/share/locale")
517+gettext.textdomain("fslint")
518+_ = gettext.gettext
519
520 def p_expression_integer(p):
521 'expression : INTEGER'
522@@ -67,7 +71,7 @@
523 p[0] = objects.Cons(p[1], p[2])
524
525 def p_error(p):
526- print('syntax error')
527+ print(_('syntax error'))
528
529 # Disable debugging output and caching of parse tables.
530 parser = yacc.yacc(debug = 0, write_tables = 0)
531
532=== modified file 'boots/lib/lingos/piped_sql.py'
533--- boots/lib/lingos/piped_sql.py 2010-02-21 03:57:45 +0000
534+++ boots/lib/lingos/piped_sql.py 2010-02-23 04:05:24 +0000
535@@ -1,7 +1,7 @@
536 # Boots Client
537 # www.launchpad.net/boots
538 # www.launchpad.net/drizzle
539-# lib/lingos/sql.py
540+# boots/lib/lingos/piped_sql.py
541 #
542 # ##### BEGIN LICENSE BLOCK #####
543 # Version: MPL 1.1
544@@ -32,6 +32,10 @@
545 from boots.lib.lingos import lingo
546 from boots.lib.lingos import sql
547 import re
548+import gettext
549+gettext.bindtextdomain("fslint", "/usr/share/locale")
550+gettext.textdomain("fslint")
551+_ = gettext.gettext
552
553 # FIXME: These node constructors should probably moved into the API so
554 # they can be used in scripts.
555@@ -65,14 +69,14 @@
556 def register(name, constructor):
557 """Register a constructor that is used to contruct nodes when that specified name is used."""
558 if name in _constructors:
559- raise KeyError('A constructor with name {0} already exists'.format(name))
560+ raise KeyError(_('A constructor with name')+' {0} '+_('already exists').format(name))
561
562 _constructors[name] = (arguments, constructor)
563
564 def construct(name, *arguments):
565 """Contructs a node using the given name and arguments."""
566 if name not in _constructors:
567- raise KeyError('There is no constructor with the name {0}.'.format(name))
568+ raise KeyError(_('There is no constructor with the name')+' {0}.'.format(name))
569
570 return _constructors[name](*arguments)
571
572@@ -87,7 +91,7 @@
573 match = clause_re.match(clause_string)
574
575 if not match:
576- raise SyntaxError('{0} is not in the correct function call syntax'.format(clause_string))
577+ raise SyntaxError('{0} '+_('is not in the correct function call syntax').format(clause_string))
578
579 constructor_call = match.group('constructor_call').strip()
580 output_file = match.group('output_file')
581@@ -98,7 +102,7 @@
582 match = constructor_call_re.match(constructor_string)
583
584 if not match:
585- raise SyntaxError('{0} is not in the correct function call syntax'.format(constructor_string))
586+ raise SyntaxError('{0} '+_('is not in the correct function call syntax').format(constructor_string))
587
588 name = match.group('name')
589 arguments = match.group('arguments')
590@@ -137,7 +141,7 @@
591 # SQL is only allowed for the first node.
592 if sql:
593 if not first_node:
594- raise SyntaxError('SQL is only permitted for the first clause')
595+ raise SyntaxError(_('SQL is only permitted for the first clause'))
596
597 # FIXME: Add support for multiple servers here. Currently only the first server
598 # is used.
599
600=== modified file 'boots/lib/lingos/python.py'
601--- boots/lib/lingos/python.py 2010-02-20 23:42:07 +0000
602+++ boots/lib/lingos/python.py 2010-02-23 04:05:24 +0000
603@@ -1,7 +1,7 @@
604 # Boots Client
605 # www.launchpad.net/boots
606 # www.launchpad.net/drizzle
607-# lib/lingos/python.py
608+# boots/lib/lingos/python.py
609 #
610 # ##### BEGIN LICENSE BLOCK #####
611 # Version: MPL 1.1
612
613=== modified file 'boots/lib/lingos/sql.py'
614--- boots/lib/lingos/sql.py 2010-02-16 00:38:41 +0000
615+++ boots/lib/lingos/sql.py 2010-02-23 04:05:24 +0000
616@@ -1,7 +1,7 @@
617 # Boots Client
618 # www.launchpad.net/boots
619 # www.launchpad.net/drizzle
620-# lib/lingos/sql.py
621+# boots/lib/lingos/sql.py
622 #
623 # ##### BEGIN LICENSE BLOCK #####
624 # Version: MPL 1.1
625
626=== modified file 'boots/lib/ui/components/help.py'
627--- boots/lib/ui/components/help.py 2010-02-07 09:29:31 +0000
628+++ boots/lib/ui/components/help.py 2010-02-23 04:05:24 +0000
629@@ -1,4 +1,39 @@
630+# Boots Client
631+# www.launchpad.net/boots
632+# www.launchpad.net/drizzle
633+# boots/lib/ui/components/help.py
634+#
635+# ##### BEGIN LICENSE BLOCK #####
636+# Version: MPL 1.1
637+#
638+# The contents of this file are subject to the Mozilla Public License
639+# Version 1.1 (the "License"); you may not use this file except in
640+# compliance with the License. You may obtain a copy of the License at
641+# http://www.mozilla.org/MPL/
642+#
643+# Software distributed under the License is distributed on an "AS IS"
644+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
645+# License for the specific language governing rights and limitations
646+# under the License.
647+#
648+# The Original Code is Boots Client code.
649+#
650+# The Initial Developer of the Original Code is Clark Boylan, Ken
651+# Brotherton, Max Goodman, Victoria Lewis, David Rosenbaum, and Andreas
652+# Turriff. Portions created by Clark Boylan, Ken Brotherton, Max Goodman,
653+# Victoria Lewis, David Rosenbaum, and Andreas Turriff are Copyright (C)
654+# 2009. All Rights Reserved.
655+#
656+# Contributor(s):
657+#
658+# ##### END LICENSE BLOCK #####
659 # Utility function
660+
661+import gettext
662+gettext.bindtextdomain("fslint", "/usr/share/locale")
663+gettext.textdomain("fslint")
664+_ = gettext.gettext
665+
666 def issubseq(seq, seq2):
667 """Determines if the elements the sequence seq form a subsequence of the sequence seq2."""
668 if len(seq) == 0:
669@@ -29,7 +64,7 @@
670 def format(self):
671 """Returns a string that represents this topic in human readable form as
672 described in detail above."""
673- text = "{0.title}\n\n{0.description}\n\nSee also: {0.see_also}".format(self)
674+ text = "{0.title}\n\n{0.description}\n\n"+_("See also: ") + "{0.see_also}".format(self)
675 return text
676
677 def format_index(self):
678@@ -63,7 +98,7 @@
679 assert isinstance(item, str)
680 return query
681 else:
682- raise TypeError('query object {0} is not a string or tuple of strings'.format(query))
683+ raise TypeError(_('query object')+ ' {0} '+ _('is not a string or tuple of strings').format(query))
684
685 def _ensure_key(self, key):
686 """Creates a new subtopic that key maps to if none exists."""
687
688=== modified file 'boots/lib/ui/components/metacommands.py'
689--- boots/lib/ui/components/metacommands.py 2010-02-07 01:52:52 +0000
690+++ boots/lib/ui/components/metacommands.py 2010-02-23 04:05:24 +0000
691@@ -1,7 +1,7 @@
692 # Boots Client
693 # www.launchpad.net/boots
694 # www.launchpad.net/drizzle
695-# lib/console.py
696+# boots/lib/ui/components/metacommands.py
697 #
698 # ##### BEGIN LICENSE BLOCK #####
699 # Version: MPL 1.1
700@@ -29,6 +29,10 @@
701 # ##### END LICENSE BLOCK #####
702
703 import warnings
704+import gettext
705+gettext.bindtextdomain("fslint", "/usr/share/locale") #sys default used if localedir=None
706+gettext.textdomain("fslint")
707+_ = gettext.gettext
708
709 def parse_metacommand(commandstring):
710 """This function wraps str.split() for metacommands
711@@ -50,7 +54,7 @@
712 # FIXME: Issue warning through the UI using ui.print
713 # FIXME: Determine the offending command(s) (set.intersect?)
714 # FIXME: Print offending commands
715- warnings.warn("Conflicts between metacommands detected.")
716+ warnings.warn(_("Conflicts between metacommands detected."))
717 self.names |= newnames
718
719 class MetaCommands(object):
720
721=== modified file 'boots/lib/ui/generic.py'
722--- boots/lib/ui/generic.py 2010-02-22 19:33:02 +0000
723+++ boots/lib/ui/generic.py 2010-02-23 04:05:24 +0000
724@@ -31,7 +31,6 @@
725 two pieces, each classes, the StreamDriver and StreamPresenter."""
726
727 import sys
728-import os
729 import StringIO
730
731 class StreamDriver(object):
732@@ -57,12 +56,8 @@
733 except EOFError:
734 return
735
736- @property
737- def is_interactive(self):
738- if hasattr(os, "isatty") and hasattr(self.stream, "fileno"):
739- return os.isatty(self.stream.fileno())
740- else:
741- return False
742+ def unload(self):
743+ pass
744
745 class StreamPresenter(object):
746 """StreamPresenters write out boots results to streams, stdout for
747
748=== modified file 'boots/lib/ui/plain.py'
749--- boots/lib/ui/plain.py 2010-02-21 10:23:44 +0000
750+++ boots/lib/ui/plain.py 2010-02-23 04:05:24 +0000
751@@ -1,7 +1,7 @@
752 # Boots Client
753 # www.launchpad.net/boots
754 # www.launchpad.net/drizzle
755-# lib/ui/plain.py
756+# boots/lib/ui/plain.py
757 #
758 # ##### BEGIN LICENSE BLOCK #####
759 # Version: MPL 1.1
760@@ -34,6 +34,10 @@
761 import os
762 import time
763 import readline
764+import gettext
765+gettext.bindtextdomain("fslint", "/usr/share/locale") #sys default used if localedir=None
766+gettext.textdomain("fslint")
767+_ = gettext.gettext
768
769 from boots.api.nodes.node import NodeGraph, SyncNode
770 from boots.lib.ui.components.metacommands import MetaCommands, parse_metacommand
771@@ -149,7 +153,7 @@
772 dashes = map(lambda x: "-"*(x+2), max_widths)
773 sep_line = "+" + "+".join(dashes) + "+\n"
774 current_time = time.time()
775- info_line = "{0} rows in set ({1:.2f} seconds).\n".format(len(self.buffer),
776+ info_line = "{0} " +_("rows in set")+" ({1:.2f} "+ _("seconds")+".\n".format(len(self.buffer),
777 current_time - result["begin_time"])
778 names = (column[0] for column in self.last_desc)
779 sys.stdout.write(sep_line)
780@@ -163,7 +167,7 @@
781 self.buffer = []
782 else:
783 if isinstance(result, Exception):
784- sys.stdout.write("ERROR ")
785+ sys.stdout.write(_("ERROR "))
786 sys.stdout.write(" :: ".join(map(str, result.args)))
787 else:
788 sys.stdout.write(str(result))
789@@ -182,4 +186,4 @@
790 if lingo in self.console.lingos:
791 self.lingo = lingo
792 else:
793- self.present("The specified lingo \"{0}\" does not exist.".format(lingo))
794+ self.present(_("The specified lingo")+" \"{0}\" "+_("does not exist.").format(lingo))
795
796=== added directory 'localizations'
797=== added file 'localizations/README.txt'
798--- localizations/README.txt 1970-01-01 00:00:00 +0000
799+++ localizations/README.txt 2010-02-23 04:05:24 +0000
800@@ -0,0 +1,22 @@
801+========When adding code that outputs a string========
802+1) Add (if not present already) to the import section of the .py file
803+#=========
804+import gettext
805+gettext.bindtextdomain("fslint", "/usr/share/locale") #sys default used if localedir=None
806+gettext.textdomain("fslint")
807+_ = gettext.gettext
808+#=========
809+And then wrap all output strings with _("...").
810+You should do this so that if you are using dynamicly created content, that created content is not part of the wrapped string.
811+Ex:
812+help = "Execute commands from file and exit")
813+should be wrapped as such:
814+help = _("Execute commands from file and exit"))
815+Ex:
816+print("rcfile {0} contains a syntax error".format(filepath))
817+should be wrapped as such:
818+print(_("rcfile ")+"{0} "+_("contains a syntax error").format(filepath))
819+
820+2) Add your file path to the /boots/localizations/potfiles.txt file.
821+3) Generate the updated .pot file by running the /boots/localization/createpots.sh script. This will overwrite the existing pot.cms file. Any prevously generated .po .mo files can then be updated from this new file.
822+4) Upload new pot file to the launchpad localization section for creation or updating of .po files. (more on this later --ken)
823
824=== added file 'localizations/createpots.sh'
825--- localizations/createpots.sh 1970-01-01 00:00:00 +0000
826+++ localizations/createpots.sh 2010-02-23 04:05:24 +0000
827@@ -0,0 +1,3 @@
828+#!/bin/bash
829+xgettext --from-code=utf-8 --keyword=tr --default-domain=cms --output=pot.cms --files-from=potfiles.txt
830+
831
832=== added file 'localizations/pot.cms'
833--- localizations/pot.cms 1970-01-01 00:00:00 +0000
834+++ localizations/pot.cms 2010-02-23 04:05:24 +0000
835@@ -0,0 +1,206 @@
836+# SOME DESCRIPTIVE TITLE.
837+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
838+# This file is distributed under the same license as the PACKAGE package.
839+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
840+#
841+#, fuzzy
842+msgid ""
843+msgstr ""
844+"Project-Id-Version: PACKAGE VERSION\n"
845+"Report-Msgid-Bugs-To: \n"
846+"POT-Creation-Date: 2010-02-22 13:01-0800\n"
847+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
848+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
849+"Language-Team: LANGUAGE <LL@li.org>\n"
850+"MIME-Version: 1.0\n"
851+"Content-Type: text/plain; charset=CHARSET\n"
852+"Content-Transfer-Encoding: 8bit\n"
853+
854+#: ../boots/api/nodes/node.py:478
855+msgid "waiting"
856+msgstr ""
857+
858+#: ../boots/api/nodes/node.py:483
859+msgid "printing"
860+msgstr ""
861+
862+#: ../boots/app/client_config.py:77
863+msgid "Execute command and exit"
864+msgstr ""
865+
866+#: ../boots/app/client_config.py:82
867+msgid "Use database"
868+msgstr ""
869+
870+#: ../boots/app/client_config.py:87
871+msgid "Execute commands from file and exit"
872+msgstr ""
873+
874+#: ../boots/app/client_config.py:96
875+msgid "Do not read user configuration file"
876+msgstr ""
877+
878+#: ../boots/app/client_config.py:101
879+msgid "Filename of user configuration file"
880+msgstr ""
881+
882+#: ../boots/app/client_config.py:106
883+msgid "Connect to host"
884+msgstr ""
885+
886+#: ../boots/app/client_config.py:111
887+msgid "Use port number"
888+msgstr ""
889+
890+#: ../boots/app/client_config.py:116
891+msgid "Login with username"
892+msgstr ""
893+
894+#: ../boots/app/client_config.py:121
895+msgid "Connect using password. If none is given, query for password"
896+msgstr ""
897+
898+#: ../boots/app/client_config.py:126
899+msgid "Specify the SQL statement terminating character. Default is ';'."
900+msgstr ""
901+
902+#: ../boots/app/client_config.py:131
903+msgid "Specify file to save history to"
904+msgstr ""
905+
906+#: ../boots/app/client_config.py:136
907+msgid "Specify max history file length"
908+msgstr ""
909+
910+#: ../boots/app/client_config.py:176
911+msgid "not found"
912+msgstr ""
913+
914+#: ../boots/app/client_config.py:178 ../boots/app/client_config.py:180
915+msgid "rcfile "
916+msgstr ""
917+
918+#: ../boots/app/client_config.py:178
919+msgid "contains a syntax error"
920+msgstr ""
921+
922+#: ../boots/app/client_config.py:180
923+msgid "contains an error:"
924+msgstr ""
925+
926+#: ../boots/lib/console.py:100
927+msgid "Invalid lingo"
928+msgstr ""
929+
930+#: ../boots/lib/console.py:100
931+msgid "specified."
932+msgstr ""
933+
934+#: ../boots/lib/console.py:113
935+msgid "Could not connect to"
936+msgstr ""
937+
938+#: ../boots/lib/console.py:154
939+msgid "Boots quit."
940+msgstr ""
941+
942+#: ../boots/lib/ui/plain.py:156
943+msgid "rows in set"
944+msgstr ""
945+
946+#: ../boots/lib/ui/plain.py:156
947+msgid "seconds"
948+msgstr ""
949+
950+#: ../boots/lib/ui/plain.py:170
951+msgid "ERROR "
952+msgstr ""
953+
954+#: ../boots/lib/ui/plain.py:189
955+msgid "The specified lingo"
956+msgstr ""
957+
958+#: ../boots/lib/ui/plain.py:189
959+msgid "does not exist."
960+msgstr ""
961+
962+#: ../boots/lib/ui/components/help.py:67
963+msgid "See also: "
964+msgstr ""
965+
966+#: ../boots/lib/ui/components/help.py:101
967+msgid "query object"
968+msgstr ""
969+
970+#: ../boots/lib/ui/components/help.py:101
971+msgid "is not a string or tuple of strings"
972+msgstr ""
973+
974+#: ../boots/lib/ui/components/metacommands.py:57
975+msgid "Conflicts between metacommands detected."
976+msgstr ""
977+
978+#: ../boots/lib/lingos/piped_sql.py:72
979+msgid "A constructor with name"
980+msgstr ""
981+
982+#: ../boots/lib/lingos/piped_sql.py:72
983+msgid "already exists"
984+msgstr ""
985+
986+#: ../boots/lib/lingos/piped_sql.py:79
987+msgid "There is no constructor with the name"
988+msgstr ""
989+
990+#: ../boots/lib/lingos/piped_sql.py:94 ../boots/lib/lingos/piped_sql.py:105
991+msgid "is not in the correct function call syntax"
992+msgstr ""
993+
994+#: ../boots/lib/lingos/piped_sql.py:144
995+msgid "SQL is only permitted for the first clause"
996+msgstr ""
997+
998+#: ../boots/lib/lingos/lisp/builtins.py:72
999+msgid "Expected a cons, nil or a string"
1000+msgstr ""
1001+
1002+#: ../boots/lib/lingos/lisp/builtins.py:81
1003+msgid "Expected a cons or string"
1004+msgstr ""
1005+
1006+#: ../boots/lib/lingos/lisp/lexer.py:49
1007+msgid "illegal character"
1008+msgstr ""
1009+
1010+#: ../boots/lib/lingos/lisp/lexer.py:49
1011+msgid "found"
1012+msgstr ""
1013+
1014+#: ../boots/lib/lingos/lisp/lisp.py:71
1015+msgid "unmatched closing"
1016+msgstr ""
1017+
1018+#: ../boots/lib/lingos/lisp/lisp.py:90
1019+msgid "is not a stream or a callable"
1020+msgstr ""
1021+
1022+#: ../boots/lib/lingos/lisp/objects.py:111
1023+msgid "wrong number of arguments for if special form"
1024+msgstr ""
1025+
1026+#: ../boots/lib/lingos/lisp/objects.py:130
1027+msgid ""
1028+"The number of symbols must equal the number of values and must be non-zero"
1029+msgstr ""
1030+
1031+#: ../boots/lib/lingos/lisp/objects.py:144
1032+msgid "Expected a function"
1033+msgstr ""
1034+
1035+#: ../boots/lib/lingos/lisp/objects.py:230
1036+msgid "Cannot pop the innermost scope because then no scopes would remain"
1037+msgstr ""
1038+
1039+#: ../boots/lib/lingos/lisp/parser.py:74
1040+msgid "syntax error"
1041+msgstr ""
1042
1043=== added file 'localizations/potfiles.txt'
1044--- localizations/potfiles.txt 1970-01-01 00:00:00 +0000
1045+++ localizations/potfiles.txt 2010-02-23 04:05:24 +0000
1046@@ -0,0 +1,12 @@
1047+../boots/api/nodes/node.py
1048+../boots/app/client_config.py
1049+../boots/lib/console.py
1050+../boots/lib/ui/plain.py
1051+../boots/lib/ui/components/help.py
1052+../boots/lib/ui/components/metacommands.py
1053+../boots/lib/lingos/piped_sql.py
1054+../boots/lib/lingos/lisp/builtins.py
1055+../boots/lib/lingos/lisp/lexer.py
1056+../boots/lib/lingos/lisp/lisp.py
1057+../boots/lib/lingos/lisp/objects.py
1058+../boots/lib/lingos/lisp/parser.py
1059
1060=== modified file 'setup.py'
1061--- setup.py 2010-02-17 03:49:02 +0000
1062+++ setup.py 2010-02-23 04:05:24 +0000
1063@@ -2,7 +2,7 @@
1064 # Boots Setup
1065 # www.launchpad.net/boots
1066 # www.launchpad.net/drizzle
1067-# setup.py
1068+# boots/setup.py
1069 #
1070 # ##### BEGIN LICENSE BLOCK #####
1071 # Version: MPL 1.1

Subscribers

People subscribed via source and target branches

to status/vote changes: