Half complete i18n

This commit is contained in:
Pieter Fiers 2020-07-20 12:39:43 +02:00
parent 7c1c9bc80a
commit 232664ee14
10 changed files with 100 additions and 24 deletions

View file

@ -8,9 +8,9 @@ import {All} from "./Layouts/All";
import {Layout} from "./Layout";
export class AllKnownLayouts {
public static allSets: any = AllKnownLayouts.AllLayouts();
public static allSets = AllKnownLayouts.AllLayouts();
private static AllLayouts() : any{
private static AllLayouts(): Map<string, Layout> {
const all = new All();
const layouts : Layout[] = [
new Groen(),
@ -22,7 +22,7 @@ export class AllKnownLayouts {
new Statues(),
*/
];
const allSets = {};
const allSets: Map<string, Layout> = new Map();
for (const layout of layouts) {
allSets[layout.name] = layout;
all.layers = all.layers.concat(layout.layers);

View file

@ -1,13 +1,15 @@
import {LayerDefinition} from "./LayerDefinition";
import { UIElement } from "../UI/UIElement";
import { FixedUiElement } from "../UI/Base/FixedUiElement";
/**
* A layout is a collection of settings of the global view (thus: welcome text, title, selection of layers).
*/
export class Layout {
public name: string;
public title: string;
public title: UIElement;
public layers: LayerDefinition[];
public welcomeMessage: string;
public welcomeMessage: UIElement;
public gettingStartedPlzLogin: string;
public welcomeBackMessage: string;
@ -33,23 +35,23 @@ export class Layout {
*/
constructor(
name: string,
title: string,
title: UIElement | string,
layers: LayerDefinition[],
startzoom: number,
startLat: number,
startLon: number,
welcomeMessage: string,
welcomeMessage: UIElement | string,
gettingStartedPlzLogin: string = "Please login to get started",
welcomeBackMessage: string = "You are logged in. Welcome back!",
welcomeTail: string = ""
) {
this.title = title;
this.title = typeof(title) === 'string' ? new FixedUiElement(title) : title;
this.startLon = startLon;
this.startLat = startLat;
this.startzoom = startzoom;
this.name = name;
this.layers = layers;
this.welcomeMessage = welcomeMessage;
this.welcomeMessage = typeof(welcomeMessage) === 'string' ? new FixedUiElement(welcomeMessage) : welcomeMessage;
this.gettingStartedPlzLogin = gettingStartedPlzLogin;
this.welcomeBackMessage = welcomeBackMessage;
this.welcomeTail = welcomeTail;

View file

@ -2,27 +2,21 @@ import {Layout} from "../Layout";
import BikeParkings from "../Layers/BikeParkings";
import BikeServices from "../Layers/BikeStations";
import {GhostBike} from "../Layers/GhostBike";
import Translations from "../../UI/i18n/Translations";
export default class Cyclofix extends Layout {
constructor() {
super(
"pomp",
"Cyclofix bicycle infrastructure",
Translations.t.cylofix.title,
[new GhostBike(), new BikeServices(), new BikeParkings()],
16,
50.8465573,
4.3516970,
"<h3>Cyclofix bicycle infrastructure</h3>\n" +
"<h3>" + Translations.t.cylofix.title.Render() + "</h3>\n" +
"\n" +
"<p><b>EN&gt;</b> On this map we want to collect data about the whereabouts of bicycle pumps and public racks in Brussels." +
"As a result, cyclists will be able to quickly find the nearest infrastructure for their needs.</p>" +
"<p><b>NL&gt;</b> Op deze kaart willen we gegevens verzamelen over de locatie van fietspompen en openbare stelplaatsen in Brussel." +
"Hierdoor kunnen fietsers snel de dichtstbijzijnde infrastructuur vinden die voldoet aan hun behoeften.</p>" +
"<p><b>FR&gt;</b> Sur cette carte, nous voulons collecter des données sur la localisation des pompes à vélo et des supports publics à Bruxelles." +
"Les cyclistes pourront ainsi trouver rapidement l'infrastructure la plus proche de leurs besoins.</p>"
`<p>${Translations.t.cylofix.description.Render()}</p>`
,
"", "");
}

View file

@ -35,7 +35,7 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
* If 'question' is undefined, then the question is never asked at all
* If the question is "" (empty string) then the question is
*/
question?: string,
question?: UIElement | string,
/**
* What is the priority of the question.
@ -56,7 +56,7 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
*
*
*/
mappings?: { k: TagsFilter, txt: string, priority?: number, substitute?: boolean }[],
mappings?: { k: TagsFilter, txt: UIElement | string, priority?: number, substitute?: boolean }[],
/**