From b50baf6209bec5bcc3fc3d50f31fde130bb3d6e2 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 20 Aug 2024 13:13:15 +0100 Subject: [PATCH] Remove PO compilation from webpack.config --- .github/workflows/CI.yml | 6 ++--- src/pydata_sphinx_theme/locale/sphinx.pot | 5 ++-- tox.ini | 1 - webpack.config.js | 33 +++++++++-------------- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0eef947b2..17092de2b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -74,15 +74,15 @@ jobs: - name: "Run tests ✅" shell: bash run: | - # this will compile the assets then run the tests + # this will compile the assets and translations then run the tests # check if there is a specific Sphinx version to test with # example substitution: tox run -e compile,py39-sphinx61-tests if [ -n "${{matrix.sphinx-version}}" ]; then - python -Im tox run -e compile,py$(echo ${{ matrix.python-version }} | tr -d .)-sphinx$(echo ${{ matrix.sphinx-version }} | tr -d .)-tests + python -Im tox run -e compile,i18n-compile,py$(echo ${{ matrix.python-version }} | tr -d .)-sphinx$(echo ${{ matrix.sphinx-version }} | tr -d .)-tests # if not we use the default version # example substitution: tox run -e compile,py39-tests else - python -Im tox run -e compile,py$(echo ${{ matrix.python-version }} | tr -d .)-tests + python -Im tox run -e compile,i18n-compile,py$(echo ${{ matrix.python-version }} | tr -d .)-tests fi - name: "Upload coverage data to GH artifacts 📤" if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && matrix.sphinx-version == 'dev' diff --git a/src/pydata_sphinx_theme/locale/sphinx.pot b/src/pydata_sphinx_theme/locale/sphinx.pot index 61162fac6..9b4b240c3 100644 --- a/src/pydata_sphinx_theme/locale/sphinx.pot +++ b/src/pydata_sphinx_theme/locale/sphinx.pot @@ -1,15 +1,14 @@ # Translations template for pydata-sphinx-theme. -# Copyright (C) 2024 PyData +# Copyright (C) 2024 PyData developers # This file is distributed under the same license as the pydata-sphinx-theme # project. # FIRST AUTHOR , 2024. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: pydata-sphinx-theme 0.15.4.dev0\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-08-19 18:04+0100\n" +"POT-Creation-Date: 2024-08-20 12:53+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/tox.ini b/tox.ini index 322da8103..bd05629b9 100644 --- a/tox.ini +++ b/tox.ini @@ -154,7 +154,6 @@ package = editable commands = pybabel init -i src/pydata_sphinx_theme/locale/sphinx.pot -d src/pydata_sphinx_theme/locale -l {posargs} - # update locales translation catalogues based on a POT template, if passed without # arguments it will update all locales tox run -e i18n-update # to update a single locale you can pass the locale code, for example: diff --git a/webpack.config.js b/webpack.config.js index ff56828ec..21d25a02d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -18,23 +18,16 @@ const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); const dedent = require("dedent"); const { Compilation } = require("webpack"); -/******************************************************************************* - * Compile our translation files - */ -const { exec } = require("child_process"); -const localePath = resolve(__dirname, "src/pydata_sphinx_theme/locale"); -exec(`pybabel compile -d ${localePath} -D sphinx`); - /******************************************************************************* * Paths for various assets (sources and destinations) */ -const vendorVersions = {fontAwesome: require("@fortawesome/fontawesome-free/package.json").version}; +const vendorVersions = { fontAwesome: require("@fortawesome/fontawesome-free/package.json").version }; const scriptPath = resolve(__dirname, "src/pydata_sphinx_theme/assets/scripts"); -const staticPath = resolve(__dirname,"src/pydata_sphinx_theme/theme/pydata_sphinx_theme/static"); +const staticPath = resolve(__dirname, "src/pydata_sphinx_theme/theme/pydata_sphinx_theme/static"); const vendorPath = resolve(staticPath, "vendor"); -const faPath = {fontAwesome: resolve(vendorPath, "fontawesome", vendorVersions.fontAwesome)}; +const faPath = { fontAwesome: resolve(vendorPath, "fontawesome", vendorVersions.fontAwesome) }; /******************************************************************************* * functions to load the assets in the html head @@ -42,15 +35,15 @@ const faPath = {fontAwesome: resolve(vendorPath, "fontawesome", vendorVersions.f * the fonts are loaded from vendors */ -function stylesheet(css){ return ``;} -function preload(js){ return ``;} -function script(js){ return ``;} -function font(woff2){ return ``;} +function stylesheet(css) { return ``; } +function preload(js) { return ``; } +function script(js) { return ``; } +function font(woff2) { return ``; } /******************************************************************************* * the assets to load in the macro */ - const theme_stylesheets = [ +const theme_stylesheets = [ "styles/theme.css", // basic sphinx css "styles/bootstrap.css", // all bootstrap 5 css with variable adjustments "styles/pydata-sphinx-theme.css", // all the css created for this specific theme @@ -152,15 +145,15 @@ module.exports = { "pydata-sphinx-theme": resolve(scriptPath, "pydata-sphinx-theme.js"), "bootstrap": resolve(scriptPath, "bootstrap.js"), }, - output: {filename: "scripts/[name].js", path: staticPath}, - optimization: {minimizer: ['...', new CssMinimizerPlugin()]}, + output: { filename: "scripts/[name].js", path: staticPath }, + optimization: { minimizer: ['...', new CssMinimizerPlugin()] }, module: { rules: [{ test: /\.scss$/, use: [ - {loader: MiniCssExtractPlugin.loader}, - {loader: "css-loader", options: { url: false }}, - {loader: "sass-loader",}, + { loader: MiniCssExtractPlugin.loader }, + { loader: "css-loader", options: { url: false } }, + { loader: "sass-loader", }, ], }], },