diff --git a/Logic/FeatureSource/FeaturePipeline.ts b/Logic/FeatureSource/FeaturePipeline.ts index 895bc155b..6738c096c 100644 --- a/Logic/FeatureSource/FeaturePipeline.ts +++ b/Logic/FeatureSource/FeaturePipeline.ts @@ -287,14 +287,14 @@ export default class FeaturePipeline { // Also load points/lines that are newly added. const newGeometry = new NewGeometryFromChangesFeatureSource(state.changes, state.osmConnection._oauth_config.url) + newGeometry.features.addCallbackAndRun(geometries => { + console.debug("New geometries are:", geometries) + }) + new RegisteringAllFromFeatureSourceActor(newGeometry, state.allElements) // A NewGeometryFromChangesFeatureSource does not split per layer, so we do this next new PerLayerFeatureSourceSplitter(state.filteredLayers, (perLayer) => { - if(perLayer.features.data.length === 0){ - return - } - // We don't bother to split them over tiles as it'll contain little features by default, so we simply add them like this perLayerHierarchy.get(perLayer.layer.layerDef.id).registerTile(perLayer) // AT last, we always apply the metatags whenever possible @@ -499,7 +499,9 @@ export default class FeaturePipeline { self.applyMetaTags(tile, this.state) }) }) - this.applyMetaTags(this.state.currentView, this.state) + if(this.state.currentView !== undefined){ + this.applyMetaTags(this.state.currentView, this.state) + } self.metataggingRecalculated.ping() } diff --git a/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts b/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts index 35fa4bacd..faae72088 100644 --- a/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts +++ b/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts @@ -63,7 +63,6 @@ export default class OsmFeatureSource { try { for (const neededTile of neededTiles) { - console.log("Tile download from OSM", Tiles.tile_from_index(neededTile).join("/"), "started") self.downloadedTiles.add(neededTile) self.LoadTile(...Tiles.tile_from_index(neededTile)).then(_ => { console.debug("Tile ", Tiles.tile_from_index(neededTile).join("/"), "loaded from OSM") @@ -72,7 +71,6 @@ export default class OsmFeatureSource { } catch (e) { console.error(e) } finally { - console.log("Done") self.isRunning.setData(false) } }) @@ -93,7 +91,6 @@ export default class OsmFeatureSource { const url = `${this._backend}/api/0.6/map?bbox=${bbox.minLon},${bbox.minLat},${bbox.maxLon},${bbox.maxLat}` try { - console.log("Attempting to get tile", z, x, y, "from the osm api") const osmJson = await Utils.downloadJson(url) try { console.debug("Got tile", z, x, y, "from the osm api") diff --git a/Logic/SimpleMetaTagger.ts b/Logic/SimpleMetaTagger.ts index ba52ea850..a99a70d4f 100644 --- a/Logic/SimpleMetaTagger.ts +++ b/Logic/SimpleMetaTagger.ts @@ -41,7 +41,7 @@ export class SimpleMetaTagger { } export class CountryTagger extends SimpleMetaTagger { - private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country", ScriptUtils.DownloadJSON); + private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country", Utils.downloadJson); public runningTasks: Set; constructor() { diff --git a/Models/Constants.ts b/Models/Constants.ts index d9c923e34..25ea8a2ce 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import {Utils} from "../Utils"; export default class Constants { - public static vNumber = "0.13.0-alpha-7"; + public static vNumber = "0.13.0-alpha-8"; public static ImgurApiKey = '7070e7167f0a25a' public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85" diff --git a/UI/Input/DropDown.ts b/UI/Input/DropDown.ts index 58b22e490..1930a2fe4 100644 --- a/UI/Input/DropDown.ts +++ b/UI/Input/DropDown.ts @@ -56,7 +56,6 @@ export class DropDown extends InputElement { for (let i = 0; i < values.length; i++) { const option = document.createElement("option") option.value = "" + i - console.log(values[i].shown) option.appendChild(Translations.W(values[i].shown).ConstructElement()) select.appendChild(option) } diff --git a/UI/i18n/Translation.ts b/UI/i18n/Translation.ts index 76d4cc9f2..c11bc4b0a 100644 --- a/UI/i18n/Translation.ts +++ b/UI/i18n/Translation.ts @@ -124,7 +124,7 @@ export class Translation extends BaseUIElement { continue; } let template: string = this.translations[lang]; - newTranslations[lang] = Utils.SubstituteKeys(template, text); + newTranslations[lang] = Utils.SubstituteKeys(template, text, lang); } return new Translation(newTranslations); diff --git a/Utils.ts b/Utils.ts index 29a0e048c..943addefc 100644 --- a/Utils.ts +++ b/Utils.ts @@ -238,7 +238,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be return [a.substr(0, index), a.substr(index + sep.length)]; } - public static SubstituteKeys(txt: string | undefined, tags: any): string | undefined { + public static SubstituteKeys(txt: string | undefined, tags: any, useLang?: string): string | undefined { if (txt === undefined) { return undefined } @@ -258,6 +258,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be v = date.toISOString() } + if(useLang !== undefined && v?.translations !== undefined){ + v = v.translations[useLang] ?? v.translations["*"] ?? (v.textFor !== undefined ? v.textFor(useLang) : v); + } + if(v.InnerConstructElement !== undefined){ console.warn("SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is", key,"\nThe value is", v) v = ( v.InnerConstructElement())?.innerText