Show all languages in languagePickers if translation mode is on

This commit is contained in:
Pieter Vander Vennet 2024-05-06 15:18:29 +02:00
parent 91b836bf66
commit a856d8edc9
3 changed files with 19 additions and 11 deletions

View file

@ -94,6 +94,8 @@ import ImportReviewIdentity from "./Reviews/ImportReviewIdentity.svelte"
import LinkedDataLoader from "../Logic/Web/LinkedDataLoader"
import SplitRoadWizard from "./Popup/SplitRoadWizard.svelte"
import DynLink from "./Base/DynLink.svelte"
import Locale from "./i18n/Locale"
import LanguageUtils from "../Utils/LanguageUtils"
class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
@ -397,13 +399,18 @@ export default class SpecialVisualizations {
args: [],
docs: "A component to set the language of the user interface",
constr(state: SpecialVisualizationState): BaseUIElement {
return new SvelteUIElement(LanguagePicker, {
assignTo: state.userRelatedState.language,
availableLanguages: state.layout.language,
preferredLanguages: state.osmConnection.userDetails.map(
(ud) => ud.languages
),
})
return new VariableUiElement(
Locale.showLinkToWeblate.map(showTranslations => {
const languages = showTranslations ? LanguageUtils.usedLanguagesSorted : state.layout.language
return new SvelteUIElement(LanguagePicker, {
assignTo: state.userRelatedState.language,
availableLanguages: languages,
preferredLanguages: state.osmConnection.userDetails.map(
(ud) => ud.languages
),
})
})
)
},
},
{

View file

@ -18,7 +18,7 @@
EyeIcon,
HeartIcon,
MenuIcon,
XCircleIcon,
XCircleIcon
} from "@rgossiaux/svelte-heroicons/solid"
import Tr from "./Base/Tr.svelte"
import CommunityIndexView from "./BigComponents/CommunityIndexView.svelte"
@ -73,6 +73,8 @@
import { BBox } from "../Logic/BBox"
import ReviewsOverview from "./Reviews/ReviewsOverview.svelte"
import ExtraLinkButton from "./BigComponents/ExtraLinkButton.svelte"
import Locale from "./i18n/Locale"
import LanguageUtils from "../Utils/LanguageUtils"
export let state: ThemeViewState
let layout = state.layout
@ -138,7 +140,7 @@
const bottomRight = mlmap.unproject([rect.right, rect.bottom])
const bbox = new BBox([
[topLeft.lng, topLeft.lat],
[bottomRight.lng, bottomRight.lat],
[bottomRight.lng, bottomRight.lat]
])
state.visualFeedbackViewportBounds.setData(bbox)
}

View file

@ -70,8 +70,7 @@ export default class Locale {
}
if (!Utils.runningFromConsole) {
// @ts-ignore
window.setLanguage = function (language: string) {
window["setLanguage"] = function (language: string) {
source.setData(language)
}
}