diff --git a/scripts/build.sh b/scripts/build.sh index 4a2fe310d9..6649d61cab 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -8,6 +8,8 @@ rm -rf dist/* rm -rf .cache mkdir dist 2> /dev/null mkdir dist/assets 2> /dev/null +mkdir dist/assets/langs 2> /dev/null +mkdir dist/assets/langs/layers 2> /dev/null export NODE_OPTIONS="--max-old-space-size=8192" @@ -52,5 +54,5 @@ vite build $SRC_MAPS cp -r assets/layers/ dist/assets/layers/ cp -r assets/themes/ dist/assets/themes/ cp -r assets/svg/ dist/assets/svg/ - +cp -r langs/layers/ dist/assets/langs/layers/ export NODE_OPTIONS="" diff --git a/src/Utils/svgToPdf.ts b/src/Utils/svgToPdf.ts index 0ae2399921..d591b9f146 100644 --- a/src/Utils/svgToPdf.ts +++ b/src/Utils/svgToPdf.ts @@ -566,6 +566,7 @@ class SvgToPdfPage { images: Record = {} rects: Record = {} readonly options: SvgToPdfOptions + public readonly status: UIEventSource private readonly importedTranslations: Record = {} private readonly layerTranslations: Record> = {} /** @@ -574,7 +575,6 @@ class SvgToPdfPage { */ private readonly _state: UIEventSource private _isPrepared = false - public readonly status: UIEventSource constructor( page: string, @@ -674,7 +674,10 @@ class SvgToPdfPage { public async PrepareLanguage(language: string) { // Always fetch the remote data - it's cached anyway this.layerTranslations[language] = await Utils.downloadJsonCached( - "https://raw.githubusercontent.com/pietervdvn/MapComplete/develop/langs/layers/" + + window.location.protocol + + "//" + + window.location.host + + "/assets/langs/layers/" + language + ".json", 24 * 60 * 60 * 1000 @@ -995,6 +998,7 @@ export interface PdfTemplateInfo { orientation: "portrait" | "landscape" isPublic: boolean } + export class SvgToPdf { public static readonly templates: Record< "flyer_a4" | "poster_a3" | "poster_a2" | "current_view_a4" | "current_view_a3",