diff --git a/web/package.json b/web/package.json
index e42822dcb..1c4898d42 100644
--- a/web/package.json
+++ b/web/package.json
@@ -12,9 +12,11 @@
},
"lingui": {
"sourceLocale": "en",
- "locales": [
- "en"
- ],
+ "locales": ["en", "pseudo-LOCALE"],
+ "pseudoLocale": "pseudo-LOCALE",
+ "fallbackLocales": {
+ "pseudo-LOCALE": "en"
+ },
"compileNamespace": "ts",
"catalogs": [
{
@@ -68,7 +70,6 @@
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-cssimport": "^1.0.2",
- "rollup-plugin-external-globals": "^0.6.1",
"rollup-plugin-minify-html-literals": "^1.2.6",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.6.3",
diff --git a/web/rollup.config.js b/web/rollup.config.js
index 803fab4fb..cc60e7f7a 100644
--- a/web/rollup.config.js
+++ b/web/rollup.config.js
@@ -5,12 +5,11 @@ import sourcemaps from "rollup-plugin-sourcemaps";
import typescript from "@rollup/plugin-typescript";
import cssimport from "rollup-plugin-cssimport";
import copy from "rollup-plugin-copy";
-import externalGlobals from "rollup-plugin-external-globals";
-import babel from '@rollup/plugin-babel';
-import replace from '@rollup/plugin-replace';
+import babel from "@rollup/plugin-babel";
+import replace from "@rollup/plugin-replace";
const extensions = [
- '.js', '.jsx', '.ts', '.tsx',
+ ".js", ".jsx", ".ts", ".tsx",
];
const resources = [
@@ -32,6 +31,11 @@ const resources = [
const isProdBuild = process.env.NODE_ENV === "production";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function manualChunks(id) {
+ if (id.includes("locales")) {
+ const parts = id.split("/");
+ const file = parts[parts.length - 1];
+ return "locale-" + file.replace(".ts", "");
+ }
if (id.includes("node_modules")) {
if (id.includes("codemirror")) {
return "vendor-cm";
@@ -105,23 +109,19 @@ export default [
commonjs(),
babel({
extensions,
- babelHelpers: 'runtime',
- include: ['src/**/*'],
+ babelHelpers: "runtime",
+ include: ["src/**/*"],
}),
replace({
- 'process.env.NODE_ENV': JSON.stringify(isProdBuild ? 'production' : "development"),
+ "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"),
preventAssignment: true
}),
- externalGlobals({
- django: "django",
- }),
sourcemaps(),
isProdBuild && terser(),
].filter(p => p),
watch: {
clearScreen: false,
},
- external: ["django"]
},
// Flow executor
{
@@ -140,22 +140,18 @@ export default [
commonjs(),
babel({
extensions,
- babelHelpers: 'runtime',
- include: ['src/**/*'],
+ babelHelpers: "runtime",
+ include: ["src/**/*"],
}),
replace({
- 'process.env.NODE_ENV': JSON.stringify(isProdBuild ? 'production' : "development"),
+ "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"),
preventAssignment: true
}),
- externalGlobals({
- django: "django"
- }),
sourcemaps(),
isProdBuild && terser(),
].filter(p => p),
watch: {
clearScreen: false,
},
- external: ["django"]
},
];
diff --git a/web/src/django.d.ts b/web/src/django.d.ts
deleted file mode 100644
index 66cfe6379..000000000
--- a/web/src/django.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-declare module "django" {
- export = django;
-}
-declare namespace django {
- function gettext(name: string): string;
- function ngettext(singular: string, plural: string, count: number): string;
- function gettext_noop(msgid: string): string;
- function pgettext(context: string, msgid: string): string;
- function interpolate(fmt: string, obj: unknown, named: boolean): string;
-}
diff --git a/web/src/elements/Expand.ts b/web/src/elements/Expand.ts
index 6fba66b58..1343bd797 100644
--- a/web/src/elements/Expand.ts
+++ b/web/src/elements/Expand.ts
@@ -1,4 +1,4 @@
-import { gettext } from "django";
+import { t } from "@lingui/macro";
import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import PFExpandableSection from "../../node_modules/@patternfly/patternfly/components/ExpandableSection/expandable-section.css";
@@ -26,7 +26,7 @@ export class Expand extends LitElement {
${gettext(description)}
` : html``} + ${description ? html`${t`${description}`}
` : html``}- ${gettext(`${this.unread} unread`)} + ${t`${this.unread} unread`}