forked from MapComplete/MapComplete
Porting fixes from stale branch
This commit is contained in:
parent
a9b6223e4d
commit
03d801733b
4 changed files with 24 additions and 19 deletions
|
@ -101,7 +101,7 @@
|
||||||
{
|
{
|
||||||
"if": {
|
"if": {
|
||||||
"and": [
|
"and": [
|
||||||
"addr:housenumber:=",
|
"addr:housenumber=",
|
||||||
"not:addr:housenumber=yes",
|
"not:addr:housenumber=yes",
|
||||||
"fixme="
|
"fixme="
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {lstatSync, readdirSync, readFileSync} from "fs";
|
import {lstatSync, readdirSync, readFileSync} from "fs";
|
||||||
import {Utils} from "../Utils";
|
import {Utils} from "../Utils";
|
||||||
|
|
||||||
Utils.runningFromConsole = true
|
Utils.runningFromConsole = true
|
||||||
import * as https from "https";
|
import * as https from "https";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
@ -107,6 +108,7 @@ export default class ScriptUtils {
|
||||||
public static getLayerFiles(): { parsed: LayerConfigJson, path: string }[] {
|
public static getLayerFiles(): { parsed: LayerConfigJson, path: string }[] {
|
||||||
return ScriptUtils.readDirRecSync("./assets/layers")
|
return ScriptUtils.readDirRecSync("./assets/layers")
|
||||||
.filter(path => path.indexOf(".json") > 0)
|
.filter(path => path.indexOf(".json") > 0)
|
||||||
|
.filter(path => path.indexOf(".proto.json") < 0)
|
||||||
.filter(path => path.indexOf("license_info.json") < 0)
|
.filter(path => path.indexOf("license_info.json") < 0)
|
||||||
.map(path => {
|
.map(path => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -25,6 +25,9 @@ class LayerOverviewUtils {
|
||||||
const themeFiles: LayoutConfigJson[] = ScriptUtils.getThemeFiles().map(x => x.parsed);
|
const themeFiles: LayoutConfigJson[] = ScriptUtils.getThemeFiles().map(x => x.parsed);
|
||||||
|
|
||||||
console.log("Discovered", layerFiles.length, "layers and", themeFiles.length, "themes\n")
|
console.log("Discovered", layerFiles.length, "layers and", themeFiles.length, "themes\n")
|
||||||
|
if (layerFiles.length + themeFiles.length === 0) {
|
||||||
|
throw "Panic: no themes and layers loaded!"
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
layers: layerFiles,
|
layers: layerFiles,
|
||||||
themes: themeFiles
|
themes: themeFiles
|
||||||
|
|
|
@ -235,7 +235,7 @@ function MergeTranslation(source: any, target: any, language: string, context: s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof targetV === "string") {
|
if (typeof targetV === "string") {
|
||||||
throw `At context ${context}: Could not add a translation. The target object has a string at the given path, whereas the translation contains an object.\n String at target: ${targetV}\n Object at translation source: ${JSON.stringify(sourceV)}`
|
throw `At context ${context}: Could not add a translation in language ${language}. The target object has a string at the given path, whereas the translation contains an object.\n String at target: ${targetV}\n Object at translation source: ${JSON.stringify(sourceV)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
targetV[language] = sourceV;
|
targetV[language] = sourceV;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue