From f3fd9289776f84113675ca3fc5a021b56a12296c Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 18 Sep 2017 22:29:17 +0200 Subject: [PATCH] Fix Czech characters in Sahana and SAMBRO PDF exports, closes #8 --- 02-sahana.sh | 12 ++++++++++-- 03-sambro.sh | 12 ++++++++++-- .../eden/modules/templates/default/config.py | 2 ++ .../eden/modules/templates/SAMBRO/config.py | 3 +++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/02-sahana.sh b/02-sahana.sh index 4a14bd8..bbc73d5 100755 --- a/02-sahana.sh +++ b/02-sahana.sh @@ -31,11 +31,19 @@ mkdir -p /srv/sahana/applications/eden/static/cache/chart mkdir -p /srv/sahana/applications/eden/uploads/{gis_cache,images,tracks} export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64) envsubst <${SOURCE_DIR}/sahana/srv/sahana/applications/eden/models/000_config.py >/srv/sahana/applications/eden/models/000_config.py -cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/modules/templates/default/config.py /srv/sahana/applications/eden/modules/templates/default/config.py + +# Copy Czech language file +cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/languages/cs.py /srv/sahana/applications/eden/languages/cs.py + +# Symlink fonts with Czech glyphs +ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf /srv/sahana/applications/eden/static/fonts/DejaVuSerif-Bold.ttf +ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf /srv/sahana/applications/eden/static/fonts/DejaVuSerif.ttf + +# Prepare template export SAHANA_ADMIN_USER=admin@example.com export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/modules/templates/default/config.py /srv/sahana/applications/eden/modules/templates/default/config.py envsubst <${SOURCE_DIR}/sahana/srv/sahana/applications/eden/modules/templates/default/users/masterUsers.csv >/srv/sahana/applications/eden/modules/templates/default/users/masterUsers.csv -cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/languages/cs.py /srv/sahana/applications/eden/languages/cs.py # Create OS user adduser --system --group --home /srv/sahana --shell /bin/false sahana diff --git a/03-sambro.sh b/03-sambro.sh index 686fe76..b51b9fb 100755 --- a/03-sambro.sh +++ b/03-sambro.sh @@ -31,11 +31,19 @@ mkdir -p /srv/sambro/applications/eden/static/cache/chart mkdir -p /srv/sambro/applications/eden/uploads/{gis_cache,images,tracks} export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64) envsubst <${SOURCE_DIR}/sambro/srv/sambro/applications/eden/models/000_config.py >/srv/sambro/applications/eden/models/000_config.py -cp ${SOURCE_DIR}/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py /srv/sambro/applications/eden/modules/templates/SAMBRO/config.py + +# Copy Czech language file +cp ${SOURCE_DIR}/sambro/srv/sambro/applications/eden/languages/cs.py /srv/sambro/applications/eden/languages/cs.py + +# Symlink fonts with Czech glyphs +ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf /srv/sambro/applications/eden/static/fonts/DejaVuSerif-Bold.ttf +ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf /srv/sambro/applications/eden/static/fonts/DejaVuSerif.ttf + +# Prepare template export SAMBRO_ADMIN_USER=admin@example.com export SAMBRO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +cp ${SOURCE_DIR}/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py /srv/sambro/applications/eden/modules/templates/SAMBRO/config.py envsubst <${SOURCE_DIR}/sambro/srv/sambro/applications/eden/modules/templates/default/users/masterUsers.csv >/srv/sambro/applications/eden/modules/templates/default/users/masterUsers.csv -cp ${SOURCE_DIR}/sambro/srv/sambro/applications/eden/languages/cs.py /srv/sambro/applications/eden/languages/cs.py # Create OS user adduser --system --group --home /srv/sambro --shell /bin/false sambro diff --git a/sahana/srv/sahana/applications/eden/modules/templates/default/config.py b/sahana/srv/sahana/applications/eden/modules/templates/default/config.py index cf13ddf..01c4d16 100644 --- a/sahana/srv/sahana/applications/eden/modules/templates/default/config.py +++ b/sahana/srv/sahana/applications/eden/modules/templates/default/config.py @@ -171,6 +171,8 @@ def config(settings): #settings.L10n.translate_org_organisation = True # Uncomment this to Translate Site Names #settings.L10n.translate_org_site = True + # PDF font + settings.L10n.pdf_export_font = ['DejaVuSerif', 'DejaVuSerif-Bold'] # Finance settings settings.fin.currencies = { diff --git a/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py b/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py index 5591d01..ef1cd2f 100644 --- a/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py +++ b/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py @@ -127,6 +127,9 @@ def config(settings): # Time Format settings.L10n.time_format = "%H:%M:%S" + # PDF font + settings.L10n.pdf_export_font = ['DejaVuSerif', 'DejaVuSerif-Bold'] + # ------------------------------------------------------------------------- # Messaging # Parser