Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIR-1157 enable i18n transformation as separate step #779

Draft
wants to merge 3 commits into
base: 2021.06.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
MIR.Layout.Theme=flatmir
MCR.LayoutTransformerFactory.Default.Stylesheets=xsl/mir-%MIR.Layout.Theme%-layout.xsl

# Do i18n in a separate step to translate webpages and labels
MCR.LayoutTransformerFactory.Default.Stylesheets=%MCR.LayoutTransformerFactory.Default.Stylesheets%,xsl/i18n-transformation-step.xsl,xsl/xhtml2html.xsl

# Use this to set a bootswatch theme, see http://bootswatch.com/
# default in flatmir is flatly, see http://bootswatch.com/flatly/
MIR.DefaultLayout.CSS=flatly.min
Expand Down
2 changes: 1 addition & 1 deletion mir-layout/src/main/resources/xsl/mir-cosmol-layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<xsl:output method="html" indent="yes" omit-xml-declaration="yes" media-type="text/html"
version="5" />
<xsl:strip-space elements="*" />
<xsl:include href="resource:xsl/mir-cosmol-layout-utils.xsl"/>
<xsl:include href="xslStyle:i18n:resource:xsl/mir-cosmol-layout-utils.xsl" />
<xsl:param name="MIR.DefaultLayout.CSS" />
<xsl:param name="MIR.CustomLayout.CSS" select="''" />
<xsl:param name="MIR.CustomLayout.JS" select="''" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
xmlns:mcrver="xalan://org.mycore.common.MCRCoreVersion"
xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions"
exclude-result-prefixes="i18n mcrver mcrxsl">
xmlns:i18ntr="http://www.mycore.org/i18n"
exclude-result-prefixes="mcrver mcrxsl i18ntr">

<xsl:import href="resource:xsl/layout/mir-common-layout.xsl" />

Expand Down Expand Up @@ -68,7 +68,7 @@
role="search">
<input
name="condQuery"
placeholder="{i18n:translate('mir.navsearch.placeholder')}"
placeholder="|code:mir.navsearch.placeholder|"
class="form-control mr-sm-2 search-query"
id="searchInput"
type="text"
Expand Down
24 changes: 12 additions & 12 deletions mir-layout/src/main/resources/xsl/mir-flatmir-layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
exclude-result-prefixes="xlink i18n">
xmlns:i18ntr="http://www.mycore.org/i18n"
exclude-result-prefixes="xlink i18ntr">

<xsl:output method="html" indent="yes" omit-xml-declaration="yes" media-type="text/html"
version="5" />
<xsl:strip-space elements="*" />
<xsl:include href="resource:xsl/mir-flatmir-layout-utils.xsl"/>
<xsl:include href="mir-flatmir-layout-utils.xsl" />
<xsl:param name="MIR.DefaultLayout.CSS" />
<xsl:param name="MIR.CustomLayout.CSS" select="''" />
<xsl:param name="MIR.CustomLayout.JS" select="''" />
Expand All @@ -20,7 +18,6 @@
<xsl:variable name="PageTitle" select="/*/@title" />

<xsl:template match="/site">
<xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;</xsl:text>
<html lang="{$CurrentLang}" class="no-js">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down Expand Up @@ -53,9 +50,9 @@
<xsl:call-template name="mir.navigation" />
<noscript>
<div class="mir-no-script alert alert-warning text-center" style="border-radius: 0;">
<xsl:value-of select="i18n:translate('mir.noScript.text')" />&#160;
<i18ntr:code>mir.noScript.text</i18ntr:code>&#160;
<a href="http://www.enable-javascript.com/de/" target="_blank">
<xsl:value-of select="i18n:translate('mir.noScript.link')" />
<i18ntr:code>mir.noScript.link</i18ntr:code>
</a>
.
</div>
Expand All @@ -79,7 +76,9 @@
<div class="col-12">
<ul itemprop="breadcrumb" class="breadcrumb">
<li class="breadcrumb-item">
<a class="navtrail" href="{$WebApplicationBaseURL}"><xsl:value-of select="i18n:translate('mir.breadcrumb.home')" /></a>
<a class="navtrail" href="{$WebApplicationBaseURL}">
<i18ntr:code>mir.breadcrumb.home</i18ntr:code>
</a>
</li>
<xsl:copy-of select="breadcrumb/ul[@class='breadcrumb']/*" />
</ul>
Expand Down Expand Up @@ -112,9 +111,9 @@
$( document ).ready(function() {
$('.overtext').tooltip();
$.confirm.options = {
title: "<xsl:value-of select="i18n:translate('mir.confirm.title')" />",
confirmButton: "<xsl:value-of select="i18n:translate('mir.confirm.confirmButton')" />",
cancelButton: "<xsl:value-of select="i18n:translate('mir.confirm.cancelButton')" />",
title: "<i18ntr:code>mir.confirm.title</i18ntr:code>",
confirmButton: "<i18ntr:code>mir.confirm.confirmButton</i18ntr:code>",
cancelButton: "<i18ntr:code>mir.confirm.cancelButton</i18ntr:code>",
post: false,
confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-secondary",
Expand All @@ -134,4 +133,5 @@
<xsl:template match="/*[not(local-name()='site')]">
<xsl:message terminate="yes">This is not a site document, fix your properties.</xsl:message>
</xsl:template>
<xsl:param name="RequestURL" />
</xsl:stylesheet>
22 changes: 10 additions & 12 deletions mir-module/src/main/resources/xsl/layout/mir-common-layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:basket="xalan://org.mycore.frontend.basket.MCRBasketManager" xmlns:mcr="http://www.mycore.org/" xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
xmlns:actionmapping="xalan://org.mycore.wfc.actionmapping.MCRURLRetriever" xmlns:mcrver="xalan://org.mycore.common.MCRCoreVersion"
xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions" xmlns:layoutUtils="xalan:///org.mycore.frontend.MCRLayoutUtilities"
xmlns:exslt="http://exslt.org/common"
exclude-result-prefixes="layoutUtils xlink basket actionmapping mcr mcrver mcrxsl i18n exslt">
xmlns:exslt="http://exslt.org/common" xmlns:i18ntr="http://www.mycore.org/i18n"
exclude-result-prefixes="layoutUtils xlink basket actionmapping mcr mcrver mcrxsl i18n exslt i18ntr">
<xsl:strip-space elements="*" />
<xsl:param name="CurrentLang" select="'de'" />
<xsl:param name="CurrentUser" />
Expand Down Expand Up @@ -46,7 +46,7 @@
<xsl:when test="mcrxsl:isCurrentUserGuestUser()">
<li class="nav-item">
<a id="loginURL" class="nav-link" href="{$loginURL}">
<xsl:value-of select="i18n:translate('component.userlogin.button.login')" />
<i18ntr:code>component.userlogin.button.login</i18ntr:code>
</a>
</li>
</xsl:when>
Expand Down Expand Up @@ -86,7 +86,7 @@
<!-- <label xml:lang="en">German</label> -->
<!-- </language> -->
<li class="nav-item dropdown mir-lang">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" title="{i18n:translate('mir.language.change')}">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" title="|code:mir.language.change|">
<xsl:value-of select="$curLang/language/@xmlCode" />
<span class="caret" />
</a>
Expand Down Expand Up @@ -231,12 +231,8 @@
<xsl:variable name="entryCount" select="count($basket/entry)" />
<xsl:variable name="basketTitle">
<xsl:choose>
<xsl:when test="$entryCount = 0">
<xsl:value-of select="i18n:translate('basket.numEntries.none')" disable-output-escaping="yes" />
</xsl:when>
<xsl:when test="$entryCount = 1">
<xsl:value-of select="i18n:translate('basket.numEntries.one')" disable-output-escaping="yes" />
</xsl:when>
<xsl:when test="$entryCount = 0">|code:basket.numEntries.none|</xsl:when>
<xsl:when test="$entryCount = 1">|code:basket.numEntries.one|</xsl:when>
<xsl:otherwise>
<xsl:value-of select="i18n:translate('basket.numEntries.many',$entryCount)" disable-output-escaping="yes" />
</xsl:otherwise>
Expand All @@ -253,7 +249,7 @@
<ul class="dropdown-menu" role="menu">
<li>
<a href="{$ServletsBaseURL}MCRBasketServlet{$HttpSession}?type={$basket/@type}&amp;action=show" class="dropdown-item">
<xsl:value-of select="i18n:translate('basket.open')" />
<i18ntr:code>basket.open</i18ntr:code>
</a>
</li>
</ul>
Expand Down Expand Up @@ -307,7 +303,9 @@
</xsl:attribute>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span></button>
<span aria-hidden="true"><xsl:value-of select="i18n:translate($XSL.Status.Message)" /></span>
<span aria-hidden="true">
<i18ntr:code><xsl:value-of select="$XSL.Status.Message" /></i18ntr:code>
</span>
</div>
</div>
</div>
Expand Down