From c6f097e85e256c74b9ac22521cc3fec6cdd10fe0 Mon Sep 17 00:00:00 2001 From: Marcello Perathoner Date: Thu, 12 Sep 2024 23:30:36 +0200 Subject: [PATCH] fix meta-search; new custom gettext extractor --- Makefile | 2 +- docs/cap-gettext-extractor.mjs | 184 +++++++ docs/conf.py | 6 +- docs/gh-pages/artifact.tar.gz | Bin 11816960 -> 11919360 bytes docs/sphinxcontrib-minilang | 1 + docs/sphinxcontrib-pic | 1 - docs/src/_static/my_theme.css | 10 +- docs/src/maintenance/index.rst | 1 + docs/src/maintenance/scripts.rst | 16 + docs/src/overviews/collation_tool.rst | 6 +- docs/src/overviews/fulltext_search.rst | 8 +- docs/src/overviews/html_generation.rst | 4 +- docs/src/overviews/makefile.rst | 2 +- docs/src/vm/database.rst | 4 +- docs/src/vm/intro.rst | 2 +- docs/src/vm/transformations.rst | 4 +- docs/src/vm/wordpress/development.rst | 51 +- include.mak | 4 +- package.json | 17 +- plugins/cap-collation/src/js/front.js | 6 +- plugins/cap-collation/src/js/selector.vue | 4 +- plugins/cap-collation/src/js/tools.js | 13 +- .../src/languages/capitularia.pot | 6 +- plugins/cap-collation/src/languages/de_DE.po | 10 +- plugins/cap-collation/src/languages/js.pot | 6 +- plugins/cap-dynamic-menu/src/js/front.js | 8 +- .../cap-file-includer/src/languages/de_DE.po | 11 +- plugins/cap-lib/src/languages/de_DE.po | 10 +- .../class-meta-search-widget.php | 11 +- plugins/cap-meta-search/class-meta-search.php | 14 +- plugins/cap-meta-search/functions.php | 5 +- plugins/cap-meta-search/search.php | 2 +- plugins/cap-meta-search/src/js/cap-tab.vue | 4 +- plugins/cap-meta-search/src/js/front.js | 34 +- plugins/cap-meta-search/src/js/main.vue | 64 ++- .../src/languages/capitularia.pot | 50 +- .../cap-meta-search/src/languages/de_DE.po | 71 +-- plugins/cap-meta-search/src/languages/js.pot | 6 +- plugins/cap-meta-search/src/languages/php.pot | 16 +- plugins/cap-meta-search/src/languages/vue.pot | 32 +- .../cap-page-generator/src/languages/de_DE.po | 10 +- pnpm-lock.yaml | 457 ++++++++++-------- server/data_server.py | 2 +- server/db.py | 26 +- server/scripts/import_data.py | 60 ++- server/scripts/import_solr.py | 13 +- server/solr_server.py | 3 + themes/Capitularia/header.php | 5 +- .../Capitularia/src/languages/capitularia.pot | 4 +- themes/Capitularia/src/languages/de_DE.po | 8 +- themes/Capitularia/src/languages/php.pot | 4 +- variables.mak | 25 +- 52 files changed, 845 insertions(+), 478 deletions(-) create mode 100644 docs/cap-gettext-extractor.mjs create mode 120000 docs/sphinxcontrib-minilang delete mode 120000 docs/sphinxcontrib-pic create mode 100644 docs/src/maintenance/scripts.rst diff --git a/Makefile b/Makefile index 416300f3..b17a0ae9 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ black: -black server/ python/ -TARGETS = csslint jslint phplint mo po pot +TARGETS = csslint jslint phplint mo po pot poedit define TARGETS_TEMPLATE diff --git a/docs/cap-gettext-extractor.mjs b/docs/cap-gettext-extractor.mjs new file mode 100644 index 00000000..cc1a53ef --- /dev/null +++ b/docs/cap-gettext-extractor.mjs @@ -0,0 +1,184 @@ +import { GettextExtractor, JsExtractors, HtmlExtractors } from 'gettext-extractor'; +import sfc from '@vue/compiler-sfc'; +import { glob } from 'glob'; +import { readFileSync } from 'node:fs'; +import { ArgumentParser } from 'argparse'; +import sourceMap from 'source-map'; +import _ from 'lodash-es'; + +const sourceMaps = {}; + +const JSExtractor = new GettextExtractor(); +const VueExtractor = new GettextExtractor(); + +/** + * Extractor for JS files and