Skip to content

Commit d182f7d

Browse files
committed
As I couldn't figure out how to separate lang modules update the update of webpack, I rolled back the split to different lang packages
1 parent 1f5888e commit d182f7d

File tree

4 files changed

+8
-43
lines changed

4 files changed

+8
-43
lines changed

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "workshop_butler_widget",
3-
"version": "1.17.0",
3+
"version": "1.18.0",
44
"description": "Workshop Butler JS Widgets",
55
"author": "https://workshopbutler.com",
66
"license": "ISC",
@@ -65,8 +65,7 @@
6565
"test": "mocha --require ./ignoreImports.ts --require ts-node/register 'test/**/*.ts' '**/*.test.ts'",
6666
"watch:webpack": "NODE_ENV=watch webpack-dev-server --mode development",
6767
"watch:eleventy": "eleventy --watch",
68-
"fast-build": "NODE_ENV=build webpack --mode production",
69-
"build": "for lang in en de es fr nl no pt \n do \n LANG=$lang NODE_ENV=build webpack --mode production \n done",
68+
"build": "NODE_ENV=build webpack --mode production",
7069
"build-wordpress": "NODE_ENV=build-wordpress webpack --mode production",
7170
"check-css-style": "stylelint \"src/styles/**/*.less\"",
7271
"fix-css-style": "stylelint \"src/styles/**/*.less\" --fix",

src/utils/Localisation.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import i18next from 'i18next';
22
import IPlainObject from '../interfaces/IPlainObject';
33
import * as resources from '../locales';
4-
5-
declare const WIDGET_LANGUAGE: string;
6-
74
/**
85
* Controls the translation of message tokens to actual strings
96
*/
@@ -17,16 +14,16 @@ export default class Localisation {
1714
* @param userDict {IPlainObject} User dictionary to replace some default values
1815
*/
1916
constructor(locale: string, language: string, userDict: IPlainObject) {
20-
const dict = (resources as any)[WIDGET_LANGUAGE];
17+
const dict = (resources as any)[language];
2118
const skinnyResource: IPlainObject = {};
22-
skinnyResource[WIDGET_LANGUAGE] = {
23-
translation: userDict[WIDGET_LANGUAGE] ? this.deepCopy(dict, userDict[WIDGET_LANGUAGE]) : dict,
19+
skinnyResource[language] = {
20+
translation: userDict[language] ? this.deepCopy(dict, userDict[language]) : dict,
2421
};
2522
this.locale = locale;
2623
i18next.init({
2724
debug: false,
28-
fallbackLng: WIDGET_LANGUAGE,
29-
lng: WIDGET_LANGUAGE,
25+
fallbackLng: language,
26+
lng: language,
3027
resources: skinnyResource,
3128
});
3229
}

webpack.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const options = {
1414
apiKey: process.env.API_KEY,
1515
theme: 'alfred',
1616
apiVersion: '2021-09-26',
17-
lang: process.env.LANG ? process.env.LANG : 'en',
1817
};
1918

2019
let webpackConfig = {
@@ -31,7 +30,7 @@ let webpackConfig = {
3130
},
3231
output: {
3332
path: path.resolve(__dirname, isDev ? 'site/static/' : `dist/`),
34-
filename: isDev ? `[name].js` : `[name].${getVersion()}.${options.lang}.js`,
33+
filename: isDev ? `[name].js` : `[name].${getVersion()}.js`,
3534
sourceMapFilename: isDev ? `[name].js.map` : `[name].${getVersion()}.js.map`
3635
},
3736
externals: {
@@ -112,7 +111,6 @@ function getPlugins() {
112111
BACKEND_URL: JSON.stringify(options.backend),
113112
API_VERSION: JSON.stringify(options.apiVersion),
114113
WIDGET_VERSION: JSON.stringify(getVersion()),
115-
WIDGET_LANGUAGE: JSON.stringify(options.lang),
116114
}),
117115
new MiniCssExtractPlugin({
118116
filename: isDev? `[name].css` : `[name].${getVersion()}.min.css`

0 commit comments

Comments
 (0)