From 1447863fa712d0f19a4154ba253faca5e0e624a7 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 28 Oct 2020 11:19:47 +0100 Subject: [PATCH] Fix tests, refactoring kindof works now --- Customizations/JSON/FromJSON.ts | 2 +- Customizations/JSON/TagRenderingConfig.ts | 2 +- Logic/Tags.ts | 54 +++- UI/Popup/QuestionBox.ts | 1 - UI/Popup/TagRenderingAnswer.ts | 5 + UI/Popup/TagRenderingQuestion.ts | 14 +- UI/SpecialVisualizations.ts | 2 +- UI/i18n/Translation.ts | 101 ------- UI/i18n/Translations.ts | 322 ++++++++++++++-------- css/openinghourstable.css | 1 + test/Tag.spec.ts | 57 ++-- 11 files changed, 307 insertions(+), 254 deletions(-) diff --git a/Customizations/JSON/FromJSON.ts b/Customizations/JSON/FromJSON.ts index 1a95047..aea41ea 100644 --- a/Customizations/JSON/FromJSON.ts +++ b/Customizations/JSON/FromJSON.ts @@ -1,6 +1,6 @@ import {AndOrTagConfigJson} from "./TagConfigJson"; import {And, Or, RegexTag, Tag, TagsFilter} from "../../Logic/Tags"; -import Translation from "../../UI/i18n/Translation"; +import {Translation} from "../../UI/i18n/Translations"; import {Utils} from "../../Utils"; diff --git a/Customizations/JSON/TagRenderingConfig.ts b/Customizations/JSON/TagRenderingConfig.ts index 0cb8e95..4ed01c4 100644 --- a/Customizations/JSON/TagRenderingConfig.ts +++ b/Customizations/JSON/TagRenderingConfig.ts @@ -1,4 +1,4 @@ -import Translation from "../../UI/i18n/Translation"; +import {Translation} from "../../UI/i18n/Translations"; import {TagsFilter} from "../../Logic/Tags"; import {TagRenderingConfigJson} from "./TagRenderingConfigJson"; import Translations from "../../UI/i18n/Translations"; diff --git a/Logic/Tags.ts b/Logic/Tags.ts index 634770a..031b1e1 100644 --- a/Logic/Tags.ts +++ b/Logic/Tags.ts @@ -1,6 +1,4 @@ import {Utils} from "../Utils"; -import {Util} from "leaflet"; -import indexOf = Util.indexOf; export abstract class TagsFilter { abstract matches(tags: { k: string, v: string }[]): boolean @@ -298,21 +296,49 @@ export class And extends TagsFilter { } isEquivalent(other: TagsFilter): boolean { - if(other instanceof And){ + if (!(other instanceof And)) { + return false; + } - for (const selfTag of this.and) { - let matchFound = false; - for (let i = 0; i < other.and.length && !matchFound; i++){ - let otherTag = other.and[i]; - matchFound = selfTag.isEquivalent(otherTag); - } - if(!matchFound){ - return false; + for (const selfTag of this.and) { + let matchFound = false; + for (let i = 0; i < other.and.length && !matchFound; i++) { + let otherTag = other.and[i]; + matchFound = selfTag.isEquivalent(otherTag); + } + if (!matchFound) { + return false; + } + } + + for (const selfTag of this.and) { + let matchFound = false; + for (const otherTag of other.and) { + matchFound = selfTag.isEquivalent(otherTag); + if (matchFound) { + break; } } - return true; + if (!matchFound) { + return false; + } } - return false; + + for (const otherTag of other.and) { + let matchFound = false; + for (const selfTag of this.and) { + matchFound = selfTag.isEquivalent(otherTag); + if (matchFound) { + break; + } + } + if (!matchFound) { + return false; + } + } + + + return true; } } @@ -356,7 +382,7 @@ export class TagUtils { } const neededValues : string[] = neededTags[neededKey]; for (const neededValue of neededValues) { - if(indexOf(availableValues, neededValue) < 0){ + if (availableValues.indexOf(neededValue) < 0) { return false; } } diff --git a/UI/Popup/QuestionBox.ts b/UI/Popup/QuestionBox.ts index 1488e58..67d1775 100644 --- a/UI/Popup/QuestionBox.ts +++ b/UI/Popup/QuestionBox.ts @@ -27,7 +27,6 @@ export default class QuestionBox extends UIElement { .map((tagRendering, i) => new TagRenderingQuestion(this._tags, tagRendering, () => { // We save - self._skippedQuestions.data.push(i) self._skippedQuestions.ping(); }, Translations.t.general.skip.Clone() diff --git a/UI/Popup/TagRenderingAnswer.ts b/UI/Popup/TagRenderingAnswer.ts index 30cb789..9d0dfa5 100644 --- a/UI/Popup/TagRenderingAnswer.ts +++ b/UI/Popup/TagRenderingAnswer.ts @@ -18,6 +18,11 @@ export default class TagRenderingAnswer extends UIElement { } InnerRender(): string { + if(this._configuration.condition !== undefined){ + if(!this._configuration.condition.matchesProperties(this._tags.data)){ + return ""; + } + } const tr = this._configuration.GetRenderValue(this._tags.data); if(tr === undefined){ return ""; diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index 2c01b99..7ebdbd5 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -5,7 +5,7 @@ import TagRenderingConfig from "../../Customizations/JSON/TagRenderingConfig"; import {InputElement} from "../Input/InputElement"; import {And, Tag, TagsFilter, TagUtils} from "../../Logic/Tags"; import ValidatedTextField from "../Input/ValidatedTextField"; -import Translation from "../i18n/Translation"; +import {Translation} from "../i18n/Translations"; import {FixedInputElement} from "../Input/FixedInputElement"; import {SubstitutedTranslation} from "../SpecialVisualizations"; import {RadioButton} from "../Input/RadioButton"; @@ -18,8 +18,6 @@ import {Changes} from "../../Logic/Osm/Changes"; import {VariableUiElement} from "../Base/VariableUIElement"; import Translations from "../i18n/Translations"; import {FixedUiElement} from "../Base/FixedUiElement"; -import {Util} from "leaflet"; -import indexOf = Util.indexOf; /** * Shows the question element. @@ -114,16 +112,13 @@ export default class TagRenderingQuestion extends UIElement { } - private SplitMultiAnswer(tags: TagsFilter) { - - } - private GenerateMultiAnswer(elements: InputElement[], freeformField: InputElement): InputElement { const possibleTags = elements.map(el => el.GetValue().data); const checkBoxes = new CheckBoxes(elements); const inputEl = new InputElementMap( checkBoxes, (t0, t1) => { + console.log("IsEquiv?",t0, t1, t0?.isEquivalent(t1)) return t0?.isEquivalent(t1) ?? false }, (indices) => { @@ -131,7 +126,8 @@ export default class TagRenderingQuestion extends UIElement { return undefined; } const tags: TagsFilter[] = indices.map(i => elements[i].GetValue().data); - return TagUtils.FlattenMultiAnswer(tags); + const multi = TagUtils.FlattenMultiAnswer(tags); + return multi; }, (tags: TagsFilter) => { // {key --> values[]} @@ -171,7 +167,7 @@ export default class TagRenderingQuestion extends UIElement { if (freeformField) { if (freeformExtras.length > 0) { freeformField.GetValue().setData(new Tag(this._configuration.freeform.key, freeformExtras.join(";"))); - indices.push(indexOf(elements, freeformField)) + indices.push(elements.indexOf(freeformField)) } else { freeformField.GetValue().setData(undefined); } diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index c18445a..4ff6f43 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -4,7 +4,7 @@ import {UIEventSource} from "../Logic/UIEventSource"; import {VariableUiElement} from "./Base/VariableUIElement"; import LiveQueryHandler from "../Logic/Web/LiveQueryHandler"; import {ImageCarousel} from "./Image/ImageCarousel"; -import Translation from "./i18n/Translation"; +import {Translation} from "./i18n/Translations"; import Combine from "./Base/Combine"; import {FixedUiElement} from "./Base/FixedUiElement"; import Locale from "../UI/i18n/Locale"; diff --git a/UI/i18n/Translation.ts b/UI/i18n/Translation.ts index cc2af6c..49c171a 100644 --- a/UI/i18n/Translation.ts +++ b/UI/i18n/Translation.ts @@ -3,104 +3,3 @@ import Locale from "./Locale" import Combine from "../Base/Combine"; import {Utils} from "../../Utils"; - -export default class Translation extends UIElement { - - private static forcedLanguage = undefined; - - public Subs(text: any): Translation { - const newTranslations = {}; - for (const lang in this.translations) { - let template: string = this.translations[lang]; - for (const k in text) { - const combined = []; - const parts = template.split("{" + k + "}"); - const el: string | UIElement = text[k]; - if (el === undefined) { - continue; - } - let rtext: string = ""; - if (typeof (el) === "string") { - rtext = el; - } else { - Translation.forcedLanguage = lang; // This is a very dirty hack - it'll bite me one day - rtext = el.InnerRender(); - } - for (let i = 0; i < parts.length - 1; i++) { - combined.push(parts[i]); - combined.push(rtext) - } - combined.push(parts[parts.length - 1]); - template = new Combine(combined).InnerRender(); - } - newTranslations[lang] = template; - } - Translation.forcedLanguage = undefined; - return new Translation(newTranslations); - - } - - - - - get txt(): string { - if (this.translations["*"]) { - return this.translations["*"]; - } - const txt = this.translations[Translation.forcedLanguage ?? Locale.language.data]; - if (txt !== undefined) { - return txt; - } - const en = this.translations["en"]; - if (en !== undefined) { - return en; - } - for (const i in this.translations) { - return this.translations[i]; // Return a random language - } - console.error("Missing language ",Locale.language.data,"for",this.translations) - return undefined; - } - - - InnerRender(): string { - return this.txt - } - - public readonly translations: object - - constructor(translations: object) { - super(Locale.language) - let count = 0; - for (const translationsKey in translations) { - count++; - } - this.translations = translations - } - - public replace(a: string, b: string) { - if(a.startsWith("{") && a.endsWith("}")){ - a = a.substr(1, a.length - 2); - } - const result= this.Subs({[a]: b}); - return result; - } - - public Clone() { - return new Translation(this.translations) - } - - - FirstSentence() { - - const tr = {}; - for (const lng in this.translations) { - let txt = this.translations[lng]; - txt = txt.replace(/\..*/, ""); - txt = Utils.EllipsesAfter(txt, 255); - tr[lng] = txt; - } - - return new Translation(tr); - } -} diff --git a/UI/i18n/Translations.ts b/UI/i18n/Translations.ts index d52aed4..570aa83 100644 --- a/UI/i18n/Translations.ts +++ b/UI/i18n/Translations.ts @@ -1,9 +1,111 @@ -import Translation from "./Translation"; -import T from "./Translation"; import {UIElement} from "../UIElement"; import {FixedUiElement} from "../Base/FixedUiElement"; +import Combine from "../Base/Combine"; +import Locale from "./Locale"; +import {Utils} from "../../Utils"; +export class Translation extends UIElement { + + private static forcedLanguage = undefined; + + public Subs(text: any): Translation { + const newTranslations = {}; + for (const lang in this.translations) { + let template: string = this.translations[lang]; + for (const k in text) { + const combined = []; + const parts = template.split("{" + k + "}"); + const el: string | UIElement = text[k]; + if (el === undefined) { + continue; + } + let rtext: string = ""; + if (typeof (el) === "string") { + rtext = el; + } else { + Translation.forcedLanguage = lang; // This is a very dirty hack - it'll bite me one day + rtext = el.InnerRender(); + } + for (let i = 0; i < parts.length - 1; i++) { + combined.push(parts[i]); + combined.push(rtext) + } + combined.push(parts[parts.length - 1]); + template = new Combine(combined).InnerRender(); + } + newTranslations[lang] = template; + } + Translation.forcedLanguage = undefined; + return new Translation(newTranslations); + + } + + + + + get txt(): string { + if (this.translations["*"]) { + return this.translations["*"]; + } + const txt = this.translations[Translation.forcedLanguage ?? Locale.language.data]; + if (txt !== undefined) { + return txt; + } + const en = this.translations["en"]; + if (en !== undefined) { + return en; + } + for (const i in this.translations) { + return this.translations[i]; // Return a random language + } + console.error("Missing language ",Locale.language.data,"for",this.translations) + return undefined; + } + + + InnerRender(): string { + return this.txt + } + + public readonly translations: object + + constructor(translations: object) { + super(Locale.language) + let count = 0; + for (const translationsKey in translations) { + count++; + } + this.translations = translations + } + + public replace(a: string, b: string) { + if(a.startsWith("{") && a.endsWith("}")){ + a = a.substr(1, a.length - 2); + } + const result= this.Subs({[a]: b}); + return result; + } + + public Clone() { + return new Translation(this.translations) + } + + + FirstSentence() { + + const tr = {}; + for (const lng in this.translations) { + let txt = this.translations[lng]; + txt = txt.replace(/\..*/, ""); + txt = Utils.EllipsesAfter(txt, 255); + tr[lng] = txt; + } + + return new Translation(tr); + } +} + export default class Translations { constructor() { @@ -13,7 +115,7 @@ export default class Translations { static t = { image: { - addPicture: new T({ + addPicture: new Translation({ en: 'Add picture', es: 'Añadir foto', ca: 'Afegir foto', @@ -23,7 +125,7 @@ export default class Translations { de: "Bild hinzufügen" }), - uploadingPicture: new T({ + uploadingPicture: new Translation({ en: 'Uploading your picture...', nl: 'Bezig met een foto te uploaden...', es: 'Subiendo tu imagen ...', @@ -33,7 +135,7 @@ export default class Translations { de: 'Ihr Bild hochladen...' }), - uploadingMultiple: new T({ + uploadingMultiple: new Translation({ en: "Uploading {count} of your picture...", nl: "Bezig met {count} foto's te uploaden...", ca: "Pujant {count} de la teva imatge...", @@ -43,7 +145,7 @@ export default class Translations { de: "{count} Ihrer Bilder hochgeladen..." }), - pleaseLogin: new T({ + pleaseLogin: new Translation({ en: 'Please login to add a picure', nl: 'Gelieve je aan te melden om een foto toe te voegen', es: 'Entra para subir una foto', @@ -53,7 +155,7 @@ export default class Translations { de: 'Bitte einloggen, um ein Bild hinzuzufügen' }), - willBePublished: new T({ + willBePublished: new Translation({ en: 'Your picture will be published: ', es: 'Tu foto será publicada: ', ca: 'La teva foto serà publicada: ', @@ -63,7 +165,7 @@ export default class Translations { de: 'Ihr Bild wird veröffentlicht: ' }), - cco: new T({ + cco: new Translation({ en: 'in the public domain', ca: 'en domini públic', es: 'en dominio público', @@ -73,7 +175,7 @@ export default class Translations { de: 'in die Public Domain' }), - ccbs: new T({ + ccbs: new Translation({ en: 'under the CC-BY-SA-license', nl: 'onder de CC-BY-SA-licentie', ca: 'sota llicència CC-BY-SA', @@ -82,7 +184,7 @@ export default class Translations { gl: 'baixo a licenza CC-BY-SA', de: 'unter der CC-BY-SA-Lizenz' }), - ccb: new T({ + ccb: new Translation({ en: 'under the CC-BY-license', ca: 'sota la llicència CC-BY', es: 'bajo licencia CC-BY', @@ -92,7 +194,7 @@ export default class Translations { de: 'unter der CC-BY-Lizenz' }), - uploadFailed: new T({ + uploadFailed: new Translation({ en: "Could not upload your picture. Do you have internet and are third party API's allowed? Brave browser or UMatrix might block them.", nl: "Afbeelding uploaden mislukt. Heb je internet? Gebruik je Brave of UMatrix? Dan moet je derde partijen toelaten.", ca: "No s\'ha pogut carregar la imatge. Tens Internet i es permeten API de tercers? El navegador Brave o UMatrix podria bloquejar-les.", @@ -102,7 +204,7 @@ export default class Translations { de: "Wir konnten Ihr Bild nicht hochladen. Haben Sie Internet und sind API's von Dritten erlaubt? Brave Browser oder UMatrix blockieren evtl..", }), - respectPrivacy: new T({ + respectPrivacy: new Translation({ en: "Do not photograph people nor license plates. Do not upload Google Maps, Google Streetview or other copyrighted sources.", ca: "Respecta la privacitat. No fotografiïs gent o matrícules", es: "Respeta la privacidad. No fotografíes gente o matrículas", @@ -111,7 +213,7 @@ export default class Translations { gl: "Respecta a privacidade. Non fotografes xente ou matrículas", de: "Bitte respektieren Sie die Privatsphäre. Fotografieren Sie weder Personen noch Nummernschilder" }), - uploadDone: new T({ + uploadDone: new Translation({ en: "Your picture has been added. Thanks for helping out!", ca: "La teva imatge ha estat afegida. Gràcies per ajudar.", es: "Tu imagen ha sido añadida. Gracias por ayudar.", @@ -120,21 +222,21 @@ export default class Translations { gl: "A túa imaxe foi engadida. Grazas por axudar.", de: "Ihr Bild wurde hinzugefügt. Vielen Dank für Ihre Hilfe!", }), - dontDelete: new T({ + dontDelete: new Translation({ "nl":"Terug", "en":"Cancel", "ca":"Cancel·lar", "es":"Cancelar", "de": "Abbrechen" }), - doDelete: new T({ + doDelete: new Translation({ "nl":"Verwijder afbeelding", "en":"Remove image", "ca":"Esborrar imatge", "es":"Borrar imagen", "de": "Bild entfernen" }), - isDeleted: new T({ + isDeleted: new Translation({ "nl":"Verwijderd", "en":"Deleted", "ca":"Esborrada", @@ -143,7 +245,7 @@ export default class Translations { }) }, centerMessage: { - loadingData: new T({ + loadingData: new Translation({ en: 'Loading data...', ca: 'Carregant dades...', es: 'Cargando datos...', @@ -152,7 +254,7 @@ export default class Translations { gl: 'Cargando os datos...', de: 'Daten werden geladen...' }), - zoomIn: new T({ + zoomIn: new Translation({ en: 'Zoom in to view or edit the data', ca: 'Amplia per veure o editar les dades', es: 'Amplía para ver o editar los datos', @@ -161,7 +263,7 @@ export default class Translations { gl: 'Achégate para ollar ou editar os datos', de: 'Vergrößern, um die Daten anzuzeigen oder zu bearbeiten' }), - ready: new T({ + ready: new Translation({ en: "Done!", ca: "Fet.", es: "Hecho.", @@ -171,7 +273,7 @@ export default class Translations { de: "Erledigt!" }), - retrying: new T({ + retrying: new Translation({ en: "Loading data failed. Trying again... ({count})", ca: "La càrrega de dades ha fallat.Tornant-ho a intentar... ({count})", es: "La carga de datos ha fallado.Volviéndolo a probar... ({count})", @@ -181,7 +283,7 @@ export default class Translations { }, general: { - loginWithOpenStreetMap: new T({ + loginWithOpenStreetMap: new Translation({ en: "Login with OpenStreetMap", ca: "Entra a OpenStreetMap", es: "Entra en OpenStreetMap", @@ -191,7 +293,7 @@ export default class Translations { de: "Anmeldung mit OpenStreetMap" }), - welcomeBack: new T({ + welcomeBack: new Translation({ en: "You are logged in, welcome back!", ca: "Has entrat, benvingut.", es: "Has entrado, bienvenido.", @@ -200,7 +302,7 @@ export default class Translations { gl: "Iniciaches a sesión, benvido.", de: "Sie sind eingeloggt, willkommen zurück!" }), - loginToStart: new T({ + loginToStart: new Translation({ en: "Login to answer this question", ca: "Entra per contestar aquesta pregunta", es: "Entra para contestar esta pregunta", @@ -249,7 +351,7 @@ export default class Translations { }) }, - returnToTheMap: new T({ + returnToTheMap: new Translation({ en: "Return to the map", ca: "Tornar al mapa", es: "Volver al mapa", @@ -258,7 +360,7 @@ export default class Translations { gl: "Voltar ó mapa", de: "Zurück zur Karte" }), - save: new T({ + save: new Translation({ en: "Save", ca: "Desar", es: "Guardar", @@ -267,7 +369,7 @@ export default class Translations { gl: "Gardar", de: "Speichern" }), - cancel: new T({ + cancel: new Translation({ en: "Cancel", ca: "Cancel·lar", es: "Cancelar", @@ -276,7 +378,7 @@ export default class Translations { gl: "Desbotar", de: "Abbrechen" }), - skip: new T({ + skip: new Translation({ en: "Skip this question", ca: "Saltar aquesta pregunta", es: "Saltar esta pregunta", @@ -285,7 +387,7 @@ export default class Translations { gl: "Ignorar esta pregunta", de: "Diese Frage überspringen" }), - oneSkippedQuestion: new T({ + oneSkippedQuestion: new Translation({ en: "One question is skipped", ca: "Has ignorat una pregunta", es: "Has ignorado una pregunta", @@ -294,7 +396,7 @@ export default class Translations { gl: "Ignoraches unha pregunta", de: "Eine Frage wurde übersprungen" }), - skippedQuestions: new T({ + skippedQuestions: new Translation({ en: "Some questions are skipped", ca: "Has ignorat algunes preguntes", es: "Has ignorado algunas preguntas", @@ -303,7 +405,7 @@ export default class Translations { gl: "Ignoraches algunhas preguntas", de: "Einige Fragen wurden übersprungen" }), - number: new T({ + number: new Translation({ en: "number", ca: "nombre", es: "número", @@ -313,7 +415,7 @@ export default class Translations { de: "Zahl" }), - osmLinkTooltip: new T({ + osmLinkTooltip: new Translation({ en: "See this object on OpenStreetMap for history and more editing options", ca: "Mira aquest objecte a OpenStreetMap per veure historial i altres opcions d\'edició", es: "Mira este objeto en OpenStreetMap para ver historial y otras opciones de edición", @@ -323,7 +425,7 @@ export default class Translations { de: "Dieses Objekt auf OpenStreetMap anschauen für die Geschichte und weitere Bearbeitungsmöglichkeiten" }), add: { - addNew: new T({ + addNew: new Translation({ en: "Add a new {category} here", ca: "Afegir {category} aquí", es: "Añadir {category} aquí", @@ -332,7 +434,7 @@ export default class Translations { gl: "Engadir {category} aquí", de: "Hier eine neue {category} hinzufügen" }), - header: new T({ + header: new Translation({ en: "

Add a point?

You clicked somewhere where no data is known yet.
", ca: "

Vols afegir un punt?

Has marcat un lloc on no coneixem les dades.
", es: "

Quieres añadir un punto?

Has marcado un lugar del que no conocemos los datos.
", @@ -341,7 +443,7 @@ export default class Translations { gl: "

Queres engadir un punto?

Marcaches un lugar onde non coñecemos os datos.
", de: "

Punkt hinzufügen?

Sie haben irgendwo geklickt, wo noch keine Daten bekannt sind.
" }), - pleaseLogin: new T({ + pleaseLogin: new Translation({ en: "Please log in to add a new point", ca: "Entra per afegir un nou punt", es: "Entra para añadir un nuevo punto", @@ -350,7 +452,7 @@ export default class Translations { gl: "Inicia a sesión para engadir un novo punto", de: "Bitte loggen Sie sich ein, um einen neuen Punkt hinzuzufügen" }), - zoomInFurther: new T({ + zoomInFurther: new Translation({ en: "Zoom in further to add a point.", ca: "Apropa per afegir un punt.", es: "Acerca para añadir un punto.", @@ -359,7 +461,7 @@ export default class Translations { gl: "Achégate para engadir un punto.", de: "Weiter einzoomen, um einen Punkt hinzuzufügen." }), - stillLoading: new T({ + stillLoading: new Translation({ en: "The data is still loading. Please wait a bit before you add a new point.", ca: "Les dades es segueixen carregant. Espera una mica abans d\'afegir cap punt.", es: "Los datos se siguen cargando. Espera un poco antes de añadir ningún punto.", @@ -368,7 +470,7 @@ export default class Translations { gl: "Os datos seguen a cargarse. Agarda un intre antes de engadir ningún punto.", de: "Die Daten werden noch geladen. Bitte warten Sie etwas, bevor Sie einen neuen Punkt hinzufügen." }), - confirmIntro: new T({ + confirmIntro: new Translation({ en: "

Add a {title} here?

The point you create here will be visible for everyone. Please, only add things on to the map if they truly exist. A lot of applications use this data.", ca: "

Afegir {title} aquí?

El punt que estàs creant el veurà tothom. Només afegeix coses que realment existeixin. Moltes aplicacions fan servir aquestes dades.", es: "

Añadir {title} aquí?

El punto que estás creando lo verá todo el mundo. Sólo añade cosas que realmente existan. Muchas aplicaciones usan estos datos.", @@ -377,7 +479,7 @@ export default class Translations { gl: "

Engadir {title} aquí?

O punto que estás a crear será ollado por todo o mundo. Só engade cousas que realmente existan. Moitas aplicacións empregan estes datos.", de: "

Hier einen {title} hinzufügen?

Der Punkt, den Sie hier anlegen, wird für alle sichtbar sein. Bitte fügen Sie der Karte nur dann Dinge hinzu, wenn sie wirklich existieren. Viele Anwendungen verwenden diese Daten.", }), - confirmButton: new T({ + confirmButton: new Translation({ en: "Add a {category} here", ca: "Afegir {category} aquí", es: "Añadir {category} aquí", @@ -386,7 +488,7 @@ export default class Translations { gl: "Engadir {category} aquí", de: "Hier eine {category} hinzufügen" }), - openLayerControl: new T({ + openLayerControl: new Translation({ "en": "Open the layer control box", "ca": "Obrir el control de capes", "es": "Abrir el control de capas", @@ -394,7 +496,7 @@ export default class Translations { "de": "Das Ebenen-Kontrollkästchen öffnen" }) , - layerNotEnabled: new T({ + layerNotEnabled: new Translation({ "en": "The layer {layer} is not enabled. Enable this layer to add a point", "ca": "La capa {layer} no està habilitada. Fes-ho per poder afegir un punt a aquesta capa", "es": "La capa {layer} no está habilitada. Hazlo para poder añadir un punto en esta capa", @@ -402,7 +504,7 @@ export default class Translations { "de": "Die Ebene {layer} ist nicht aktiviert. Aktivieren Sie diese Ebene, um einen Punkt hinzuzufügen" }) }, - pickLanguage: new T({ + pickLanguage: new Translation({ en: "Choose a language", ca: "Tria idioma", es: "Escoge idioma", @@ -411,7 +513,7 @@ export default class Translations { gl: "Escoller lingua", de: "Wählen Sie eine Sprache" }), - about: new T({ + about: new Translation({ en: "Easily edit and add OpenStreetMap for a certain theme", ca: "Edita facilment i afegeix punts a OpenStreetMap d\'una temàtica determinada", es: "Edita facilmente y añade puntos en OpenStreetMap de un tema concreto", @@ -420,7 +522,7 @@ export default class Translations { gl: "Editar doadamente e engadir puntos no OpenStreetMap dun eido en concreto", de: "OpenStreetMap für ein bestimmtes Thema einfach bearbeiten und hinzufügen" }), - nameInlineQuestion: new T({ + nameInlineQuestion: new Translation({ en: "The name of this {category} is $$$", ca: "{category}: El seu nom és $$$", es: "{category}: Su nombre es $$$", @@ -429,7 +531,7 @@ export default class Translations { gl: "{category}: O teu nome é $$$", de: "Der Name dieser {category} ist $$$" }), - noNameCategory: new T({ + noNameCategory: new Translation({ en: "{category} without a name", ca: "{category} sense nom", es: "{category} sin nombre", @@ -439,7 +541,7 @@ export default class Translations { de: "{category} ohne Namen", }), questions: { - phoneNumberOf: new T({ + phoneNumberOf: new Translation({ en: "What is the phone number of {category}?", ca: "Quin és el telèfon de {category}?", es: "Qué teléfono tiene {category}?", @@ -448,7 +550,7 @@ export default class Translations { gl: "Cal é o número de teléfono de {category}?", de: "Wie lautet die Telefonnummer der {category}?" }), - phoneNumberIs: new T({ + phoneNumberIs: new Translation({ en: "The phone number of this {category} is {phone}", ca: "El número de telèfon de {category} és {phone}", es: "El número de teléfono de {category} es {phone}", @@ -457,7 +559,7 @@ export default class Translations { gl: "O número de teléfono de {category} é {phone}", de: "Die Telefonnummer der {category} lautet {phone}" }), - websiteOf: new T({ + websiteOf: new Translation({ en: "What is the website of {category}?", ca: "Quina és la pàgina web de {category}?", es: "Cual es la página web de {category}?", @@ -466,7 +568,7 @@ export default class Translations { gl: "Cal é a páxina web de {category}?", de: "Was ist die Website der {category}?" }), - websiteIs: new T({ + websiteIs: new Translation({ en: "Website: {website}", ca: "Pàgina web: {website}", es: "Página web: {website}", @@ -475,7 +577,7 @@ export default class Translations { gl: "Páxina web: {website}", de: "Webseite: {website}", }), - emailOf: new T({ + emailOf: new Translation({ en: "What is the email address of {category}?", ca: "Quina és l\'adreça de correu-e de {category}?", es: "¿Qué dirección de correu tiene {category}?", @@ -485,7 +587,7 @@ export default class Translations { de: "Wie lautet die E-Mail-Adresse der {category}?" } ), - emailIs: new T({ + emailIs: new Translation({ en: "The email address of this {category} is {email}", ca: "L\'adreça de correu de {category} és {email}", es: "La dirección de correo de {category} es {email}", @@ -496,7 +598,7 @@ export default class Translations { }), }, - openStreetMapIntro: new T({ + openStreetMapIntro: new Translation({ en: "

An Open Map

" + "

Wouldn't it be cool if there was a single map, which everyone could freely use and edit? " + "A single place to store all geo-information? Then, all those websites with different, small and incompatible maps (which are always outdated) wouldn't be needed anymore.

" + @@ -553,7 +655,7 @@ export default class Translations { }), sharescreen: { - intro: new T({ + intro: new Translation({ en: "

Share this map

Share this map by copying the link below and sending it to friends and family:", ca: "

Comparteix aquest mapa

Comparteix aquest mapa copiant l\'enllaç de sota i enviant-lo a amics i família:", es: "

Comparte este mapa

Comparte este mapa copiando el enlace de debajo y enviándolo a amigos y familia:", @@ -563,7 +665,7 @@ export default class Translations { de: "

Diese Karte teilen

Sie können diese Karte teilen, indem Sie den untenstehenden Link kopieren und an Freunde und Familie schicken:", }), - addToHomeScreen: new T({ + addToHomeScreen: new Translation({ en: "

Add to your home screen

You can easily add this website to your smartphone home screen for a native feel. Click the 'add to home screen button' in the URL bar to do this.", ca: "

Afegir-lo a la pantalla d\'inici

Pots afegir aquesta web a la pantalla d\'inici del teu smartphone per a que es vegi més nadiu. Apreta al botó 'afegir a l\'inici' a la barra d\'adreces URL per fer-ho.", es: "

Añadir a la pantalla de inicio

Puedes añadir esta web en la pantalla de inicio de tu smartphone para que se vea más nativo. Aprieta el botón 'añadir a inicio' en la barra de direcciones URL para hacerlo.", @@ -572,7 +674,7 @@ export default class Translations { nl: "

Voeg toe aan je thuis-scherm

Je kan deze website aan je thuisscherm van je smartphone toevoegen voor een native feel", de: "

Zum Startbildschirm hinzufügen

Sie können diese Website einfach zum Startbildschirm Ihres Smartphones hinzufügen, um ein natives Gefühl zu erhalten. Klicken Sie dazu in der URL-Leiste auf die Schaltfläche 'Zum Startbildschirm hinzufügen'.", }), - embedIntro: new T({ + embedIntro: new Translation({ en: "

Embed on your website

Please, embed this map into your website.
We encourage you to do it - you don't even have to ask permission.
It is free, and always will be. The more people using this, the more valuable it becomes.", ca: "

Inclou-ho a la teva pàgina web

Inclou aquest mapa dins de la teva pàgina web.
T\'animem a que ho facis, no cal que demanis permís.
És de franc, i sempre ho serà. A més gent que ho faci servir més valuós serà.", es: "

Inclúyelo en tu página web

Incluye este mapa en tu página web.
Te animamos a que lo hagas, no hace falta que pidas permiso.
Es gratis, y siempre lo será. A más gente que lo use más valioso será.", @@ -581,7 +683,7 @@ export default class Translations { nl: "

Plaats dit op je website

Voeg dit kaartje toe op je eigen website.
We moedigen dit zelfs aan - je hoeft geen toestemming te vragen.
Het is gratis en zal dat altijd blijven. Hoe meer het gebruikt wordt, hoe waardevoller", de: "

Auf Ihrer Website einbetten

Bitte, betten Sie diese Karte in Ihre Website ein.
Wir ermutigen Sie, es zu tun - Sie müssen nicht einmal um Erlaubnis fragen.
Es ist kostenlos und wird es immer sein. Je mehr Leute sie benutzen, desto wertvoller wird sie." }), - copiedToClipboard: new T({ + copiedToClipboard: new Translation({ en: "Link copied to clipboard", ca: "Enllaç copiat al portapapers", es: "Enlace copiado en el portapapeles", @@ -589,7 +691,7 @@ export default class Translations { nl: "Link gekopieerd naar klembord", de: "Link in die Zwischenablage kopiert" }), - thanksForSharing: new T({ + thanksForSharing: new Translation({ en: "Thanks for sharing!", ca: "Gràcies per compartir", es: "Gracias por compartir", @@ -597,7 +699,7 @@ export default class Translations { nl: "Bedankt om te delen!", de: "Danke für das Teilen!" }), - editThisTheme: new T({ + editThisTheme: new Translation({ en: "Edit this theme", ca: "Editar aquest repte", es: "Editar este reto", @@ -605,7 +707,7 @@ export default class Translations { nl: "Pas dit thema aan", de: "Dieses Thema bearbeiten" }), - editThemeDescription: new T({ + editThemeDescription: new Translation({ en: "Add or change questions to this map theme", ca: "Afegir o canviar preguntes d'aquest repte", es: "Añadir o cambiar preguntas de este reto", @@ -613,7 +715,7 @@ export default class Translations { nl: "Pas vragen aan of voeg vragen toe aan dit kaartthema", de: "Fragen zu diesem Kartenthema hinzufügen oder ändern" }), - fsUserbadge: new T({ + fsUserbadge: new Translation({ en: "Enable the login-button", ca: "Activar el botó d'entrada", es: "Activar el botón de entrada", @@ -621,7 +723,7 @@ export default class Translations { nl: "Activeer de login-knop", de:" Anmelde-Knopf aktivieren" }), - fsSearch: new T({ + fsSearch: new Translation({ en: "Enable the search bar", ca: "Activar la barra de cerca", es: "Activar la barra de búsqueda", @@ -629,7 +731,7 @@ export default class Translations { nl: "Activeer de zoekbalk", de: " Suchleiste aktivieren" }), - fsWelcomeMessage: new T({ + fsWelcomeMessage: new Translation({ en: "Show the welcome message popup and associated tabs", ca: "Mostra el missatge emergent de benvinguda i pestanyes associades", es: "Muestra el mensaje emergente de bienvenida y pestañas asociadas", @@ -637,7 +739,7 @@ export default class Translations { nl: "Toon het welkomstbericht en de bijhorende tabbladen", de: "Popup der Begrüßungsnachricht und zugehörige Registerkarten anzeigen" }), - fsLayers: new T({ + fsLayers: new Translation({ en: "Enable thelayer control", ca: "Activar el control de capes", es: "Activar el control de capas", @@ -646,7 +748,7 @@ export default class Translations { de: "Aktivieren der Layersteuerung" }), - fsLayerControlToggle: new T({ + fsLayerControlToggle: new Translation({ en: "Start with the layer control expanded", gl: "Comenza co control de capas expandido", ca: "Iniciar el control de capes avançat", @@ -654,7 +756,7 @@ export default class Translations { nl: "Toon de laagbediening meteen volledig", de: "Mit der erweiterten Ebenenkontrolle beginnen" }), - fsAddNew: new T({ + fsAddNew: new Translation({ en: "Enable the 'add new POI' button", ca: "Activar el botó d'afegir nou PDI'", es: "Activar el botón de añadir nuevo PDI'", @@ -662,7 +764,7 @@ export default class Translations { gl: "Activar o botón de 'engadir novo PDI'", de: "Schaltfläche 'neuen POI hinzufügen' aktivieren", }), - fsGeolocation: new T({ + fsGeolocation: new Translation({ en: "Enable the 'geolocate-me' button (mobile only)", ca: "Activar el botó de 'geolocalitza'm' (només mòbil)", es: "Activar el botón de 'geolocalízame' (només mòbil)", @@ -670,21 +772,21 @@ export default class Translations { nl: "Toon het knopje voor geolocalisatie (enkel op mobiel)", de: "Die Schaltfläche 'Mich geolokalisieren' aktivieren (nur für Mobil)", }), - fsIncludeCurrentBackgroundMap: new T({ + fsIncludeCurrentBackgroundMap: new Translation({ en: "Include the current background choice {name}", ca: "Incloure l'opció de fons actual {name}", es: "Incluir la opción de fondo actual {name}", nl: "Gebruik de huidige achtergrond {name}", de: "Die aktuelle Hintergrundwahl einschließen {name}", }), - fsIncludeCurrentLayers: new T({ + fsIncludeCurrentLayers: new Translation({ en: "Include the current layer choices", ca: "Incloure les opcions de capa actual", es: "Incluir las opciones de capa actual", nl: "Toon enkel de huidig getoonde lagen", de: "Die aktuelle Ebenenauswahl einbeziehen" }), - fsIncludeCurrentLocation: new T({ + fsIncludeCurrentLocation: new Translation({ en: "Include current location", es: "Incluir localización actual", ca: "Incloure localització actual", @@ -693,7 +795,7 @@ export default class Translations { }) }, morescreen: { - intro: new T({ + intro: new Translation({ en: "

More thematic maps?

Do you enjoy collecting geodata?
There are more themes available.", ca: "

Més peticions

T\'agrada captar dades?
Hi ha més capes disponibles.", es: "

Más peticiones

Te gusta captar datos?
Hay más capas disponibles.", @@ -703,7 +805,7 @@ export default class Translations { de: "

Weitere Quests

Sammeln Sie gerne Geodaten?
Es sind weitere Themen verfügbar." }), - requestATheme: new T({ + requestATheme: new Translation({ en: "If you want a custom-built quest, request it here", ca: "Si vols que et fem una petició pròpia , demana-la aquí", es: "Si quieres que te hagamos una petición propia , pídela aquí", @@ -713,7 +815,7 @@ export default class Translations { de: "Wenn Sie einen speziell angefertigte Quest wünschen, können Sie diesen hier anfragen", }), - streetcomplete: new T({ + streetcomplete: new Translation({ en: "Another, similar application is StreetComplete", ca: "Una altra aplicació similar és StreetComplete", es: "Otra aplicación similar es StreetComplete", @@ -722,7 +824,7 @@ export default class Translations { gl: "Outra aplicación semellante é StreetComplete", de: "Eine andere, ähnliche Anwendung ist StreetComplete", }), - createYourOwnTheme: new T({ + createYourOwnTheme: new Translation({ en: "Create your own MapComplete theme from scratch", ca: "Crea la teva pròpia petició completa de MapComplete des de zero.", es: "Crea tu propia petición completa de MapComplete desde cero.", @@ -732,7 +834,7 @@ export default class Translations { de: "Erstellen Sie Ihr eigenes MapComplete-Thema von Grund auf neu", }) }, - readYourMessages: new T({ + readYourMessages: new Translation({ en: "Please, read all your OpenStreetMap-messages before adding a new point.", ca: "Llegeix tots els teus missatges d\'OpenStreetMap abans d\'afegir nous punts.", es: "Lee todos tus mensajes de OpenStreetMap antes de añadir nuevos puntos.", @@ -741,7 +843,7 @@ export default class Translations { gl: "Le todos a túas mensaxes do OpenStreetMap antes de engadir novos puntos.", de: "Bitte lesen Sie alle Ihre OpenStreetMap-Nachrichten, bevor Sie einen neuen Punkt hinzufügen" }), - fewChangesBefore: new T({ + fewChangesBefore: new Translation({ en: "Please, answer a few questions of existing points before adding a new point.", ca: "Contesta unes quantes preguntes sobre punts existents abans d\'afegir-ne un de nou.", es: "Contesta unas cuantas preguntas sobre puntos existentes antes de añadir nuevos.", @@ -750,7 +852,7 @@ export default class Translations { gl: "Responde unhas cantas preguntas sobre puntos existentes antes de engadir novos.", de: "Bitte beantworten Sie ein paar Fragen zu bestehenden Punkten, bevor Sie einen neuen Punkt hinzufügen." }), - goToInbox: new T({ + goToInbox: new Translation({ en: "Open inbox", es: "Abrir mensajes", ca: "Obrir missatges", @@ -759,7 +861,7 @@ export default class Translations { gl: "Abrir mensaxes", de: "Posteingang öffnen" }), - getStartedLogin: new T({ + getStartedLogin: new Translation({ en: "Login with OpenStreetMap to get started", es: "Entra en OpenStreetMap para empezar", ca: "Entra a OpenStreetMap per començar", @@ -767,7 +869,7 @@ export default class Translations { fr: "Connectez vous avec OpenStreetMap pour commencer", de: "Mit OpenStreetMap einloggen und loslegen" }), - getStartedNewAccount: new T({ + getStartedNewAccount: new Translation({ en: " or create a new account", nl: " of maak een nieuwe account aan ", fr: " ou registrez vous", @@ -776,20 +878,20 @@ export default class Translations { gl: " ou crea unha nova conta", de: " oder ein neues Konto anlegen", }), - noTagsSelected: new T({ + noTagsSelected: new Translation({ en: "No tags selected", es: "No se han seleccionado etiquetas", ca: "No s\'han seleccionat etiquetes", gl: "Non se seleccionaron etiquetas", de: "Keine Tags ausgewählt" }), - customThemeIntro: new T({ + customThemeIntro: new Translation({ en: "

Custom themes

These are previously visited user-generated themes.", nl: "

Onofficiële themea's

Je bezocht deze thema's gemaakt door andere OpenStreetMappers eerder", gl: "

Temas personalizados

Estes son temas xerados por usuarios previamente visitados.", de: "

Kundenspezifische Themen

Dies sind zuvor besuchte benutzergenerierte Themen" }), - aboutMapcomplete: new T({ + aboutMapcomplete: new Translation({ en: "

About MapComplete

" + "

MapComplete is an OpenStreetMap editor that is meant to help everyone to easily add information on a single theme.

" + "

Only features relevant to a single theme are shown with a few predefined questions, in order to keep things simple and extremly user-friendly." + @@ -836,14 +938,14 @@ export default class Translations { "

Fällt Ihnen ein Problem mit MapComplete auf? Haben Sie einen Feature-Wunsch? Wollen Sie beim Übersetzen helfen? " + "Gehen Sie zum Quellcode oder zur Problemverfolgung.

", }), - backgroundMap: new T({ + backgroundMap: new Translation({ "en": "Background map", "ca": "Mapa de fons", "es": "Mapa de fondo", "nl": "Achtergrondkaart", "de": "Hintergrundkarte" }), - zoomInToSeeThisLayer: new T({ + zoomInToSeeThisLayer: new Translation({ "en": "Zoom in to see this layer", "ca": "Amplia per veure aquesta capa", "es": "Amplía para ver esta capa", @@ -852,49 +954,49 @@ export default class Translations { }), weekdays: { abbreviations:{ - monday: new T({ + monday: new Translation({ "en": "Mon", "ca": "Dil", "es": "Lun", "nl": "Maan", "fr": "Lun", }), - tuesday: new T({ + tuesday: new Translation({ "en": "Tue", "ca": "Dim", "es": "Mar", "nl": "Din", "fr": "Mar", }), - wednesday: new T({ + wednesday: new Translation({ "en": "Wed", "ca": "Dic", "es": "Mie", "nl": "Woe", "fr": "Mercr", }), - thursday: new T({ + thursday: new Translation({ "en": "Thu", "ca": "Dij", "es": "Jue", "nl": "Don", "fr": "Jeudi", }), - friday: new T({ + friday: new Translation({ "en": "Fri", "ca": "Div", "es": "Vie", "nl": "Vrij", "fr": "Vendr", }), - saturday: new T({ + saturday: new Translation({ "en": "Sat", "ca": "Dis", "es": "Sab", "nl": "Zat", "fr": "Sam", }), - sunday: new T({ + sunday: new Translation({ "en": "Sun", "ca": "Diu", "es": "Dom", @@ -902,49 +1004,49 @@ export default class Translations { "fr": "Dim", }) }, - monday: new T({ + monday: new Translation({ "en": "Monday", "ca": "Dilluns", "es": "Lunes", "nl": "Maandag", "fr": "Lundi", }), - tuesday: new T({ + tuesday: new Translation({ "en": "Tuesday", "ca": "Dimarts", "es": "Martes", "nl": "Dinsdag", "fr": "Mardi", }), - wednesday: new T({ + wednesday: new Translation({ "en": "Wednesday", "ca": "Dimecres", "es": "Miércoles", "nl": "Woensdag", "fr": "Mercredi", }), - thursday: new T({ + thursday: new Translation({ "en": "Thursday", "ca": "Dijous", "es": "Jueves", "nl": "Donderdag", "fr": "Jeudi", }), - friday: new T({ + friday: new Translation({ "en": "Friday", "ca": "Divendres", "es": "Viernes", "nl": "Vrijdag", "fr": "Vendredi", }), - saturday: new T({ + saturday: new Translation({ "en": "Saturday", "ca": "Dissabte", "es": "Sábado", "nl": "Zaterdag", "fr": "Samedi", }), - sunday: new T({ + sunday: new Translation({ "en": "Sunday", "ca": "Diumenge", "es": "Domingo", @@ -953,53 +1055,53 @@ export default class Translations { }) }, opening_hours: { - open_during_ph: new T({ + open_during_ph: new Translation({ "nl": "Op een feestdag is deze zaak", "ca": "Durant festes aquest servei és", "es": "Durante fiestas este servicio está", "en":"During a public holiday, this amenity is" }), - opensAt: new T({ + opensAt: new Translation({ "en": "from", "ca": "des de", "es": "desde", "nl": "vanaf" - }), openTill: new T({ + }), openTill: new Translation({ "en": "till", "ca": "fins", "es": " hasta", "nl": "tot" }), - not_all_rules_parsed: new T({ + not_all_rules_parsed: new Translation({ "en": "The opening hours of this shop are complicated. The following rules are ignored in the input element:", "ca": "L'horari d'aquesta botiga és complicat. Les normes següents seran ignorades en l'entrada:", "es": "El horario de esta tienda es complejo. Las normas siguientes serán ignoradas en la entrada:" }), - closed_until: new T({ + closed_until: new Translation({ "en": "Closed until {date}", "ca": "Tancat fins {date}", "es": "Cerrado hasta {date}", "nl": "Gesloten - open op {date}" }), - closed_permanently: new T({ + closed_permanently: new Translation({ "en": "Closed - no opening day known", "ca": "Tancat - sense dia d'obertura conegut", "es": "Cerrado - sin día de apertura conocido", "nl": "Gesloten" }), - ph_not_known: new T({ + ph_not_known: new Translation({ "en": " ", "ca": " ", "es": " ", "nl": " " }), - ph_closed: new T({ + ph_closed: new Translation({ "en": "closed", "ca": "tancat", "es": "cerrado", "nl": "gesloten" - }), ph_open: new T({ + }), ph_open: new Translation({ "en": "opened", "ca": "tancat", "es": "abierto", @@ -1010,7 +1112,7 @@ export default class Translations { } }, favourite: { - title: new T({ + title: new Translation({ en: "Personal theme", nl: "Persoonlijk thema", es: "Interficie personal", @@ -1018,28 +1120,28 @@ export default class Translations { gl: "Tema personalizado", de: "Persönliches Thema" }), - description: new T({ + description: new Translation({ en: "Create a personal theme based on all the available layers of all themes", es: "Crea una interficie basada en todas las capas disponibles de todas las interficies", ca: "Crea una interfície basada en totes les capes disponibles de totes les interfícies", gl: "Crea un tema baseado en todas as capas dispoñíbeis de todos os temas", de: "Erstellen Sie ein persönliches Thema auf der Grundlage aller verfügbaren Ebenen aller Themen" }), - panelIntro: new T({ + panelIntro: new Translation({ en: "

Your personal theme

Activate your favourite layers from all the official themes", ca: "

La teva interfície personal

Activa les teves capes favorites de totes les interfícies oficials", es: "

Tu interficie personal

Activa tus capas favoritas de todas las interficies oficiales", gl: "

O teu tema personalizado

Activa as túas capas favoritas de todos os temas oficiais", de: "

Ihr persönliches Thema

Aktivieren Sie Ihre Lieblingsebenen aus allen offiziellen Themen" }), - loginNeeded: new T({ + loginNeeded: new Translation({ en: "

Log in

A personal layout is only available for OpenStreetMap users", es: "

Entrar

El diseño personalizado sólo está disponible para los usuarios de OpenstreetMap", ca: "

Entrar

El disseny personalizat només està disponible pels usuaris d\' OpenstreetMap", gl: "

Iniciar a sesión

O deseño personalizado só está dispoñíbel para os usuarios do OpenstreetMap", de: "

Anmelden

Ein persönliches Layout ist nur für OpenStreetMap-Benutzer verfügbar", }), - reload: new T({ + reload: new Translation({ en: "Reload the data", es: "Recargar datos", ca: "Recarregar dades", diff --git a/css/openinghourstable.css b/css/openinghourstable.css index b5cde5e..5034cff 100644 --- a/css/openinghourstable.css +++ b/css/openinghourstable.css @@ -262,6 +262,7 @@ font-size: smaller; border-radius: 0.3em; border: 1px solid #ccc; + word-break: initial; } diff --git a/test/Tag.spec.ts b/test/Tag.spec.ts index 98f82cf..39f12f0 100644 --- a/test/Tag.spec.ts +++ b/test/Tag.spec.ts @@ -1,17 +1,19 @@ import {UIElement} from "../UI/UIElement"; +UIElement.runningFromConsole = true; + import {equal} from "assert"; -import Translation from "../UI/i18n/Translation"; import T from "./TestHelper"; import {FromJSON} from "../Customizations/JSON/FromJSON"; import {And, Tag} from "../Logic/Tags"; import Locale from "../UI/i18n/Locale"; -import Translations from "../UI/i18n/Translations"; +import Translations, {Translation} from "../UI/i18n/Translations"; import {UIEventSource} from "../Logic/UIEventSource"; import {OH, OpeningHour} from "../Logic/OpeningHours"; import PublicHolidayInput from "../UI/Input/OpeningHours/PublicHolidayInput"; -import {TagRendering} from "../UI/Popup/TagRendering"; +import TagRenderingConfig from "../Customizations/JSON/TagRenderingConfig"; +import EditableTagRendering from "../UI/Popup/EditableTagRendering"; +import {SubstitutedTranslation} from "../UI/SpecialVisualizations"; -UIElement.runningFromConsole = true; new T([ @@ -32,10 +34,34 @@ new T([ equal((and.and[1] as Tag).value, "y"); })], + ["Is equivalent test", (() => { + + const t0 = new And([ + new Tag("valves:special","A"), + new Tag("valves","A") + ]) + const t1 = new And([ + new Tag("valves","A") + ]) + const t2 = new And([ + new Tag("valves","B") + ]) + equal(true, t0.isEquivalent(t0)) + equal(true, t1.isEquivalent(t1)) + equal(true, t2.isEquivalent(t2)) + + equal(false, t0.isEquivalent(t1)) + equal(false, t0.isEquivalent(t2)) + equal(false, t1.isEquivalent(t0)) + + equal(false, t1.isEquivalent(t2)) + equal(false, t2.isEquivalent(t0)) + equal(false, t2.isEquivalent(t1)) + })], ["Parse translation map", (() => { const json: any = {"en": "English", "nl": "Nederlands"}; - const translation = Translations.WT(FromJSON.Translation(json)); + const translation = Translations.WT(new Translation(json)); Locale.language.setData("en"); equal(translation.txt, "English"); Locale.language.setData("nl"); @@ -43,7 +69,7 @@ new T([ })], ["Parse tag rendering", (() => { Locale.language.setData("nl"); - const tr = FromJSON.TagRendering({ + const tr = new TagRenderingConfig({ render: ({"en":"Name is {name}", "nl":"Ook een {name}"} as any), question: "Wat is de naam van dit object?", freeform: { @@ -59,12 +85,12 @@ new T([ condition: "x=" }, ""); - equal(true, tr.IsKnown({"noname": "yes"})); - equal(true, tr.IsKnown({"name": "ABC"})); - equal(false, tr.IsKnown({"foo": "bar"})); - equal("Has no name", tr.GetContent({"noname": "yes"})?.txt); - equal("Ook een xyz", tr.GetContent({"name": "xyz"})?.txt); - equal(undefined, tr.GetContent({"foo": "bar"})); + equal(undefined, tr.GetRenderValue({"foo": "bar"})); + equal("Has no name", tr.GetRenderValue({"noname": "yes"})?.txt); + equal("Ook een {name}", tr.GetRenderValue({"name": "xyz"})?.txt); + equal("Ook een xyz", new SubstitutedTranslation( tr.GetRenderValue({"name": "xyz"}), + new UIEventSource({"name":"xyz"})).InnerRender()); + equal(undefined, tr.GetRenderValue({"foo": "bar"})); })], @@ -110,10 +136,9 @@ new T([ ] }; - const constr = FromJSON.TagRendering(def, "test"); - TagRendering.injectFunction(); - const uiEl = constr.construct(new UIEventSource( - {leisure: "park", "access": "no"}) + const constr = new TagRenderingConfig(def, "test"); + const uiEl = new EditableTagRendering(new UIEventSource( + {leisure: "park", "access": "no"}), constr ); const rendered = uiEl.InnerRender(); equal(true, rendered.indexOf("Niet toegankelijk") > 0)