Add matrix-bot translations
This commit is contained in:
parent
af4ed4af80
commit
59ec7221a7
9 changed files with 110 additions and 18 deletions
|
@ -38,7 +38,7 @@ export default class LinkToWeblate extends VariableUiElement {
|
|||
return baseUrl + category + "/" + language + "/?offset=1&q=context%3A%3D%22" + key + "%22"
|
||||
}
|
||||
|
||||
public static hrefToWeblateZen(language: string, category: string, searchKey: string): string{
|
||||
public static hrefToWeblateZen(language: string, category: "core" | "themes" | "layers" | "shared-questions" | "glossary" | string, searchKey: string): string{
|
||||
const baseUrl = "https://hosted.weblate.org/zen/mapcomplete/"
|
||||
// ?offset=1&q=+state%3A%3Ctranslated+context%3Acampersite&sort_by=-priority%2Cposition&checksum=
|
||||
return baseUrl + category + "/" + language + "?offset=1&q=+state%3A%3Ctranslated+context%3A"+encodeURIComponent(searchKey)+"&sort_by=-priority%2Cposition&checksum="
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {InputElement} from "./InputElement";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import doc = Mocha.reporters.doc;
|
||||
|
||||
export default class Slider extends InputElement<number> {
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ import {SubtleButton} from "../Base/SubtleButton";
|
|||
import {GeoOperations} from "../../Logic/GeoOperations";
|
||||
import {ElementStorage} from "../../Logic/ElementStorage";
|
||||
import Lazy from "../Base/Lazy";
|
||||
import {Utils} from "../../Utils";
|
||||
import beginningOfLine = Mocha.reporters.Base.cursor.beginningOfLine;
|
||||
|
||||
export interface P4CPicture {
|
||||
pictureUrl: string,
|
||||
|
|
|
@ -49,6 +49,10 @@ export class Translation extends BaseUIElement {
|
|||
return this.textFor(Translation.forcedLanguage ?? Locale.language.data)
|
||||
}
|
||||
|
||||
public toString(){
|
||||
return this.txt;
|
||||
}
|
||||
|
||||
static ExtractAllTranslationsFrom(object: any, context = ""): { context: string, tr: Translation }[] {
|
||||
const allTranslations: { context: string, tr: Translation }[] = []
|
||||
for (const key in object) {
|
||||
|
@ -286,4 +290,6 @@ export class TypedTranslation<T> extends Translation {
|
|||
return Utils.SubstituteKeys(template, text, lang);
|
||||
}, context)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,13 +1,21 @@
|
|||
{
|
||||
"id": "mapcomplete-changes",
|
||||
"title": {
|
||||
"en": "Changes made with MapComplete"
|
||||
"en": "Changes made with MapComplete",
|
||||
"de": "Änderungen mit MapComplete",
|
||||
"es": "Cambios hechos con MapComplete",
|
||||
"nb_NO": "Endringer utført med MapComplete"
|
||||
},
|
||||
"shortDescription": {
|
||||
"en": "Shows changes made by MapComplete"
|
||||
"en": "Shows changes made by MapComplete",
|
||||
"de": "Zeigt Änderungen von MapComplete",
|
||||
"es": "Muestra los cambios hechos por MapComplete",
|
||||
"nb_NO": "Vis endringer utført med MapComplete"
|
||||
},
|
||||
"description": {
|
||||
"en": "This maps shows all the changes made with MapComplete"
|
||||
"en": "This maps shows all the changes made with MapComplete",
|
||||
"de": "Diese Karte zeigt alle Änderungen die mit MapComplete gemacht wurden",
|
||||
"es": "Este mapa muestra todos los cambios hechos con MapComplete"
|
||||
},
|
||||
"maintainer": "",
|
||||
"icon": "./assets/svg/logo.svg",
|
||||
|
@ -22,7 +30,10 @@
|
|||
{
|
||||
"id": "mapcomplete-changes",
|
||||
"name": {
|
||||
"en": "Changeset centers"
|
||||
"en": "Changeset centers",
|
||||
"de": "Schwerpunkte von Änderungssätzen",
|
||||
"es": "Centros de conjuntos de cambios",
|
||||
"nb_NO": "Endringssettsenter"
|
||||
},
|
||||
"minzoom": 0,
|
||||
"source": {
|
||||
|
@ -36,35 +47,47 @@
|
|||
],
|
||||
"title": {
|
||||
"render": {
|
||||
"en": "Changeset for {theme}"
|
||||
"en": "Changeset for {theme}",
|
||||
"de": "Änderungen für {theme}",
|
||||
"es": "Conjunto de cambios para {theme}",
|
||||
"nb_NO": "Endringssett for {theme}"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"en": "Shows all MapComplete changes"
|
||||
"en": "Shows all MapComplete changes",
|
||||
"de": "Zeigt alle MapComplete Änderungen",
|
||||
"es": "Muestra todos los cambios de MapComplete"
|
||||
},
|
||||
"tagRenderings": [
|
||||
{
|
||||
"id": "render_id",
|
||||
"render": {
|
||||
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
|
||||
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
|
||||
"de": "Änderung <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
|
||||
"es": "Conjunto de cambios <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
|
||||
"nb_NO": "Endringssett <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "contributor",
|
||||
"render": {
|
||||
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
|
||||
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>",
|
||||
"de": "Änderung wurde von <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a> gemacht",
|
||||
"es": "Cambio hecho por <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "theme",
|
||||
"render": {
|
||||
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
|
||||
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
|
||||
"de": "Änderung mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"if": "theme~http.*",
|
||||
"then": {
|
||||
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
|
||||
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>",
|
||||
"de": "Änderung mit <b>inoffiziellem</b> Thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -332,7 +355,9 @@
|
|||
}
|
||||
],
|
||||
"question": {
|
||||
"en": "Themename contains {search}"
|
||||
"en": "Themename contains {search}",
|
||||
"de": "Themenname enthält {search}",
|
||||
"nb_NO": "Temanavn inneholder {search}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -348,7 +373,9 @@
|
|||
}
|
||||
],
|
||||
"question": {
|
||||
"en": "Made by contributor {search}"
|
||||
"en": "Made by contributor {search}",
|
||||
"de": "Erstellt von {search}",
|
||||
"es": "Hecho por contributor/a {search}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -364,7 +391,9 @@
|
|||
}
|
||||
],
|
||||
"question": {
|
||||
"en": "<b>Not</b> made by contributor {search}"
|
||||
"en": "<b>Not</b> made by contributor {search}",
|
||||
"de": "<b>Nicht</b> erstellt von {search}",
|
||||
"es": "<b>No</b> hecho por contributor/a {search}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -379,7 +408,9 @@
|
|||
{
|
||||
"id": "link_to_more",
|
||||
"render": {
|
||||
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
|
||||
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>",
|
||||
"de": "Weitere Statistiken finden Sie <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>",
|
||||
"es": "Se pueden encontrar más estadísticas <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>aquí</a>"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -447,6 +447,38 @@
|
|||
"pickTheme": "Pick a theme below to get started.",
|
||||
"title": "Welcome to MapComplete"
|
||||
},
|
||||
"matrixbot": {
|
||||
"commandFailed": "Sorry, something went wrong while running <code>{cmd}</code>",
|
||||
"commandNotFound": "I didn't understand your request. Did you perhaps mean to type {0}, {1}, {2} or ${2}? <p>Type <code>help</code> to see an overview of all commands</p>",
|
||||
"commands": {
|
||||
"help": {
|
||||
"argcmd": "The command you want more information about",
|
||||
"askRights": "Ask {admins} to give you sufficient permissions",
|
||||
"docs": "Prints info about supported commands",
|
||||
"insufficientRights": "You currently don't have sufficient permissions to run this command.",
|
||||
"p0": "Hi! I'm MapComplete-bot {bot_version} (built upon MapComplete {mc_version}).",
|
||||
"p1": "Send a command to me and I'll answer with something useful: give me a command via a private message or put <code>!</code> before the command in a public room.",
|
||||
"priviligedComand": "Priviliged command",
|
||||
"supported": "My supported commands are:"
|
||||
},
|
||||
"language": {
|
||||
"hasBeenSet": "Language has been set to {language}.",
|
||||
"helpTranslating": "Help to translate my responses on Weblate."
|
||||
},
|
||||
"welcome": {
|
||||
"p0": "Hi! I'm MapComplete-bot. I'm a computer program which searches OpenStreetMap and which can give some information about <a href='https://mapcomplete.osm.be'>MapComplete</a>, which is a website and app that shows thematic maps. If information is missing, you can add it easily over there.",
|
||||
"p1": "Send me <code>info [searchterm]</code> and I'll search OpenStreetMap for you. I'll show you the information on what I found.",
|
||||
"p2": "Alternatively, use <code>search [ojecttype] near [placename]</code> or <code>search [objecttype] in [placename]</code> to search for more places. Supported object types are those that can be found in MapComplete. More categories will be added in the future - and if you are up to the challenge, <a href='https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Making_Your_Own_Theme.md'>you can create your thematic map and thus category too</a>",
|
||||
"p3": "There are a few more commands, send <code>help</code> to see all of them."
|
||||
},
|
||||
"wiki": {
|
||||
"docs": "Prints (a part of) the specified page from wiki.osm.org. In public rooms, it'll print the first paragraph; in a DM the entire page will be sent."
|
||||
}
|
||||
},
|
||||
"decryptionFailed": "Sorry, I couldn't decrypt your message. You can try to leave this channel and to connect again",
|
||||
"noSufficientRights": "This command is only available to administrators or users who have this role",
|
||||
"tooLongForPublic": "Sorry, this message is too long for a public room - send me a direct message instead"
|
||||
},
|
||||
"move": {
|
||||
"cancel": "Cancel move",
|
||||
"cannotBeMoved": "This feature cannot be moved.",
|
||||
|
|
|
@ -1095,6 +1095,9 @@
|
|||
"0": {
|
||||
"then": "Sport gear shop <i>{name}</i>"
|
||||
},
|
||||
"1": {
|
||||
"then": "Winkel"
|
||||
},
|
||||
"2": {
|
||||
"then": "Bicycle rental <i>{name}</i>"
|
||||
},
|
||||
|
|
|
@ -444,6 +444,25 @@
|
|||
"pickTheme": "Kies hieronder een thema om te beginnen.",
|
||||
"title": "Welkom bij MapComplete"
|
||||
},
|
||||
"matrixbot": {
|
||||
"commandNotFound": "Sorry, ik heb je commando niet verstaan. Zou het kunnen dat je {0}, {1}, {2} of ${2} bedoelt? <p>Je kan ook <code>help</code> sturen om een overzicht van alle commando's te zien</p>",
|
||||
"commands": {
|
||||
"help": {
|
||||
"argcmd": "The command you want more information about",
|
||||
"docs": "Prints info about supported commands",
|
||||
"p0": "Hallo! Ik ben MapComplete-bot {bot_version} (gebouwd met MapComplete {mc_version}).",
|
||||
"p1": "Je kan me een commando sturen en dan zal ik dat commando opvolgen. Dit kan door me een privé-bericht te sturen. In een publieke ruimte zal ik antwoorden als een bericht begint met <code>!</code> of een mention.",
|
||||
"priviligedComand": "Commando waar je rechten voor nodig hebt",
|
||||
"supported": "De commando's die ik ken zijn:"
|
||||
},
|
||||
"language": {
|
||||
"hasBeenSet": "De taal is ingesteld op <b>{language}</b>."
|
||||
}
|
||||
},
|
||||
"decryptionFailed": "Sorry, I couldn't decrypt your message. You can try to leave this channel and to connect again",
|
||||
"noSufficientRights": "This command is only available to administrators or users who have this role",
|
||||
"tooLongForPublic": "Sorry, this message is too long for a public room - send me a direct message instead"
|
||||
},
|
||||
"move": {
|
||||
"cancel": "Annuleer verplaatsing",
|
||||
"cannotBeMoved": "Dit object kan niet verplaatst worden.",
|
||||
|
|
|
@ -315,6 +315,10 @@ function transformTranslation(obj: any, path: string[] = [], languageWhitelist :
|
|||
if(subParts !== null){
|
||||
// convert '{to_substitute}' into 'to_substitute'
|
||||
const types = Utils.Dedup( subParts.map(tp => tp.substring(1, tp.length - 1)))
|
||||
const invalid = types.filter(part => part.match(/^[a-z0-9A-Z_]+(\(.*\))?$/) == null)
|
||||
if(invalid.length > 0){
|
||||
throw `At ${path.join(".")}: A subpart contains invalid characters: ${subParts.join(', ')}`
|
||||
}
|
||||
expr = `return new TypedTranslation<{ ${types.join(", ")} }>(${JSON.stringify(value)}, "core:${path.join(".")}.${key}")`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue