Frontend: Use vue-gettext-extract instead of gettext-extract #1152

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2025-10-17 16:05:32 +02:00
parent 0a727de361
commit ab9a0a969b
5 changed files with 56 additions and 255 deletions

3
NOTICE
View file

@ -9,7 +9,7 @@ The following 3rd-party software packages may be used by or distributed with
PhotoPrism. Any information relevant to third-party vendors listed below are
collected using common, reasonable means.
Date generated: 2025-10-14
Date generated: 2025-10-17
================================================================================
@ -8749,7 +8749,6 @@ core-js MIT Denis Pushkarev zloirock@zloirock
cross-env MIT Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
css-loader MIT Tobias Koppers @sokra
cssnano MIT Ben Briggs beneb.info@gmail.com http://beneb.info
easygettext MIT Polyconseil
eslint MIT Nicholas C. Zakas <nicholas+npm@nczconsulting.com>
eslint-config-prettier MIT Simon Lydell
eslint-formatter-pretty MIT Sindre Sorhus sindresorhus@gmail.com https://sindresorhus.com

View file

@ -32,7 +32,6 @@ core-js MIT Denis Pushkarev zloirock@zloirock
cross-env MIT Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
css-loader MIT Tobias Koppers @sokra
cssnano MIT Ben Briggs beneb.info@gmail.com http://beneb.info
easygettext MIT Polyconseil
eslint MIT Nicholas C. Zakas <nicholas+npm@nczconsulting.com>
eslint-config-prettier MIT Simon Lydell
eslint-formatter-pretty MIT Sindre Sorhus sindresorhus@gmail.com https://sindresorhus.com

View file

@ -1,21 +1,50 @@
const glob = require("glob");
const path = require("path");
const poPath = path.resolve(__dirname, "src/locales");
const projectRoot = __dirname;
const localesPath = path.resolve(projectRoot, "src/locales");
const sourceDirs = (process.env.SRC || "src")
.split(" ")
.map((dir) => dir.trim())
.filter(Boolean);
const includeExtensions = ["vue", "js", "ts"];
const includePatterns = new Set();
sourceDirs.forEach((dir) => {
const relativeDir = dir.replace(/\\/g, "/");
includeExtensions.forEach((ext) => {
includePatterns.add(`${relativeDir}/**/*.${ext}`);
});
});
if (includePatterns.size === 0) {
includeExtensions.forEach((ext) => includePatterns.add(`src/**/*.${ext}`));
}
const excludePatterns = ["src/common/gettext.js"];
// Generates a list of existing locales based on the files in src/locales.
const languageCodes = glob.sync(poPath + "/*.po").map((filePath) => {
const languageCodes = glob.sync(path.join(localesPath, "*.po")).map((filePath) => {
const fileName = path.basename(filePath);
return fileName.replace(".po", "");
});
// Generates one JSON file per locale from the gettext *.po files located in src/locales.
module.exports = {
input: {
path: ".",
include: Array.from(includePatterns),
exclude: excludePatterns,
},
output: {
path: path.resolve(__dirname, "src/locales"),
potPath: "src/locales/translations.pot",
path: localesPath,
potPath: "translations.pot",
jsonPath: "json",
locales: languageCodes,
splitJson: true,
flat: true,
linguas: false,
},
};

View file

@ -41,7 +41,6 @@
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"cssnano": "^7.1.1",
"easygettext": "^2.17.0",
"eslint": "^9.37.0",
"eslint-config-prettier": "^10.1.8",
"eslint-formatter-pretty": "^6.0.1",
@ -5810,9 +5809,9 @@
}
},
"node_modules/acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"peer": true,
"bin": {
@ -5822,19 +5821,16 @@
"node": ">=0.4.0"
}
},
"node_modules/acorn-class-fields": {
"version": "0.3.7",
"resolved": "https://registry.npmjs.org/acorn-class-fields/-/acorn-class-fields-0.3.7.tgz",
"integrity": "sha512-jdUWSFce0fuADUljmExz4TWpPkxmRW/ZCPRqeeUzbGf0vFUcpQYbyq52l75qGd0oSwwtAepeL6hgb/naRgvcKQ==",
"node_modules/acorn-import-phases": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
"integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
"license": "MIT",
"dependencies": {
"acorn-private-class-elements": "^0.2.7"
},
"engines": {
"node": ">=4.8.2"
"node": ">=10.13.0"
},
"peerDependencies": {
"acorn": "^6 || ^7 || ^8"
"acorn": "^8.14.0"
}
},
"node_modules/acorn-jsx": {
@ -5846,65 +5842,6 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/acorn-private-class-elements": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/acorn-private-class-elements/-/acorn-private-class-elements-0.2.7.tgz",
"integrity": "sha512-+GZH2wOKNZOBI4OOPmzpo4cs6mW297sn6fgIk1dUI08jGjhAaEwvC39mN2gJAg2lmAQJ1rBkFqKWonL3Zz6PVA==",
"license": "MIT",
"engines": {
"node": ">=4.8.2"
},
"peerDependencies": {
"acorn": "^6.1.0 || ^7 || ^8"
}
},
"node_modules/acorn-private-methods": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/acorn-private-methods/-/acorn-private-methods-0.3.3.tgz",
"integrity": "sha512-46oeEol3YFvLSah5m9hGMlNpxDBCEkdceJgf01AjqKYTK9r6HexKs2rgSbLK81pYjZZMonhftuUReGMlbbv05w==",
"license": "MIT",
"dependencies": {
"acorn-private-class-elements": "^0.2.7"
},
"engines": {
"node": ">=4.8.2"
},
"peerDependencies": {
"acorn": "^6 || ^7 || ^8"
}
},
"node_modules/acorn-stage3": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/acorn-stage3/-/acorn-stage3-4.0.0.tgz",
"integrity": "sha512-BR+LaADtA6GTB5prkNqWmlmCLYmkyW0whvSxdHhbupTaro2qBJ95fJDEiRLPUmiACGHPaYyeH9xmNJWdGfXRQw==",
"license": "MIT",
"dependencies": {
"acorn-class-fields": "^0.3.7",
"acorn-private-methods": "^0.3.3",
"acorn-static-class-features": "^0.2.4"
},
"engines": {
"node": ">=4.8.2"
},
"peerDependencies": {
"acorn": "^7.4 || ^8"
}
},
"node_modules/acorn-static-class-features": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/acorn-static-class-features/-/acorn-static-class-features-0.2.4.tgz",
"integrity": "sha512-5X4mpYq5J3pdndLmIB0+WtFd/mKWnNYpuTlTzj32wUu/PMmEGOiayQ5UrqgwdBNiaZBtDDh5kddpP7Yg2QaQYA==",
"license": "MIT",
"dependencies": {
"acorn-private-class-elements": "^0.2.7"
},
"engines": {
"node": ">=4.8.2"
},
"peerDependencies": {
"acorn": "^6.1.0 || ^7 || ^8"
}
},
"node_modules/acorn-walk": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
@ -5917,18 +5854,6 @@
"node": ">=0.4.0"
}
},
"node_modules/acorn-walk/node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/adjust-sourcemap-loader": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-4.0.0.tgz",
@ -7650,12 +7575,6 @@
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"license": "MIT"
},
"node_modules/buntis": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/buntis/-/buntis-0.2.1.tgz",
"integrity": "sha512-5wszfQlsqJmZrfxpPkO5yQcEoBAmfUYlXxXU/IM6PhPZ8DMnMMJQ9rvAHfe5WZmnB6E1IoJYylFfTaf1e2FJbQ==",
"license": "ISC"
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@ -9452,41 +9371,6 @@
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"license": "MIT"
},
"node_modules/easygettext": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/easygettext/-/easygettext-2.17.0.tgz",
"integrity": "sha512-QmMWIu6l83SW2QuEFd4GIDrTey0qOn0haTOMt4NdPKPHEBihAqdo9HHYRDHiPg/msZSKaye7qDOLAcqHlmfo+g==",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.11.6",
"acorn": "^7.4.0",
"acorn-stage3": "^4.0.0",
"acorn-walk": "^8.0.0",
"buntis": "0.2.1",
"cheerio": "^1.0.0-rc.3",
"estree-walker": "^2.0.1",
"flow-remove-types": "^2.135.0",
"minimist": "^1.2.5",
"pofile": "^1.1.0"
},
"bin": {
"gettext-compile": "src/compile-cli.js",
"gettext-extract": "src/extract-cli.js"
},
"engines": {
"node": ">=8"
},
"optionalDependencies": {
"@vue/compiler-sfc": "^3.0.0",
"pug": "^3.0.2"
}
},
"node_modules/easygettext/node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"license": "MIT"
},
"node_modules/editorconfig": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-1.0.4.tgz",
@ -10497,18 +10381,6 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/espree/node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/esprima": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
@ -11224,36 +11096,6 @@
}
}
},
"node_modules/flow-remove-types": {
"version": "2.288.0",
"resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.288.0.tgz",
"integrity": "sha512-d5UxlicwfNysPMlCzC6tPdF8qyVP2Da022qyvkrTkBgnZMcZXdLkys+MYL9XOpPcLxXk4huIweeg+ZwCQ9+Vgg==",
"license": "MIT",
"dependencies": {
"hermes-parser": "0.32.0",
"pirates": "^3.0.2",
"vlq": "^0.2.1"
},
"bin": {
"flow-node": "flow-node",
"flow-remove-types": "flow-remove-types"
},
"engines": {
"node": ">=4"
}
},
"node_modules/flow-remove-types/node_modules/pirates": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/pirates/-/pirates-3.0.2.tgz",
"integrity": "sha512-c5CgUJq6H2k6MJz72Ak1F5sN9n9wlSlJyEnwvpm9/y3WB4E3pHBDT2c6PEiS1vyJvq2bUxUAIu0EGf8Cx4Ic7Q==",
"license": "MIT",
"dependencies": {
"node-modules-regexp": "^1.0.0"
},
"engines": {
"node": ">= 4"
}
},
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
@ -12078,21 +11920,6 @@
"node": ">=16.0.0"
}
},
"node_modules/hermes-estree": {
"version": "0.32.0",
"resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.32.0.tgz",
"integrity": "sha512-KWn3BqnlDOl97Xe1Yviur6NbgIZ+IP+UVSpshlZWkq+EtoHg6/cwiDj/osP9PCEgFE15KBm1O55JRwbMEm5ejQ==",
"license": "MIT"
},
"node_modules/hermes-parser": {
"version": "0.32.0",
"resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.32.0.tgz",
"integrity": "sha512-g4nBOWFpuiTqjR3LZdRxKUkij9iyveWeuks7INEsMX741f3r9xxrOe8TeQfUxtda0eXmiIFiMQzoeSQEno33Hw==",
"license": "MIT",
"dependencies": {
"hermes-estree": "0.32.0"
}
},
"node_modules/hls.js": {
"version": "1.6.13",
"resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.13.tgz",
@ -12739,6 +12566,18 @@
"object-assign": "^4.1.1"
}
},
"node_modules/is-expression/node_modules/acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/is-extendable": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
@ -14347,15 +14186,6 @@
"license": "MIT",
"optional": true
},
"node_modules/node-modules-regexp": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz",
"integrity": "sha512-JMaRS9L4wSRIR+6PTVEikTrq/lMGEZR43a48ETeilY0Q0iMwVnccMFrUM1k+tNzmYuIU0Vh710bCUqHX+/+ctQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/node-releases": {
"version": "2.0.25",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.25.tgz",
@ -19610,18 +19440,6 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/terser/node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/terser/node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@ -20695,12 +20513,6 @@
}
}
},
"node_modules/vlq": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz",
"integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==",
"license": "MIT"
},
"node_modules/void-elements": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
@ -21470,18 +21282,6 @@
"node": ">= 10.13.0"
}
},
"node_modules/webpack-bundle-analyzer/node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/webpack-bundle-analyzer/node_modules/commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
@ -21883,31 +21683,6 @@
"node": ">=10.13.0"
}
},
"node_modules/webpack/node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/webpack/node_modules/acorn-import-phases": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
"integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
"license": "MIT",
"engines": {
"node": ">=10.13.0"
},
"peerDependencies": {
"acorn": "^8.14.0"
}
},
"node_modules/webpack/node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",

View file

@ -15,7 +15,7 @@
"fmt": "eslint --cache --fix src/ *.js eslint.config.mjs",
"fmt-npm": "prettier --write package.json",
"gettext-compile": "vue-gettext-compile",
"gettext-extract": "gettext-extract --output src/locales/translations.pot $(find ${SRC:-src} -type f \\( -iname \\*.vue -o -iname \\*.js \\) -not -path src/common/gettext.js)",
"gettext-extract": "vue-gettext-extract --config gettext.config.js",
"lint": "eslint --cache src/ *.js",
"test": "cross-env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test vitest run",
"test-watch": "cross-env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test vitest --watch",
@ -65,7 +65,6 @@
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"cssnano": "^7.1.1",
"easygettext": "^2.17.0",
"eslint": "^9.37.0",
"eslint-config-prettier": "^10.1.8",
"eslint-formatter-pretty": "^6.0.1",