mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Add store page to translations
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
"serialize-error": "^3.0.0",
|
||||
"strictdom": "^1.0.1",
|
||||
"string-replace-webpack-plugin": "^0.1.3",
|
||||
"strip-indent": "^3.0.0",
|
||||
"terser-webpack-plugin": "^1.1.0",
|
||||
"through2": "^3.0.1",
|
||||
"uglify-template-string-loader": "^1.1.0",
|
||||
@@ -66,7 +67,6 @@
|
||||
"babel-plugin-danger-remove-unused-import": "^1.1.2",
|
||||
"css-mqpacker": "^7.0.0",
|
||||
"cssnano": "^4.1.10",
|
||||
"postcss-critical-split": "^2.5.3",
|
||||
"electron-packager": "^14.0.6",
|
||||
"faster.js": "^1.1.0",
|
||||
"glob": "^7.1.3",
|
||||
@@ -99,6 +99,7 @@
|
||||
"jimp": "^0.6.1",
|
||||
"js-yaml": "^3.13.1",
|
||||
"postcss-assets": "^5.0.0",
|
||||
"postcss-critical-split": "^2.5.3",
|
||||
"postcss-preset-env": "^6.5.0",
|
||||
"postcss-round-subpixels": "^1.2.0",
|
||||
"postcss-unprefix": "^2.1.3",
|
||||
|
||||
@@ -1,22 +1,89 @@
|
||||
const path = require("path");
|
||||
|
||||
const yaml = require("gulp-yaml");
|
||||
|
||||
const translationsSourceDir = path.join(__dirname, "..", "translations");
|
||||
const translationsJsonDir = path.join(__dirname, "..", "src", "js", "built-temp");
|
||||
|
||||
function gulptasksTranslations($, gulp) {
|
||||
gulp.task("translations.convertToJson", () => {
|
||||
return gulp
|
||||
.src(path.join(translationsSourceDir, "*.yaml"))
|
||||
.pipe($.plumber())
|
||||
.pipe(yaml({ space: 2, safe: true }))
|
||||
.pipe(gulp.dest(translationsJsonDir));
|
||||
});
|
||||
|
||||
gulp.task("translations.fullBuild", gulp.series("translations.convertToJson"));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
gulptasksTranslations,
|
||||
};
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const gulpYaml = require("gulp-yaml");
|
||||
const YAML = require("yaml");
|
||||
const stripIndent = require("strip-indent");
|
||||
const trim = require("trim");
|
||||
|
||||
const translationsSourceDir = path.join(__dirname, "..", "translations");
|
||||
const translationsJsonDir = path.join(__dirname, "..", "src", "js", "built-temp");
|
||||
|
||||
function gulptasksTranslations($, gulp) {
|
||||
gulp.task("translations.convertToJson", () => {
|
||||
return gulp
|
||||
.src(path.join(translationsSourceDir, "*.yaml"))
|
||||
.pipe($.plumber())
|
||||
.pipe(gulpYaml({ space: 2, safe: true }))
|
||||
.pipe(gulp.dest(translationsJsonDir));
|
||||
});
|
||||
|
||||
gulp.task("translations.fullBuild", gulp.series("translations.convertToJson"));
|
||||
|
||||
gulp.task("translations.prepareSteamPage", cb => {
|
||||
const files = fs.readdirSync(translationsSourceDir);
|
||||
|
||||
files
|
||||
.filter(name => name.endsWith(".yaml"))
|
||||
.forEach(fname => {
|
||||
const languageName = fname.replace(".yaml", "");
|
||||
const abspath = path.join(translationsSourceDir, fname);
|
||||
|
||||
const destpath = path.join(translationsSourceDir, "tmp", languageName + "-store.txt");
|
||||
|
||||
const contents = fs.readFileSync(abspath, { encoding: "utf-8" });
|
||||
const data = YAML.parse(contents);
|
||||
|
||||
const storePage = data.steamPage;
|
||||
|
||||
const content = `
|
||||
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
||||
|
||||
${storePage.intro.replace(/\n/gi, "\n\n")}
|
||||
|
||||
[h2]${storePage.title_advantages}[/h2]
|
||||
|
||||
[list]
|
||||
${storePage.advantages
|
||||
.map(x => "[*] " + x.replace(/<b>/, "[b]").replace(/<\/b>/, "[/b]"))
|
||||
.join("\n")}
|
||||
[/list]
|
||||
|
||||
[h2]${storePage.title_future}[/h2]
|
||||
|
||||
[list]
|
||||
${storePage.planned
|
||||
.map(x => "[*] " + x.replace(/<b>/, "[b]").replace(/<\/b>/, "[/b]"))
|
||||
.join("\n")}
|
||||
[/list]
|
||||
|
||||
[h2]${storePage.title_open_source}[/h2]
|
||||
|
||||
${storePage.text_open_source.replace(/\n/gi, "\n\n")}
|
||||
|
||||
[h2]${storePage.title_links}[/h2]
|
||||
|
||||
[list]
|
||||
[*] [url=https://discord.com/invite/HN7EVzV]${storePage.links.discord}[/url]
|
||||
[*] [url=https://trello.com/b/ISQncpJP/shapezio]${storePage.links.roadmap}[/url]
|
||||
[*] [url=https://www.reddit.com/r/shapezio]${storePage.links.subreddit}[/url]
|
||||
[*] [url=https://github.com/tobspr/shapez.io]${storePage.links.source_code}[/url]
|
||||
[*] [url=https://github.com/tobspr/shapez.io/blob/master/translations/README.md]${
|
||||
storePage.links.translate
|
||||
}[/url]
|
||||
[/list]
|
||||
|
||||
|
||||
`;
|
||||
|
||||
fs.writeFileSync(destpath, trim(content.replace(/(\n[ \t\r]*)/gi, "\n")), {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
});
|
||||
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
gulptasksTranslations,
|
||||
};
|
||||
|
||||
@@ -8198,6 +8198,11 @@ min-document@^2.19.0:
|
||||
dependencies:
|
||||
dom-walk "^0.1.0"
|
||||
|
||||
min-indent@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
|
||||
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
|
||||
|
||||
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
|
||||
@@ -11945,6 +11950,13 @@ strip-indent@^1.0.1:
|
||||
dependencies:
|
||||
get-stdin "^4.0.1"
|
||||
|
||||
strip-indent@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001"
|
||||
integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==
|
||||
dependencies:
|
||||
min-indent "^1.0.0"
|
||||
|
||||
strip-json-comments@^2.0.1, strip-json-comments@~2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
|
||||
|
||||
Reference in New Issue
Block a user