common/i18n.py
branch3.5
changeset 3118 9e7a155bc4e5
parent 3117 32686ae66c75
child 3156 cd56d5c379cb
child 3202 241ae91e9ab7
equal deleted inserted replaced
3117:32686ae66c75 3118:9e7a155bc4e5
    73         pofiles = [join(path, '%s.po' % lang) for path in sourcedirs]
    73         pofiles = [join(path, '%s.po' % lang) for path in sourcedirs]
    74         pofiles = [pof for pof in pofiles if exists(pof)]
    74         pofiles = [pof for pof in pofiles if exists(pof)]
    75         mergedpo = join(destdir, '%s_merged.po' % lang)
    75         mergedpo = join(destdir, '%s_merged.po' % lang)
    76         try:
    76         try:
    77             # merge instance/cubes messages catalogs with the stdlib's one
    77             # merge instance/cubes messages catalogs with the stdlib's one
    78             execute('msgcat --use-first --sort-output --strict -o %s %s'
    78             execute('msgcat --use-first --sort-output --strict -o "%s" %s'
    79                     % (mergedpo, ' '.join('"%s"' % f for f in pofiles)))
    79                     % (mergedpo, ' '.join('"%s"' % f for f in pofiles)))
    80             # make sure the .mo file is writeable and compile with *msgfmt*
    80             # make sure the .mo file is writeable and compiles with *msgfmt*
    81             applmo = join(destdir, lang, 'LC_MESSAGES', 'cubicweb.mo')
    81             applmo = join(destdir, lang, 'LC_MESSAGES', 'cubicweb.mo')
    82             try:
    82             try:
    83                 ensure_fs_mode(applmo)
    83                 ensure_fs_mode(applmo)
    84             except OSError:
    84             except OSError:
    85                 pass # suppose not exists
    85                 pass # suppose not exists
    86             execute('msgfmt %s -o %s' % (mergedpo, applmo))
    86             execute('msgfmt "%s" -o "%s"' % (mergedpo, applmo))
    87         except Exception, ex:
    87         except Exception, ex:
    88             errors.append('while handling language %s: %s' % (lang, ex))
    88             errors.append('while handling language %s: %s' % (lang, ex))
    89         try:
    89         try:
    90             # clean everything
    90             # clean everything
    91             os.unlink(mergedpo)
    91             os.unlink(mergedpo)