only try to internationalize our own js files
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 13 Nov 2008 11:32:25 +0100
changeset 58 c7c22b210372
parent 57 3ab952845448
child 59 9660bd221553
only try to internationalize our own js files
devtools/devctl.py
--- a/devtools/devctl.py	Thu Nov 13 11:27:22 2008 +0100
+++ b/devtools/devctl.py	Thu Nov 13 11:32:25 2008 +0100
@@ -212,7 +212,7 @@
         from tempfile import mktemp
         import yams
         from logilab.common.fileutils import ensure_fs_mode
-        from logilab.common.shellutils import find, rm
+        from logilab.common.shellutils import globfind, find, rm
         from cubicweb.common.i18n import extract_from_tal, execute
         tempdir = mktemp()
         mkdir(tempdir)
@@ -229,13 +229,13 @@
         tali18nfile = join(tempdir, 'tali18n.py')
         extract_from_tal(find(join(BASEDIR, 'web'), ('.py', '.pt')), tali18nfile)
         print '******** .pot files generation'
-        for id, files, lang in [('cubicweb', get_module_files(BASEDIR) + find(join(BASEDIR, 'misc', 'migration'), '.py'), None),
-                                ('schemadescr', find(join(BASEDIR, 'schemas'), '.py'), None),
+        for id, files, lang in [('cubicweb', 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),
                                 ('tal', [tali18nfile], None),
-                                ('js', find(join(BASEDIR, 'web'), '.js'), 'java'),
+                                ('js', globfind(join(BASEDIR, 'web'), 'cub*.js'), 'java'),
                                 ]:
-            cmd = 'xgettext --no-location --omit-header -k_ -o %s %s'
+            cmd = 'xgettext --add-location --omit-header -k_ -o %s %s'
             if lang is not None:
                 cmd += ' -L %s' % lang
             potfiles.append(join(tempdir, '%s.pot' % id))
@@ -253,7 +253,7 @@
             shutil.move('%snew' % target, target)
             toedit.append(abspath(target))
         # cleanup
-        rm(tempdir)
+        # rm(tempdir)
         # instructions pour la suite
         print '*' * 72
         print 'you can now edit the following files:'
@@ -310,7 +310,7 @@
         tali18nfile = join(tempdir, 'tali18n.py')
         extract_from_tal(find('.', ('.py', '.pt'), blacklist=STD_BLACKLIST+('test',)), tali18nfile)
         print '******** extract Javascript messages'
-        jsfiles =  find('.', '.js')
+        jsfiles =  [jsfile for jsfile in find('.', '.js') if basename(jsfile).startswith('cub')]
         if jsfiles:
             tmppotfile = join(tempdir, 'js.pot')
             execute('xgettext --no-location --omit-header -k_ -L java --from-code=utf-8 -o %s %s'