Hotkeys: add hotkey to quickly switch translation mode on or off

This commit is contained in:
Pieter Vander Vennet 2024-01-16 22:21:35 +01:00
parent f117ab64e5
commit 9923f849e0
4 changed files with 16 additions and 4 deletions

View file

@ -500,7 +500,8 @@
"selectOsmbasedmap": "Set the background layer to on OpenStreetMap-based map (or disable the background raster layer)", "selectOsmbasedmap": "Set the background layer to on OpenStreetMap-based map (or disable the background raster layer)",
"selectSearch": "Select the search bar to search locations", "selectSearch": "Select the search bar to search locations",
"shakePhone": "Shaking your phone", "shakePhone": "Shaking your phone",
"title": "Hotkeys" "title": "Hotkeys",
"translationMode": "Toggle translation mode on or off"
}, },
"image": { "image": {
"addPicture": "Add picture", "addPicture": "Add picture",

View file

@ -496,7 +496,8 @@ export default class TagRenderingConfig {
for (const leftover of leftovers) { for (const leftover of leftovers) {
applicableMappings.push({ applicableMappings.push({
then: new TypedTranslation<object>( then: new TypedTranslation<object>(
this.render.replace("{" + this.freeform.key + "}", leftover).translations this.render.replace("{" + this.freeform.key + "}", leftover).translations,
this.render.context
), ),
}) })
} }

View file

@ -62,6 +62,7 @@ import FavouritesFeatureSource from "../Logic/FeatureSource/Sources/FavouritesFe
import { ProvidedImage } from "../Logic/ImageProviders/ImageProvider" import { ProvidedImage } from "../Logic/ImageProviders/ImageProvider"
import { GeolocationControlState } from "../UI/BigComponents/GeolocationControl" import { GeolocationControlState } from "../UI/BigComponents/GeolocationControl"
import Zoomcontrol from "../UI/Zoomcontrol" import Zoomcontrol from "../UI/Zoomcontrol"
import Locale from "../UI/i18n/Locale"
/** /**
* *
@ -654,6 +655,16 @@ export default class ThemeViewState implements SpecialVisualizationState {
) )
return true return true
}) })
Hotkeys.RegisterHotkey(
{
shift: "T",
},
Translations.t.hotkeyDocumentation.translationMode,
() => {
Locale.showLinkToWeblate.setData(!Locale.showLinkToWeblate.data)
}
)
} }
/** /**

View file

@ -6,7 +6,6 @@
import type { SpecialVisualizationState } from "../../SpecialVisualization" import type { SpecialVisualizationState } from "../../SpecialVisualization"
import type { Feature } from "geojson" import type { Feature } from "geojson"
import { Store, UIEventSource } from "../../../Logic/UIEventSource" import { Store, UIEventSource } from "../../../Logic/UIEventSource"
import { onDestroy } from "svelte"
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
import { twMerge } from "tailwind-merge" import { twMerge } from "tailwind-merge"
@ -24,7 +23,7 @@
throw "Config is undefined in tagRenderingAnswer" throw "Config is undefined in tagRenderingAnswer"
} }
let trs: Store<{ then: Translation; icon?: string; iconClass?: string }[]> = tags.mapD((tags) => let trs: Store<{ then: Translation; icon?: string; iconClass?: string }[]> = tags.mapD((tags) =>
Utils.NoNull(config?.GetRenderValues(tags)) Utils.NoNull(config?.GetRenderValues(tags)),
) )
</script> </script>