From 5d71cba513061feeba816bea154c6cc3069a84e5 Mon Sep 17 00:00:00 2001 From: Frank Steinberg <steinberg@ibr.cs.tu-bs.de> Date: Wed, 9 Oct 2019 19:27:34 +0200 Subject: [PATCH] Improved german labels and translation status in web editor. --- web/bjcp-styleguide.css | 53 ++++++++++++++++++++++++++ web/edit.js | 5 ++- web/save.cgi | 6 +-- xsd/bjcp-styleguide-2015.xsd | 7 +++- xsl/bjcp-2015-styleguide-translate.xsl | 14 +++++++ 5 files changed, 79 insertions(+), 6 deletions(-) diff --git a/web/bjcp-styleguide.css b/web/bjcp-styleguide.css index 3a55e6d..e6ea1cb 100644 --- a/web/bjcp-styleguide.css +++ b/web/bjcp-styleguide.css @@ -92,6 +92,49 @@ styleguide strength-classifications:before { content: "Strength Classifications: "; } +styleguide[lang="de"] overall-impression:before { + content: "Gesamteindruck: "; +} +styleguide aroma:before { + content: "Geruch: "; +} +styleguide appearance:before { + content: "Erscheinungsbild: "; +} +styleguide flavor:before { + content: "Geschmack: "; +} +styleguide mouthfeel:before { + content: "Mundgefühl: "; +} +styleguide comments:before { + content: "Kommentierung: "; +} +styleguide history:before { + content: "Geschichte: "; +} +styleguide characteristic-ingredients:before { + content: "Charakteristische Zutaten: "; +} +styleguide style-comparison:before { + content: "Stilvergleich: "; +} +styleguide entry-instructions:before { + content: "Einreichungshinweise: "; +} +styleguide specs:before { + content: "Technische Daten: "; +} +styleguide commercial-examples:before { + content: "Kommerzielle Beispiele: "; +} +styleguide tags:before { + content: "Tags: "; +} +styleguide strength-classifications:before { + content: "Stärkeklassifikation: "; +} + styleguide overall-impression, styleguide aroma, styleguide appearance, @@ -213,3 +256,13 @@ styleguide nav { styleguide chapter.collapsed nav, styleguide category.collapsed nav, styleguide subcategory.collapsed nav { transform: rotate(-90deg); } + +styleguide *[source="original"] { + background-color: #ffd0d0; +} +styleguide *[source="lang-file"] { + background-color: white; +} +styleguide nav:not([todo="0"]) { + background-color: #ffb0b0; +} diff --git a/web/edit.js b/web/edit.js index 5307b27..dd3cf05 100644 --- a/web/edit.js +++ b/web/edit.js @@ -178,7 +178,10 @@ for (var i = 0; i < l.length; i++) { }); l[i].classList.add("collapsed"); - + + var o = l[i].querySelectorAll('*[source="original"]'); + nav.setAttribute("todo",o.length); + nav.addEventListener("click", function() { this.parentNode.classList.toggle("collapsed"); }); diff --git a/web/save.cgi b/web/save.cgi index 0a6533f..b30cc8e 100755 --- a/web/save.cgi +++ b/web/save.cgi @@ -84,19 +84,19 @@ f.write('<styleguide xmlns="http://heimbrauconvention.de/bjcp-styleguide/2015">\ f.write('<!-- snippet supplied by %s from %s at %s -->\n' % (user, addr, time)) if level == 1: f.write(' <category id="%s">\n' % id) - f.write(' <%s date="%s" author="%s" source="%s">%s</%s>\n' % (elem, time, user, addr, data, elem)) + f.write(' <%s date="%s" author="%s" addr="%s">%s</%s>\n' % (elem, time, user, addr, data, elem)) f.write(' </category>\n') elif level == 2: f.write(' <category id="%s">\n' % id1) f.write(' <subcategory id="%s">\n' % id) - f.write(' <%s date="%s" author="%s" source="%s">%s</%s>\n' % (elem, time, user, addr, data, elem)) + f.write(' <%s date="%s" author="%s" addr="%s">%s</%s>\n' % (elem, time, user, addr, data, elem)) f.write(' </subcategory>\n') f.write(' </category>\n') elif level == 3: f.write(' <category id="%s">\n' % id1) f.write(' <subcategory id="%s">\n' % id2) f.write(' <subcategory id="%s">\n' % id) - f.write(' <%s date="%s" author="%s" source="%s">%s</%s>\n' % (elem, time, user, addr, data, elem)) + f.write(' <%s date="%s" author="%s" addr="%s">%s</%s>\n' % (elem, time, user, addr, data, elem)) f.write(' </subcategory>\n') f.write(' </subcategory>\n') f.write(' </category>\n') diff --git a/xsd/bjcp-styleguide-2015.xsd b/xsd/bjcp-styleguide-2015.xsd index 020cee9..62ee415 100644 --- a/xsd/bjcp-styleguide-2015.xsd +++ b/xsd/bjcp-styleguide-2015.xsd @@ -20,6 +20,7 @@ <xsd:element ref="category"/> </xsd:choice> </xsd:sequence> + <xsd:attribute name="lang" type="xsd:string"/> </xsd:complexType> </xsd:element> @@ -105,9 +106,10 @@ <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="p"/> </xsd:choice> + <xsd:attribute name="source" type="xsd:string"/> <xsd:attribute name="date" type="xsd:string"/> <xsd:attribute name="author" type="xsd:string"/> - <xsd:attribute name="source" type="xsd:string"/> + <xsd:attribute name="addr" type="xsd:string"/> </xsd:complexType> <xsd:element name="tags"> @@ -312,9 +314,10 @@ <xsd:element name="u" type="xsd:string"/> <xsd:element ref="a"/> </xsd:choice> + <xsd:attribute name="source" type="xsd:string"/> <xsd:attribute name="date" type="xsd:string"/> <xsd:attribute name="author" type="xsd:string"/> - <xsd:attribute name="source" type="xsd:string"/> + <xsd:attribute name="addr" type="xsd:string"/> </xsd:complexType> diff --git a/xsl/bjcp-2015-styleguide-translate.xsl b/xsl/bjcp-2015-styleguide-translate.xsl index fa0e907..f5f35ac 100644 --- a/xsl/bjcp-2015-styleguide-translate.xsl +++ b/xsl/bjcp-2015-styleguide-translate.xsl @@ -26,6 +26,18 @@ + <xsl:template match="bjcp:styleguide"> + <xsl:element name="{local-name(.)}"> + <xsl:attribute name="lang"> + <xsl:value-of select="$lang"/> + </xsl:attribute> + <xsl:apply-templates select="@*[local-name(.) != 'lang']"/> + <xsl:apply-templates/> + </xsl:element> + </xsl:template> + + + <xsl:template match="bjcp:chapter"> <xsl:variable name="d"> <xsl:text>../</xsl:text> @@ -151,10 +163,12 @@ <xsl:element name="{local-name(.)}"> <xsl:choose> <xsl:when test="dyn:evaluate($p)"> + <xsl:attribute name="source">lang-file</xsl:attribute> <xsl:apply-templates select="dyn:evaluate($p)/@*"/> <xsl:apply-templates select="dyn:evaluate($p)/bjcp:* | dyn:evaluate($p)/text()"/> </xsl:when> <xsl:otherwise> + <xsl:attribute name="source">original</xsl:attribute> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> -- GitLab