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