equal
deleted
inserted
replaced
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """Some i18n/gettext utilities.""" |
18 """Some i18n/gettext utilities.""" |
|
19 from __future__ import print_function |
19 |
20 |
20 __docformat__ = "restructuredtext en" |
21 __docformat__ = "restructuredtext en" |
21 |
22 |
22 import re |
23 import re |
23 import os |
24 import os |
78 def compile_i18n_catalogs(sourcedirs, destdir, langs): |
79 def compile_i18n_catalogs(sourcedirs, destdir, langs): |
79 """generate .mo files for a set of languages into the `destdir` i18n directory |
80 """generate .mo files for a set of languages into the `destdir` i18n directory |
80 """ |
81 """ |
81 from subprocess import CalledProcessError |
82 from subprocess import CalledProcessError |
82 from logilab.common.fileutils import ensure_fs_mode |
83 from logilab.common.fileutils import ensure_fs_mode |
83 print '-> compiling message catalogs to %s' % destdir |
84 print('-> compiling message catalogs to %s' % destdir) |
84 errors = [] |
85 errors = [] |
85 for lang in langs: |
86 for lang in langs: |
86 langdir = join(destdir, lang, 'LC_MESSAGES') |
87 langdir = join(destdir, lang, 'LC_MESSAGES') |
87 if not exists(langdir): |
88 if not exists(langdir): |
88 create_dir(langdir) |
89 create_dir(langdir) |