]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/linguas.mdwn
web commit by TobiOetiker
[ikiwiki.git] / doc / plugins / contrib / linguas.mdwn
1 [[template id=plugin name=linguas author="Jordà Polo"]]
2 [[meta title="linguas (third-party plugin)"]]
3
4 Linguas
5 =======
6
7 Linguas is a plugin for [ikiwiki](http://ikiwiki.kitenet.net/) that
8 allows translations of wiki pages.
9
10 Download: [linguas.pm](http://wiki.ettin.org/files/linguas.pm) (2006-08-21).
11
12 Usage
13 -----
14
15 Translatable pages and translations must have the following format:
16 `pagename.$LANG`, where `$LANG` is a ISO639-1 (two-letter) language code.
17 To enable linguas, add the following line in the source code of the page:
18
19         \[[linguas ]]
20
21 Note that linguas is only required in one of the pages (the original,
22 for instance); the rest of translations will be automatically
23 updated. Additionally, it is also possible to specify the title of
24 the translation:
25
26         \[[linguas title="Translated title"]]
27
28
29 Template
30 --------
31
32 This is the template code that should be added to `templates/page.tmpl`:
33
34         <TMPL_IF NAME="LINGUAS">
35         <div id="linguas">
36         <p class="otherlinguas"><TMPL_VAR NAME="OTHERLINGUAS"></p>
37         <ul>
38         <TMPL_LOOP NAME="LINGUAS">
39         <li><TMPL_VAR NAME=LINK></li>
40         </TMPL_LOOP>
41         </ul>
42         </div>
43         </TMPL_IF>
44
45
46 TODO/Known Problems
47 -------------------
48
49 * The current language list only contains 4 languages (ca, de, en,
50 es), and is "hardcoded" in linguas.pm. Would be interesting to define
51 it in ikiwiki.setup, though some problems were found while trying to do
52 so. (Actually, defining hash-like arguments from the command like works
53 fine, but it fails from ikiwiki.setup.)
54
55   > My guess about this is that it's because of the way Setup/Standard.pm
56   > untaints the config items from the file. It has code to handle arrays,
57   > but not hashes or more complex data structures. --[[Joey]]
58
59   >  > Right. With this simple
60   >  > [patch](http://wiki.ettin.org/files/hash_setup.patch) it seems to
61   >  > work. However, note that 1) it only allows simple hashes, hashes of
62   >  > hashes will not work (I don't think getops can handle complex hashes
63   >  > anyway); 2) I don't really know when/why you call
64   >  > `possibly_foolish_untaint()`; and 3) I'm no perl guru ;). --Jordà
65
66   >  >  > It's good. Applied..
67
68 * Wiki links to other translated pages require the full page name
69 including the `.$LANG`. It should be possible to link automatically
70 to pages with the same `.$LANG`, but that would probably require some
71 changes in IkiWiki. (I'm not sure though, I still haven't looked at
72 it... any hints?)
73
74   > Have you considered using the form ll/page? This would let more usual
75   > linking rules  apply amoung pages without needing to specify the
76   > language. I'm not sure if you're supporting browser content
77   > negotiation, or whether that other layout would be harder to support it
78   > though. --[[Joey]]
79
80   >  > Actually, I'm happy with the way it works now (and yeah, it is very
81   >  > easy to take advantage of content negotiation). I just wanted
82   >  > something simple to translatte a single page (or a few pages), not
83   >  > the entire wiki. I'm not even sure it is a good idea to have fully
84   >  > multilingual wikis, in most cases I would go for a different wiki
85   >  > for each language. That said, I think it is an interesting idea, so
86   >  > I'll take a look when I have the time. Thanks for your comments.
87   >  > --Jordà
88
89 Examples
90 --------
91
92 * [Linguas](http://wiki.ettin.org/linguas.en.html). A page with the same
93 content than this one.
94
95 * [Hello in some languages](http://wiki.ettin.org/hello/hello.en.html). The
96 translations were taken from [Hello in many
97 languages](http://www.omniglot.com/language/phrases/hello.htm) and from
98 the [Debian](http://www.debian.org/) website.