Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > d8544620e4ac7bee48ddb48c85d55709 > files > 270

ikiwiki-3.20190228-1.mga7.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>linguas (third party plugin)</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../../style.css" type="text/css" />

<link rel="stylesheet" href="../../local.css" type="text/css" />










</head>
<body>

<div class="page">

<div class="pageheader">
<div class="header">
<span>
<span class="parentlinks">

<a href="../../index.html">ikiwiki</a>/ 

<a href="../../plugins.html">plugins</a>/ 

<a href="../contrib.html">contrib</a>/ 

</span>
<span class="title">
linguas (third party plugin)

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p><span class="infobox">
Plugin: linguas<br />
Author: Jordà Polo<br />
Included in ikiwiki: no<br />
Enabled by default: no<br />
Included in <a href="../goodstuff.html">goodstuff</a>: no<br />
Currently enabled: no<br />
</span></p>

<h1>Linguas</h1>

<p>Linguas is a plugin for <a href="http://ikiwiki.info/">ikiwiki</a> that
allows translations of wiki pages.</p>

<p>Download: <a href="http://ettin.org/pub/ikiwiki/linguas.pm">linguas.pm</a> (2006-08-21).</p>

<p>Note that even though it is still available for download, this plugin is no
longer actively maintained. If you are interested in multilingual wiki pages, you
can also take a look at other approaches such as <span class="createlink">l10n</span>, <a href="../po.html">po</a>,
or Lars Wirzenius's
<a href="http://liw.iki.fi/liw/log/2007-05.html#20070528b">Static website, with translations, using IkiWiki</a>.</p>

<h2>Usage</h2>

<p>Translatable pages and translations must have the following format:
<code>pagename.&#036;LANG</code>, where <code>&#036;LANG</code> is a ISO639-1 (two-letter) language code.
To enable linguas, add the following line in the source code of the page:</p>

<pre><code>[[!linguas  ]]
</code></pre>

<p>Note that linguas is only required in one of the pages (the original,
for instance); the rest of translations will be automatically
updated. Additionally, it is also possible to specify the title of
the translation:</p>

<pre><code>[[!linguas  title="Translated title"]]
</code></pre>

<h2>Template</h2>

<p>This is the template code that should be added to <code>templates/page.tmpl</code>:</p>

<pre><code>&lt;TMPL_IF NAME="LINGUAS"&gt;
&lt;div id="linguas"&gt;
&lt;p class="otherlinguas"&gt;&lt;TMPL_VAR NAME="OTHERLINGUAS"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;TMPL_LOOP NAME="LINGUAS"&gt;
&lt;li&gt;&lt;TMPL_VAR NAME=LINK&gt;&lt;/li&gt;
&lt;/TMPL_LOOP&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/TMPL_IF&gt;
</code></pre>

<h2>TODO/Known Problems</h2>

<ul>
<li><p>The current language list only contains 4 languages (ca, de, en,
es), and is "hardcoded" in linguas.pm. Would be interesting to define
it in ikiwiki.setup, though some problems were found while trying to do
so. (Actually, defining hash-like arguments from the command like works
fine, but it fails from ikiwiki.setup.)</p>

<blockquote>
  <p>My guess about this is that it's because of the way Setup/Standard.pm
  untaints the config items from the file. It has code to handle arrays,
  but not hashes or more complex data structures. --<span class="createlink">Joey</span></p>
  
  <blockquote>
    <p>Right. With this simple
    <a href="http://ettin.org/pub/ikiwiki/hash_setup.patch">patch</a> it seems to
    work. However, note that 1) it only allows simple hashes, hashes of
    hashes will not work (I don't think getops can handle complex hashes
    anyway); 2) I don't really know when/why you call
    <code>possibly_foolish_untaint()</code>; and 3) I'm no perl guru ;). --Jordà</p>
    
    <blockquote>
      <p>It's good. Applied..</p>
    </blockquote>
  </blockquote>
</blockquote></li>
<li><p>Wiki links to other translated pages require the full page name
including the <code>.&#036;LANG</code>. It should be possible to link automatically
to pages with the same <code>.&#036;LANG</code>, but that would probably require some
changes in IkiWiki. (I'm not sure though, I still haven't looked at
it... any hints?)</p>

<blockquote>
  <p>Have you considered using the form ll/page? This would let more usual
  linking rules  apply amoung pages without needing to specify the
  language. I'm not sure if you're supporting browser content
  negotiation, or whether that other layout would be harder to support it
  though. --<span class="createlink">Joey</span></p>
  
  <blockquote>
    <p>Actually, I'm happy with the way it works now (and yeah, it is very
    easy to take advantage of content negotiation). I just wanted
    something simple to translatte a single page (or a few pages), not
    the entire wiki. I'm not even sure it is a good idea to have fully
    multilingual wikis, in most cases I would go for a different wiki
    for each language. That said, I think it is an interesting idea, so
    I'll take a look when I have the time. Thanks for your comments.
    --Jordà</p>
  </blockquote>
</blockquote></li>
<li><p>The changes to htmllink in ikiwiki 1.44 broke this plugin.
The following fixes it:</p>

<pre><code>--- linguas.pm.orig     2006-08-23 19:07:04.000000000 +0200
+++ linguas.pm  2007-03-24 01:53:18.000000000 +0100
@@ -100,7 +100,7 @@
                if (exists &#036;linguas{&#036;2} &amp;&amp; defined &#036;linguas{&#036;2}) {
                        &#036;link = &#036;linguas{&#036;2}{'name'};
                }
-               push @links, IkiWiki::htmllink(&#036;page, &#036;destpage, &#036;trans, 0, 0, &#036;link);
+               push @links, IkiWiki::htmllink(&#036;page, &#036;destpage, &#036;trans, noimageinline =&gt; 0, forcesubpage =&gt; 0, linktext =&gt; &#036;link);
        }


<pre><code>    my &amp;#036;otherlinguas = 'Translations:';
</code></pre>

</code></pre></li>
</ul>

</div>







</div>

<div id="footer" class="pagefooter" role="contentinfo">

<div id="pageinfo">











<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> -->
</div>

</div>


<!-- from ikiwiki -->
</div>

</div>

</body>
</html>