From f364a1b9018dddf9fa5377cbf7e251be393ba149 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Wed, 23 Nov 2022 18:07:44 +0100 Subject: [PATCH] html: in-dev for translations --- src/var/lib/tyto/program/html.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py index 41b4202..d698271 100644 --- a/src/var/lib/tyto/program/html.py +++ b/src/var/lib/tyto/program/html.py @@ -16,12 +16,38 @@ #---------------------------------------------------------------------- #********************************************************************** +import re import check, log, domain +trans = [ + [ 'Licence', 'License' ], # 0,1 + [ 'Générateur', 'Generator' ], # 2,3 + ] + +#=======================================# +# Translations terms # +# Only FR (default) and Other (english) # +#---------------------------------------# +def translations(): + global fl # fl = field lang + + # Default FR/fr + if re.match('fr', domain.domain_lang, re.IGNORECASE): fl = 0 + else : fl = 1 + + + +#========================# +# Create FULL HTML5 Page # +# includes wip.html # +#------------------------# def html_main_page(wip_html): # Source DB variables post_db = exec(open(check.curr_post_db).read(),globals()) + # Set some terms from lang domain + translations() + # Metas in HTML page #------------------- scale = 'width=device-width, initial-scale=1.0' @@ -141,7 +167,7 @@ def html_main_page(wip_html): domain.domain_title, domain.domain_mail ) + \ ' \n' + \ - '
  • Copyright: \n' + \ + '
  • %s: \n'%trans[0][fl] + \ ' %s\n'%( domain.domain_license @@ -151,7 +177,7 @@ def html_main_page(wip_html): ' /rss.xml\n'%domain.domain_title + \ '
  • \n' + \ - '
  • Generator: \n' + \ + '
  • %s: \n'%trans[1][fl] + \ ' Tyto - Littérateur\n' + \