* Allow preprocessor directives to contain python-like triple-quoted
[ikiwiki] / doc / plugins / contrib / linguas.mdwn
1 [[template id=plugin name=linguas author="""Jorda Polo"""]]
2
3 Linguas
4 =======
5
6 Linguas is a plugin for [ikiwiki](http://ikiwiki.kitenet.net/) that
7 allows translations of wiki pages.
8
9 Download: [linguas.pm](http://wiki.ettin.org/files/linguas.pm) (2006-08-21).
10
11 Usage
12 -----
13
14 Translatable pages and translations must have the following format:
15 `pagename.$LANG`, where `$LANG` is a ISO639-1 (two-letter) language code.
16 To enable linguas, add the following line in the source code of the page:
17
18         \[[linguas ]]
19
20 Note that linguas is only required in one of the pages (the original,
21 for instance); the rest of translations will be automatically
22 updated. Additionally, it is also possible to specify the title of
23 the translation:
24
25         \[[linguas title="Translated title"]]
26
27
28 Template
29 --------
30
31 This is the template code that should be added to `templates/page.tmpl`:
32
33         <TMPL_IF NAME="LINGUAS">
34         <div id="linguas">
35         <p class="otherlinguas"><TMPL_VAR NAME="OTHERLINGUAS"></p>
36         <ul>
37         <TMPL_LOOP NAME="LINGUAS">
38         <li><TMPL_VAR NAME=LINK></li>
39         </TMPL_LOOP>
40         </ul>
41         </div>
42         </TMPL_IF>
43
44
45 TODO/Known Problems
46 -------------------
47
48 * The current language list only contains 4 languages (ca, de, en,
49 es), and is "hardcoded" in linguas.pm. Would be interesting to define
50 it in ikiwiki.setup, though some problems were found while trying to do
51 so. (Actually, defining hash-like arguments from the command like works
52 fine, but it fails from ikiwiki.setup.)
53
54   > 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. --[[Joey]]
55
56 * Wiki links to other translated pages require the full page name
57 including the `.$LANG`. It should be possible to link automatically
58 to pages with the same `.$LANG`, but that would probably require some
59 changes in IkiWiki. (I'm not sure though, I still haven't looked at
60 it... any hints?)
61
62   > 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. --[[Joey]]
63
64 Examples
65 --------
66
67 * [Linguas](http://wiki.ettin.org/linguas.en.html). A page with the same
68 content than this one.
69
70 * [Hello in some languages](http://wiki.ettin.org/hello/hello.en.html). The
71 translations were taken from [Hello in many
72 languages](http://www.omniglot.com/language/phrases/hello.htm) and from
73 the [Debian](http://www.debian.org/) website.