Implement Translator: i18n system
This commit is contained in:
parent
5f62894d56
commit
8a2767ef40
16 changed files with 393 additions and 47 deletions
|
@ -1,12 +1,16 @@
|
|||
import type { Configuration } from "webpack";
|
||||
import type WebpackDevServer from "webpack-dev-server";
|
||||
import path from "path";
|
||||
import webpack from "webpack";
|
||||
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
||||
import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||
import sveltePreprocess from "svelte-preprocess";
|
||||
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
||||
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
|
||||
import path from "path";
|
||||
import sveltePreprocess from "svelte-preprocess";
|
||||
import type { Configuration } from "webpack";
|
||||
import webpack from "webpack";
|
||||
import type WebpackDevServer from "webpack-dev-server";
|
||||
import type { LanguageFound } from "./src/Translator/TranslationCompiler";
|
||||
import { fallbackLanguageObject, languages, languagesObject } from "./src/Translator/TranslationCompiler";
|
||||
|
||||
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
|
||||
|
||||
const mode = process.env.NODE_ENV ?? "development";
|
||||
const buildNpmTypingsForApi = !!process.env.BUILD_TYPINGS;
|
||||
|
@ -141,6 +145,11 @@ module.exports = {
|
|||
filename: "fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
exclude: /node_modules/,
|
||||
type: "asset",
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
|
@ -210,6 +219,24 @@ module.exports = {
|
|||
NODE_ENV: mode,
|
||||
DISABLE_ANONYMOUS: false,
|
||||
OPID_LOGIN_SCREEN_PROVIDER: null,
|
||||
FALLBACK_LANGUAGE: null,
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
FALLBACK_LANGUAGE_OBJECT: JSON.stringify(fallbackLanguageObject),
|
||||
LANGUAGES: JSON.stringify(languagesObject),
|
||||
}),
|
||||
new MergeJsonWebpackPlugin({
|
||||
output: {
|
||||
groupBy: languages.map((language: LanguageFound) => {
|
||||
return {
|
||||
pattern: `./translations/**/*.${language.id}.json`,
|
||||
fileName: `./resources/translations/${language.id}.json`
|
||||
};
|
||||
})
|
||||
},
|
||||
globOptions: {
|
||||
nosort: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
} as Configuration & WebpackDevServer.Configuration;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue