Improve translation fallback behaviour
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
a148df8a6d
commit
03c861ffcc
@ -77,13 +77,15 @@ build_xmlstream(){
|
||||
texts_xml="$basedir/global/data/texts/.texts.${lang}.xml"
|
||||
date="$(date +%Y-%m-%d)"
|
||||
time="$(date +%H:%M:%S)"
|
||||
outdated=no
|
||||
|
||||
|
||||
if [ -f "${shortname}.${lang}.xhtml" ]; then
|
||||
act_lang="$lang"
|
||||
[ $(get_version "${shortname}.${olang}.xhtml") -gt $(get_version "${shortname}.${lang}.xhtml") ] && outdated=yes
|
||||
translation_state="up-to-date"
|
||||
[ $(get_version "${shortname}.${olang}.xhtml") -gt $(get_version "${shortname}.${lang}.xhtml") ] && translation_state="outdated"
|
||||
[ $(( $(get_version "${shortname}.${olang}.xhtml") - 3 )) -gt $(get_version "${shortname}.${lang}.xhtml") ] && act_lang="$olang" && translation_state="very-outdated"
|
||||
else
|
||||
act_lang="$olang"
|
||||
translation_state="untranslated"
|
||||
fi
|
||||
|
||||
infile="${shortname}.${act_lang}.xhtml"
|
||||
@ -95,7 +97,7 @@ build_xmlstream(){
|
||||
filename="/${shortname#$basedir/}"
|
||||
dirname="/${dirname#$basedir/}"
|
||||
language="$lang"
|
||||
outdated="$outdated"
|
||||
translation_state="$translation_state"
|
||||
>
|
||||
|
||||
<trlist>
|
||||
|
@ -8,6 +8,11 @@
|
||||
<xsl:element name="main">
|
||||
<xsl:element name="div">
|
||||
<xsl:attribute name="id">content</xsl:attribute>
|
||||
<xsl:if test="/buildinfo/@translation_state='very-outdated' or /buildinfo/@translation_state='untranslated'">
|
||||
<xsl:attribute name="lang">
|
||||
<xsl:value-of select="/buildinfo/@original"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="/buildinfo/document/body/@microformats">
|
||||
<xsl:attribute name="class"><xsl:value-of select="/buildinfo/document/body/@microformats" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</div> -->
|
||||
|
||||
<!-- Outdated note -->
|
||||
<xsl:if test="/buildinfo/@outdated='yes'">
|
||||
<xsl:if test="/buildinfo/@translation_state='outdated'">
|
||||
<xsl:element name="div">
|
||||
<xsl:attribute name="class">alert warning yellow</xsl:attribute>
|
||||
<xsl:element name="a">
|
||||
@ -49,8 +49,25 @@
|
||||
</xsl:element>
|
||||
</xsl:if> <!-- End Outdated note -->
|
||||
|
||||
<!-- So outdated we fellback to english note -->
|
||||
<xsl:if test="/buildinfo/@translation_state='very-outdated'">
|
||||
<xsl:element name="div">
|
||||
<xsl:attribute name="class">alert warning yellow</xsl:attribute>
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="class">close</xsl:attribute>
|
||||
<xsl:attribute name="data-dismiss">alert</xsl:attribute>
|
||||
<xsl:attribute name="href">#</xsl:attribute>
|
||||
<xsl:attribute name="aria-hidden">true</xsl:attribute>
|
||||
×
|
||||
</xsl:element>
|
||||
<xsl:element name="p">
|
||||
<xsl:call-template name="fsfe-gettext"><xsl:with-param name="id" select="'very-outdated'" /></xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:if> <!-- End very outdated note -->
|
||||
|
||||
<!-- Missing translation note -->
|
||||
<xsl:if test="/buildinfo/@language!=/buildinfo/document/@language">
|
||||
<xsl:if test="/buildinfo/@translation_state='untranslated'">
|
||||
<xsl:element name="div">
|
||||
<xsl:attribute name="class">alert warning yellow</xsl:attribute>
|
||||
<xsl:element name="a">
|
||||
|
@ -56,6 +56,11 @@
|
||||
This page has not been translated yet. <a href="/contribute/translators/translators.html">Please help us to
|
||||
translate</a> this and other pages on fsfe.org, so people can read
|
||||
our message in their native language.
|
||||
</text>
|
||||
<text id="very-outdated">
|
||||
The translation for this page is very outdated, so it is using english instead. <a href="/contribute/translators/translators.html">Please help us to
|
||||
translate</a> this and other pages on fsfe.org, so people can read
|
||||
our message in their native language.
|
||||
</text>
|
||||
<text id="under-construction">
|
||||
<strong>Warning: </strong>This page is under construction. Please <strong>do not spread</strong> or attempt translation as its content is subject to change.
|
||||
|
Loading…
Reference in New Issue
Block a user