From ecfc1ce90e6d6983b3b9c4bb1a36ebbbacead87a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 4 Apr 2022 20:16:41 +0200 Subject: [PATCH] Replace grunt-xgettext by xgettext shell grunt-xgettext does not support ECMAScript 6. issue11368 review382291002 --- Gruntfile.js | 29 +++++++++++++++-------------- package.json | 1 - 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3210294536..3b239214b4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -37,17 +37,6 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), - xgettext: { - locale: { - files: { - javascript: jsfiles - }, - options: { - functionName: "Sao.i18n.gettext", - potFile: "locale/messages.pot" - }, - } - }, shell: { options: { failOnError: true @@ -55,8 +44,20 @@ module.exports = function(grunt) { msgmerge: { command: _.map(locales, function(locale) { var po = "locale/" + locale + ".po"; - return "msgmerge -U " + po + " locale/messages.pot;"; + return ( + "msgmerge " + + "-U " + po + " " + + "--no-location " + + "locale/messages.pot;"); }).join("") + }, + xgettext: { + command: ( + "xgettext " + + "--language=JavaScript --from-code=UTF-8 " + + "--omit-header --no-location " + + "-o locale/messages.pot " + + jsfiles.join(" ")) } }, po2json: { @@ -170,8 +171,8 @@ module.exports = function(grunt) { grunt.task.run(['shell:msgmerge']); }); grunt.registerTask('xgettext', ' Extracts translatable messages', function() { - grunt.loadNpmTasks('grunt-xgettext'); - grunt.task.run(['xgettext']); + grunt.loadNpmTasks('grunt-shell'); + grunt.task.run(['shell:xgettext']); }); grunt.registerTask('test', 'Run tests', function() { grunt.loadNpmTasks('grunt-contrib-qunit'); diff --git a/package.json b/package.json index a1092735f0..d75315a592 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "grunt-contrib-qunit": "^3.1", "grunt-contrib-watch": "^1.1", "grunt-shell": "^3.0", - "grunt-xgettext": "^0.3", "grunt-po2json": "^0.3" }, "keywords": [