Commit 1ef294be authored by Simon Chabot's avatar Simon Chabot
Browse files

feat(i18n): consider utf-8 to be the encoding used for the python files

When there is no `#coding: utf-8` information at the beginning of a file, the
`cubicweb-ctl i18ncube` command fails.

As of https://www.python.org/dev/peps/pep-3120/ this information is not needed
anymore, and the file should be assumed to be utf-8 encoded.

related: #317
parent 05aa2353524d
Pipeline #56766 passed with stages
in 37 minutes and 52 seconds
......@@ -340,7 +340,7 @@ class UpdateCubicWebCatalogCommand(Command):
('js', jsfiles, 'java'),
]:
potfile = osp.join(tempdir, '%s.pot' % id)
cmd = ['xgettext', '--no-location', '--omit-header', '-k_']
cmd = ['xgettext', '--from-code=UTF-8', '--no-location', '--omit-header', '-k_']
if lang is not None:
cmd.extend(['-L', lang])
cmd.extend(['-o', potfile])
......@@ -506,8 +506,8 @@ class I18nCubeMessageExtractor(object):
"""shortcut to execute the xgettext command and return output file
"""
tmppotfile = osp.join(self.workdir, output)
cmd = ['xgettext', '--no-location', '--omit-header', '-k' + k,
'-o', tmppotfile] + extraopts.split() + files
cmd = ['xgettext', '--from-code=UTF-8', '--no-location', '--omit-header',
'-k' + k, '-o', tmppotfile] + extraopts.split() + files
execute2(cmd)
if osp.exists(tmppotfile):
return tmppotfile
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment