diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2017-09-02 11:48:43 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@edx.srv.br> | 2017-09-02 16:58:52 +0200 |
commit | de0193157e3b09f5da4ac1a1f17625cc3bf62c14 (patch) | |
tree | 24c31fc28b06014ac4346e62fd9a72ca7be5575c /help3xsl | |
parent | c23137d31109336ceed3d429aa60c360c62eba25 (diff) |
Add localization to helponline UI
* Add support for localization in helponline UI.
+ translate 4 words
+ prepare for focused google search
* Tweak the index search, open search index for all modules.
Change-Id: Id7ad4fd63fe1f9d1334fb65febdee6f60c24361a
Reviewed-on: https://gerrit.libreoffice.org/41839
Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Diffstat (limited to 'help3xsl')
-rw-r--r-- | help3xsl/help.js | 1 | ||||
-rw-r--r-- | help3xsl/localized.xsl | 74 | ||||
-rw-r--r-- | help3xsl/online_transform.xsl | 40 |
3 files changed, 99 insertions, 16 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js index 1901a96ad0..e576cb54b5 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -10,7 +10,6 @@ // Used to set Apllication in caseinlie=APP function setModule(module){ if (module == null){module="WRITER"} - document.getElementById("bookmark"+module).hidden=false; var itemspan = document.getElementsByTagName("span"); var n = itemspan.length; for (var i = 0; i < n; i++){ diff --git a/help3xsl/localized.xsl b/help3xsl/localized.xsl new file mode 100644 index 0000000000..c5b0a8afc8 --- /dev/null +++ b/help3xsl/localized.xsl @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. +--> +<!-- +Stylesheet map language-dependent parameters and translation +--> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template name="getContents"> + <xsl:param name="lang"/> + <xsl:choose> + <xsl:when test="$lang='en-US'"><xsl:text>Contents</xsl:text></xsl:when> + <xsl:when test="$lang='en-GB'"><xsl:text>Contents</xsl:text></xsl:when> + <xsl:when test="$lang='en-ZA'"><xsl:text>Contents</xsl:text></xsl:when> + <xsl:when test="$lang='pt-BR'"><xsl:text>Conteúdo</xsl:text></xsl:when> + <xsl:when test="$lang='pt'"><xsl:text>Conteúdo</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>Contents</xsl:text></xsl:otherwise> +</xsl:choose> +</xsl:template> + +<xsl:template name="getIndex"> + <xsl:param name="lang"/> + <xsl:choose> + <xsl:when test="$lang='en-US'"><xsl:text>Index</xsl:text></xsl:when> + <xsl:when test="$lang='en-GB'"><xsl:text>Index</xsl:text></xsl:when> + <xsl:when test="$lang='en-ZA'"><xsl:text>Index</xsl:text></xsl:when> + <xsl:when test="$lang='pt-BR'"><xsl:text>Índice</xsl:text></xsl:when> + <xsl:when test="$lang='pt'"><xsl:text>Índice</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>Index</xsl:text></xsl:otherwise> +</xsl:choose> +</xsl:template> + +<xsl:template name="getSearch"> + <xsl:param name="lang"/> + <xsl:choose> + <xsl:when test="$lang='en-US'"><xsl:text>Find</xsl:text></xsl:when> + <xsl:when test="$lang='en-GB'"><xsl:text>Find</xsl:text></xsl:when> + <xsl:when test="$lang='en-ZA'"><xsl:text>Find</xsl:text></xsl:when> + <xsl:when test="$lang='pt-BR'"><xsl:text>Pesquisar</xsl:text></xsl:when> + <xsl:when test="$lang='pt'"><xsl:text>Pesquisar</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>Find</xsl:text></xsl:otherwise> +</xsl:choose> +</xsl:template> + +<xsl:template name="getLanguage"> + <xsl:param name="lang"/> + <xsl:choose> + <xsl:when test="$lang='en-US'"><xsl:text>Language</xsl:text></xsl:when> + <xsl:when test="$lang='en-GB'"><xsl:text>Language</xsl:text></xsl:when> + <xsl:when test="$lang='en-ZA'"><xsl:text>Language</xsl:text></xsl:when> + <xsl:when test="$lang='pt-BR'"><xsl:text>Idioma</xsl:text></xsl:when> + <xsl:when test="$lang='pt'"><xsl:text>Idioma</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>Language</xsl:text></xsl:otherwise> +</xsl:choose> +</xsl:template> +<!-- Token for Google search WIP --> +<xsl:template name="getToken"> + <xsl:param name="lang"/> + <xsl:choose> + <xsl:when test="$lang='en-US'"><xsl:text>123456</xsl:text></xsl:when> + <xsl:when test="$lang='fr'"><xsl:text>123456</xsl:text></xsl:when> + <xsl:when test="$lang='pt-BR'"><xsl:text>123456</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>1234567890</xsl:text></xsl:otherwise> +</xsl:choose> +</xsl:template> + +</xsl:stylesheet> + diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index 857109c39b..22ed9ff28f 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -21,7 +21,7 @@ <xsl:output indent="yes" method="html" doctype-system= "about:legacy-compat"/> - +<xsl:include href="localized.xsl"/> <!-- ############################ # Variables and Parameters # @@ -143,7 +143,7 @@ </a> <xsl:if test="$online"> <input id="langs" name="language-menu" type="checkbox"/> - <label for="langs" role="button">Language ▼</label> + <label for="langs"><xsl:call-template name="getLanguage"><xsl:with-param name="lang" select="$lang"/></xsl:call-template> ▼</label> <ul> <li><a href="{$productversion}/en-US{$htmlpage}">EN-US</a></li> <li><a href="{$productversion}/am{$htmlpage}">AM</a></li> @@ -227,13 +227,13 @@ <div class="accordion"> <div class="acc-panel"> <input id="accordion-1" name="accordion-menu" type="checkbox"/> - <label for="accordion-1">Contents</label> + <label for="accordion-1"><xsl:call-template name="getContents"><xsl:with-param name="lang" select="$lang"/></xsl:call-template></label> <div id="Contents" class="contents-treeview"></div> </div> <xsl:if test="$online"> <div class="acc-panel"> <input id="accordion-2" name="accordion-menu" type="checkbox"/> - <label for="accordion-2">Search</label> + <label for="accordion-2"><xsl:call-template name="getSearch"><xsl:with-param name="lang" select="$lang"/></xsl:call-template></label> <div id="content-2"> <script type="text/javascript"> <![CDATA[ @@ -254,21 +254,30 @@ </xsl:if> <div class="acc-panel"> <input id="accordion-3" name="accordion-menu" type="checkbox"/> - <label for="accordion-3">Index</label> + <label for="accordion-3"><xsl:call-template name="getIndex"><xsl:with-param name="lang" select="$lang"/></xsl:call-template></label> <div id="Index"> <div id="SearchBox"> <p>  🔎  <input id="search-bar" type="text"/></p> </div> <div id="Bookmarks"> - <ul id="bookmarkCALC" hidden="true"></ul> - <ul id="bookmarkCHART" hidden="true"></ul> - <ul id="bookmarkWRITER" hidden="true"></ul> - <ul id="bookmarkDRAW" hidden="true"></ul> - <ul id="bookmarkIMPRESS" hidden="true"></ul> - <ul id="bookmarkMATH" hidden="true"></ul> - <ul id="bookmarkBASE" hidden="true"></ul> + <p>CALC</p> + <ul id="bookmarkCALC"></ul> + <p>CHART</p> + <ul id="bookmarkCHART"></ul> + <p>WRITER</p> + <ul id="bookmarkWRITER"></ul> + <p>DRAW</p> + <ul id="bookmarkDRAW" ></ul> + <p>IMPRESS</p> + <ul id="bookmarkIMPRESS"></ul> + <p>MATH</p> + <ul id="bookmarkMATH"></ul> + <p>BASE</p> + <ul id="bookmarkBASE"></ul> + <p>BASIC</p> + <ul id="bookmarkBASIC"></ul> + <p>GLOBAL</p> <ul id="bookmarkSHARED"></ul> - <ul id="bookmarkBASIC" hidden="true"></ul> </div> </div> </div> @@ -292,14 +301,15 @@ <xsl:when test="$online"> <script type="text/javascript"> <![CDATA[ + var userLang = navigator.language || navigator.userLanguage; var module = getParameterByName("DbPAR"); setModule(module); var system = getParameterByName("System"); setSystem(system); fixURL(module,system); var dbg = getParameterByName("Debug"); - //if (dbg == null){dbg=1} - dbg=1 + if (dbg == null){dbg=1} + //dbg=1 document.getElementById("DEBUG").style.display = (dbg == 0) ? "none":"block"; document.getElementById("bm_module").innerHTML ="Module is: "+module; document.getElementById("bm_system").innerHTML ="System is: "+system; |