forked from MapComplete/MapComplete
Fix: load translations for PDF-export internally
This commit is contained in:
parent
451aa3bcd4
commit
d103911d14
2 changed files with 9 additions and 3 deletions
|
@ -8,6 +8,8 @@ rm -rf dist/*
|
||||||
rm -rf .cache
|
rm -rf .cache
|
||||||
mkdir dist 2> /dev/null
|
mkdir dist 2> /dev/null
|
||||||
mkdir dist/assets 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"
|
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/layers/ dist/assets/layers/
|
||||||
cp -r assets/themes/ dist/assets/themes/
|
cp -r assets/themes/ dist/assets/themes/
|
||||||
cp -r assets/svg/ dist/assets/svg/
|
cp -r assets/svg/ dist/assets/svg/
|
||||||
|
cp -r langs/layers/ dist/assets/langs/layers/
|
||||||
export NODE_OPTIONS=""
|
export NODE_OPTIONS=""
|
||||||
|
|
|
@ -566,6 +566,7 @@ class SvgToPdfPage {
|
||||||
images: Record<string, HTMLImageElement> = {}
|
images: Record<string, HTMLImageElement> = {}
|
||||||
rects: Record<string, { rect: SVGRectElement; isInDef: boolean }> = {}
|
rects: Record<string, { rect: SVGRectElement; isInDef: boolean }> = {}
|
||||||
readonly options: SvgToPdfOptions
|
readonly options: SvgToPdfOptions
|
||||||
|
public readonly status: UIEventSource<string>
|
||||||
private readonly importedTranslations: Record<string, string> = {}
|
private readonly importedTranslations: Record<string, string> = {}
|
||||||
private readonly layerTranslations: Record<string, Record<string, any>> = {}
|
private readonly layerTranslations: Record<string, Record<string, any>> = {}
|
||||||
/**
|
/**
|
||||||
|
@ -574,7 +575,6 @@ class SvgToPdfPage {
|
||||||
*/
|
*/
|
||||||
private readonly _state: UIEventSource<string>
|
private readonly _state: UIEventSource<string>
|
||||||
private _isPrepared = false
|
private _isPrepared = false
|
||||||
public readonly status: UIEventSource<string>
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
page: string,
|
page: string,
|
||||||
|
@ -674,7 +674,10 @@ class SvgToPdfPage {
|
||||||
public async PrepareLanguage(language: string) {
|
public async PrepareLanguage(language: string) {
|
||||||
// Always fetch the remote data - it's cached anyway
|
// Always fetch the remote data - it's cached anyway
|
||||||
this.layerTranslations[language] = await Utils.downloadJsonCached(
|
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 +
|
language +
|
||||||
".json",
|
".json",
|
||||||
24 * 60 * 60 * 1000
|
24 * 60 * 60 * 1000
|
||||||
|
@ -995,6 +998,7 @@ export interface PdfTemplateInfo {
|
||||||
orientation: "portrait" | "landscape"
|
orientation: "portrait" | "landscape"
|
||||||
isPublic: boolean
|
isPublic: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SvgToPdf {
|
export class SvgToPdf {
|
||||||
public static readonly templates: Record<
|
public static readonly templates: Record<
|
||||||
"flyer_a4" | "poster_a3" | "poster_a2" | "current_view_a4" | "current_view_a3",
|
"flyer_a4" | "poster_a3" | "poster_a2" | "current_view_a4" | "current_view_a3",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue