[Libreoffice-commits] help.git: help3xsl/localized.xsl help3xsl/online_transform.xsl

Olivier Hallot olivier.hallot at libreoffice.org
Tue Sep 12 23:59:22 UTC 2017


 help3xsl/localized.xsl        |   12 +++++---
 help3xsl/online_transform.xsl |   59 ++++++++++++++++++------------------------
 2 files changed, 34 insertions(+), 37 deletions(-)

New commits:
commit 42fbc7890755b7f6322be2fc2c7bc934d3c07b1e
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
Date:   Tue Sep 12 14:48:18 2017 -0300

    TDF#97745 Add support custom search in helponline
    
    Added some language support for the helponline global search
    
    Each custom search engine of google has a unique token, which
    configuration is handled by CSE owner.
    
    The CSE attempt to seach in helponline in the page language. If a page
    is already indexed, it shows what it has. If not, pages indexed from the
    *.libreoffice.org domain and wiki.tdf.org are shown.
    
    The CSE prevents display of indexed pages of other suites.
    
    Change-Id: I133e1a7af867c2380ccb1f20c483af63337a58b9
    Reviewed-on: https://gerrit.libreoffice.org/42218
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3xsl/localized.xsl b/help3xsl/localized.xsl
index e44fa016c..999ca2d3e 100644
--- a/help3xsl/localized.xsl
+++ b/help3xsl/localized.xsl
@@ -159,10 +159,14 @@ Stylesheet map language-dependent parameters and translation
 <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:when test="$lang='en-US'"><xsl:text>var cx = '010161382024564278136:stzujqtpnve';</xsl:text></xsl:when>
+        <xsl:when test="$lang='es'"><xsl:text>var cx = '010161382024564278136:cdcn_oz4txg';</xsl:text></xsl:when>
+        <xsl:when test="$lang='fr'"><xsl:text>var cx = '010161382024564278136:mimp7dbi-eq';</xsl:text></xsl:when>
+        <xsl:when test="$lang='it'"><xsl:text>var cx = '010161382024564278136:xdxa9y906g0';</xsl:text></xsl:when>
+        <xsl:when test="$lang='ja'"><xsl:text>var cx = '010161382024564278136:7wxg-zakzmu';</xsl:text></xsl:when>
+        <xsl:when test="$lang='pt'"><xsl:text>var cx = '010161382024564278136:1x2uk8j-rbw';</xsl:text></xsl:when>
+        <xsl:when test="$lang='pt-BR'"><xsl:text>var cx = '010161382024564278136:1x2uk8j-rbw';</xsl:text></xsl:when>
+        <xsl:otherwise><xsl:text>var cx = '010161382024564278136:stzujqtpnve';</xsl:text></xsl:otherwise>
 </xsl:choose>
 </xsl:template>
 
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index eebaced56..f3ddebee4 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -238,8 +238,9 @@
                 <div id="content-2">
                     <script type="text/javascript">
                         <![CDATA[
-                        (function() {
-                        var cx = '010161382024564278136:oejldkqc20o';
+                        (function() {]]>
+                        <xsl:call-template name="getToken"><xsl:with-param name="lang" select="$lang"/></xsl:call-template>
+                        <![CDATA[
                         var gcse = document.createElement('script');
                         gcse.type = 'text/javascript';
                         gcse.async = true;
@@ -611,41 +612,33 @@
 	</xsl:choose>
 </xsl:template>
 
-
 <!-- SECTION -->
 <xsl:template match="section">
-	<a name="{@id}"></a>
-
-		<xsl:choose>
-
-			<xsl:when test="@id='relatedtopics'">
-				<div class="relatedtopics">
-					<!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>-->
-					<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp')"/></xsl:variable>
-					<xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
-					<xsl:variable name="doc" select="document($href)"/>
-                                        <p class="related" itemprop="mentions">
-						<xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
-					</p>
-					<div class="relatedbody" itemprop="mentions">
-						<xsl:apply-templates />
-					</div>
-				</div>
-			</xsl:when>
-
-			<xsl:when test="@id='howtoget'">
-				<xsl:call-template name="insert_howtoget" />
-			</xsl:when>
-
-			<xsl:otherwise>
-						<xsl:apply-templates/>
-			</xsl:otherwise>
-
-		</xsl:choose>
-
+    <a name="{@id}"></a>
+    <xsl:choose>
+        <xsl:when test="@id='relatedtopics'">
+            <div class="relatedtopics">
+                <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>-->
+                <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp')"/></xsl:variable>
+                <xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
+                <xsl:variable name="doc" select="document($href)"/>
+                <p class="related" itemprop="mentions">
+                    <xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
+                </p>
+                <div class="relatedbody" itemprop="mentions">
+                    <xsl:apply-templates />
+                </div>
+            </div>
+        </xsl:when>
+        <xsl:when test="@id='howtoget'">
+            <xsl:call-template name="insert_howtoget" />
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:apply-templates/>
+        </xsl:otherwise>
+    </xsl:choose>
 </xsl:template>
 
-
 <!-- SECTION -->
 <xsl:template match="section" mode="embedded">
 	<a name="{@id}"></a>


More information about the Libreoffice-commits mailing list