annotate scripts/dump_global.py @ 546:10de195cfb04

catalog.add() now returns the message instance (closes #245)
author fschwarz
date Sat, 19 Mar 2011 19:28:59 +0000
parents e93f68837913
children 632b2338e6dd
rev   line source
235
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
1 #!/usr/bin/env python
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
2 # -*- coding: utf-8 -*-
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
3 #
532
e93f68837913 Update the copyright line.
jruigrok
parents: 235
diff changeset
4 # Copyright (C) 2007-2011 Edgewall Software
235
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
5 # All rights reserved.
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
6 #
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
7 # This software is licensed as described in the file COPYING, which
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
8 # you should have received as part of this distribution. The terms
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
9 # are also available at http://babel.edgewall.org/wiki/License.
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
10 #
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
11 # This software consists of voluntary contributions made by many
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
12 # individuals. For the exact contribution history, see the revision
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
13 # history and logs, available at http://babel.edgewall.org/log/.
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
14
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
15 import os
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
16 import pickle
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
17 from pprint import pprint
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
18 import sys
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
19
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
20 import babel
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
21
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
22 dirname = os.path.join(os.path.dirname(babel.__file__))
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
23 filename = os.path.join(dirname, 'global.dat')
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
24 fileobj = open(filename, 'rb')
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
25 try:
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
26 data = pickle.load(fileobj)
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
27 finally:
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
28 fileobj.close()
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
29
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
30 if len(sys.argv) > 1:
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
31 pprint(data.get(sys.argv[1]))
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
32 else:
d0cd235ede46 Upgraded to CLDR 1.5 and improved timezone formatting.
cmlenz
parents:
diff changeset
33 pprint(data)
Copyright (C) 2012-2017 Edgewall Software