Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Oct 6, 2023
2 parents ab726a6 + 417fa01 commit 9a36f6e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
32 changes: 22 additions & 10 deletions build-scripts/survey-core/webpack.i18n.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";

const fs = require("fs");
const path = require("path");
const webpackCommonConfigCreator = require("../webpack.common");
const { merge } = require("webpack-merge");
var packageJson = require("./package.json");
Expand All @@ -14,19 +15,30 @@ const config = {
}
}
};
function patchEntries() {
config.entry = {};
fs.readdirSync(path.resolve(__dirname, "../../src/localization")).forEach(file => {
var extension = path.extname(file);
if (extension.toLowerCase() === ".ts") {
config.entry[path.basename(file, extension)] = (path.resolve(__dirname, "../../src/localization") + "/" + file);
}
});
config.entry.index = path.resolve(__dirname, "../../src/entries/i18n.ts");
}

// fs.readdirSync(path.resolve(__dirname, "../../src/localization")).forEach(file => {
// var extension = path.extname(file);
// if (extension.toLowerCase() === ".ts") {
// config.entry[path.basename(file, extension)] = (path.resolve(__dirname, "../../src/localization") + "\\" + file);
// // console.log(path.basename(file, extension));
// // console.log(path.resolve(__dirname, "../../src/localization") + "\\" + file);
// }
// });

function patchFilename(options) {
config.output = {};
const isProductionBuild = options.buildType === "prod";
config.output.filename = (pathData) => {
return (pathData.chunk.name == "survey.i18n" ? "[name]" : "i18n/[name]") + (isProductionBuild ? ".min" : "") + ".js";
}
}

module.exports = function (options) {
options.platform = "i18n";
options.libraryName = "SurveyLocales";
patchEntries();
patchFilename(options);
return merge(webpackCommonConfigCreator(options, packageJson, "survey.i18n"), config);
};

4 changes: 1 addition & 3 deletions src/knockout/templates/question-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
<!-- ko template: { name: 'survey-question-file-video', data: { question: question } } --><!-- /ko -->
<!-- /ko -->
<!-- ko template: { name: 'survey-question-file-clean-button', data: {question: question, showRemoveButton: question.showRemoveButton} } --><!-- /ko -->
<!-- ko if: question.showPreview -->
<!-- ko if: question.koHasValue && question.allowShowPreview -->
<!-- ko if: question.allowShowPreview -->
<!-- ko component: { name: 'sv-file-preview', data: { question: question } } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<!-- ko template: { name: 'survey-question-file-clean-button', data: {question: question, showRemoveButton: question.showRemoveButtonBottom} } --><!-- /ko -->
<!-- ko if: question.fileNavigatorVisible -->
<!-- ko component: { name: 'sv-action-bar', params: { model: question.fileNavigator } } -->
Expand Down

0 comments on commit 9a36f6e

Please sign in to comment.