]> sipb.mit.edu Git - ikiwiki.git/blob - doc/patchqueue/l10n.mdwn
* Patch from James Westby to add a --sslcookie switch, which forces
[ikiwiki.git] / doc / patchqueue / l10n.mdwn
1 From [[Recai]]:
2 > Here is my initial work on ikiwiki l10n infrastructure (I'm sending it
3 > before finalizing, there may be errors).
4
5 I've revised the patches (tested OK):
6
7 - $config{lang} patch:
8
9     <http://people.debian.org/~roktas/patches/ikiwiki/ikiwiki-lang.diff>
10
11   + Support for CGI::FormBuilder.
12   + Modify Makefile.PL for l10n.
13
14 - l10n infrastructure from Koha project.  (This patch must be applied with
15   '-p1', also, it needs a 'chmod +x l10n/*.pl' after patching.)
16
17   + Leave templates dir untouched, use a temporary translations directory
18     instead.
19   + Fix Makefile (it failed to update templates).
20
21     http://people.debian.org/~roktas/patches/ikiwiki/ikiwiki-l10n.diff
22
23 However...
24
25 > There are two places in IkiWiki, subject to localization: HTML::Template
26
27 Unfortunately this is not correct.  There a few (?) exceptional places, for
28 example button texts in CGI.pm:
29
30     my @buttons=("Save Page", "Preview", "Cancel");
31
32 > fine.  Also a final note, I haven't examined the quality of generated
33 > templates yet.
34
35 Looks like, tmpl_process3 cannot preserve line breaks in template files.
36 For example, it processed the following template:
37
38     Someone[1], possibly you, requested that you be emailed the password for
39 user
40     <TMPL_VAR USER_NAME> on <TMPL_VAR WIKINAME>[2].
41
42     The password is: <TMPL_VAR USER_PASSWORD>
43
44     --
45     ikiwiki
46
47     [1] The user requesting the password was at IP address <TMPL_VAR
48 REMOTE_ADDR>
49     [2] Located at <TMPL_VAR WIKIURL>
50
51 as (in Turkish):
52
53 Birisi[1], ki muhtemelen bu sizsiniz, <TMPL_VAR WIKINAME>[2] üzerindeki
54 <TMPL_VAR USER_NAME> kullanıcısına ait parolanın epostalanması isteğinde
55 bulundu. Parola: <TMPL_VAR USER_PASSWORD> -- ikiwiki [1] Parolayı isteyen
56 kullanıcının ait IP adresi: <TMPL_VAR REMOTE_ADDR>[2] <TMPL_VAR WIKIURL>
57
58 ----
59
60 > Unfortunately this is not correct.  There a few (?) exceptional places, for
61 > example button texts in CGI.pm:
62 >
63 >     my @buttons=("Save Page", "Preview", "Cancel");
64
65 Hmm, I've thought on this issue.  Using Locale::gettext seems to be the
66 natural solution.  But this would need to create another po file and also,
67 ikiwiki would depend another Perl module.  Kinda overkill...
68
69 I have another idea...  What about to create another (flat) template file
70 for this sort of strings?  Something like strings.tmpl with the content:
71
72     Save Page, Preview, Cancel
73
74 or we could categorize these strings in some variables (',' is the
75 delimiter for this code snippet):
76
77     <TMPL_IF NAME="BUTTONS">
78     Save Page, Preview, Cancel
79     </TMPL_IF>
80
81 and then (preferably in a separate wrapper function in CGI.pm):
82
83      my $template=template("strings.tmpl");
84      $template->param("BUTTONS", 1);
85      my @buttons=split(/\s*,\s*/, $template->output);
86
87 You get the idea...  I've tried this method.  All in one po file, kind of
88 ugly, but it _really_ works.
89
90 > > fine.  Also a final note, I haven't examined the quality of generated
91 > > templates yet.
92 >
93 > Looks like, tmpl_process3 cannot preserve line breaks in template files.
94 > For example, it processed the following template:
95
96 This could be easily worked around in tmpl_process3, but I wouldn't like to
97 maintain a separate utility.