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