--- a/devtools/devctl.py Thu Jul 23 15:29:07 2009 +0200
+++ b/devtools/devctl.py Thu Jul 23 15:33:03 2009 +0200
@@ -19,7 +19,7 @@
from logilab.common.textutils import get_csv
from logilab.common.clcommands import register_commands
-from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage
+from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage, underline_title
from cubicweb.__pkginfo__ import version as cubicwebversion
from cubicweb.toolsutils import Command, confirm, copy_skeleton
from cubicweb.web.webconfig import WebConfiguration
@@ -261,7 +261,7 @@
from cubicweb.common.i18n import extract_from_tal, execute
tempdir = tempdir.mkdtemp()
potfiles = [join(I18NDIR, 'entities.pot')]
- print '******** extract schema messages'
+ print '-> extract schema messages.'
schemapot = join(tempdir, 'schema.pot')
potfiles.append(schemapot)
# explicit close necessary else the file may not be yet flushed when
@@ -269,10 +269,10 @@
schemapotstream = file(schemapot, 'w')
generate_schema_pot(schemapotstream.write, cubedir=None)
schemapotstream.close()
- print '******** extract TAL messages'
+ print '-> extract TAL messages.'
tali18nfile = join(tempdir, 'tali18n.py')
extract_from_tal(find(join(BASEDIR, 'web'), ('.py', '.pt')), tali18nfile)
- print '******** .pot files generation'
+ print '-> generate .pot files.'
for id, files, lang in [('pycubicweb', get_module_files(BASEDIR) + list(globfind(join(BASEDIR, 'misc', 'migration'), '*.py')), None),
('schemadescr', globfind(join(BASEDIR, 'schemas'), '*.py'), None),
('yams', get_module_files(yams.__path__[0]), None),
@@ -287,11 +287,11 @@
if exists(potfile):
potfiles.append(potfile)
else:
- print 'WARNING: %s file not generated' % potfile
- print '******** merging .pot files'
+ print '-> WARNING: %s file was not generated' % potfile
+ print '-> merging %i .pot files' % len(potfiles)
cubicwebpot = join(tempdir, 'cubicweb.pot')
execute('msgcat %s > %s' % (' '.join(potfiles), cubicwebpot))
- print '******** merging main pot file with existing translations'
+ print '-> merging main pot file with existing translations.'
chdir(I18NDIR)
toedit = []
for lang in LANGS:
@@ -303,11 +303,10 @@
# cleanup
rm(tempdir)
# instructions pour la suite
- print '*' * 72
- print 'you can now edit the following files:'
+ print '-> regenerated CubicWeb\'s .po catalogs.'
+ print '\nYou can now edit the following files:'
print '* ' + '\n* '.join(toedit)
- print
- print "then you'll have to update cubes catalogs using the i18ncube command"
+ print 'when you are done, run "cubicweb-ctl i18ncube yourcube".'
class UpdateTemplateCatalogCommand(Command):
@@ -331,19 +330,19 @@
toedit = []
for cubedir in cubes:
if not isdir(cubedir):
- print 'not a directory', cubedir
+ print '-> ignoring %s that is not a directory.' % cubedir
continue
try:
toedit += update_cube_catalogs(cubedir)
except Exception:
import traceback
traceback.print_exc()
- print 'error while updating catalogs for', cubedir
+ print '-> Error while updating catalogs for cube', cubedir
# instructions pour la suite
- print '*' * 72
- print 'you can now edit the following files:'
+ print '-> regenerated this cube\'s .po catalogs.'
+ print '\nYou can now edit the following files:'
print '* ' + '\n* '.join(toedit)
-
+ print 'when you are done, run "cubicweb-ctl i18ninstance yourinstance".'
def update_cube_catalogs(cubedir):
import shutil
@@ -354,12 +353,11 @@
toedit = []
cube = basename(normpath(cubedir))
tempdir = tempfile.mkdtemp()
- print '*' * 72
- print 'updating %s cube...' % cube
+ print underline_title('Updating i18n catalogs for cube %s' % cube)
chdir(cubedir)
potfiles = [join('i18n', scfile) for scfile in ('entities.pot',)
if exists(join('i18n', scfile))]
- print '******** extract schema messages'
+ print '-> extract schema messages'
schemapot = join(tempdir, 'schema.pot')
potfiles.append(schemapot)
# explicit close necessary else the file may not be yet flushed when
@@ -367,10 +365,10 @@
schemapotstream = file(schemapot, 'w')
generate_schema_pot(schemapotstream.write, cubedir)
schemapotstream.close()
- print '******** extract TAL messages'
+ print '-> extract TAL messages'
tali18nfile = join(tempdir, 'tali18n.py')
extract_from_tal(find('.', ('.py', '.pt'), blacklist=STD_BLACKLIST+('test',)), tali18nfile)
- print '******** extract Javascript messages'
+ print '-> extract Javascript messages'
jsfiles = [jsfile for jsfile in find('.', '.js') if basename(jsfile).startswith('cub')]
if jsfiles:
tmppotfile = join(tempdir, 'js.pot')
@@ -379,7 +377,7 @@
# no pot file created if there are no string to translate
if exists(tmppotfile):
potfiles.append(tmppotfile)
- print '******** create cube specific catalog'
+ print '-> create cube-specific catalog'
tmppotfile = join(tempdir, 'generated.pot')
cubefiles = find('.', '.py', blacklist=STD_BLACKLIST+('test',))
cubefiles.append(tali18nfile)
@@ -388,12 +386,12 @@
if exists(tmppotfile): # doesn't exists of no translation string found
potfiles.append(tmppotfile)
potfile = join(tempdir, 'cube.pot')
- print '******** merging .pot files'
+ print '-> merging %i .pot files:' % len(potfiles)
execute('msgcat %s > %s' % (' '.join(potfiles), potfile))
- print '******** merging main pot file with existing translations'
+ print '-> merging main pot file with existing translations:'
chdir('i18n')
for lang in LANGS:
- print '****', lang
+ print '-> language', lang
cubepo = '%s.po' % lang
if not exists(cubepo):
shutil.copy(potfile, cubepo)