1 |
<!DOCTYPE HTML> |
2 |
<html lang=mul> |
3 |
<title lang=ja data-lang-content=title>harusame</title> |
4 |
<link rel=author href="#author"> |
5 |
<link rel=license href="#license"> |
6 |
<link rel=feed href=harusame-commit type="application/atom+xml"> |
7 |
<link rel=stylesheet href="http://suika.fam.cx/www/style/html/xhtml"> |
8 |
|
9 |
<h1 data-lang-container id=title> |
10 |
<span lang=en><i lang=ja>Harusame</i> — Multilingual |
11 |
Web page management tool</span> |
12 |
<span lang=ja>春雨 — 多言語 Web 頁管理ツール</span> |
13 |
</h1> |
14 |
|
15 |
<div class=section id=introduction> |
16 |
<h2 data-lang-container> |
17 |
<span lang=en>What's this?</span> |
18 |
<span lang=ja>これは何?</span> |
19 |
</h2> |
20 |
|
21 |
<p> |
22 |
|
23 |
<span lang=en><b><i lang=ja>Harusame</i></b> extracts a version of the |
24 |
HTML document written in the specified natural language, from a source |
25 |
HTML document that contains paragraphs in multiple natural |
26 |
languages.</span> |
27 |
|
28 |
<p> |
29 |
|
30 |
<span lang=en>The document management of a multilingual Web site where |
31 |
there are multiple versions of a (conceptually same) document is |
32 |
somewhat difficult in general. If the author of an HTML document wants |
33 |
to edit a part of the document, then he or she has to ensure not to |
34 |
forget updating translations at the same time, otherwise documents in |
35 |
different language versions also differ in their content versions.</span> |
36 |
|
37 |
<p> |
38 |
|
39 |
<span lang=en>Using <b><i lang=ja>harusame</i></b>, one can generate |
40 |
versions of an HTML document in different language from one source |
41 |
HTML document that contains paragraphs written in all of those |
42 |
languages, such that authors no longer have to manage different |
43 |
content versions and different language versions in separate |
44 |
files.</span> |
45 |
|
46 |
</div> |
47 |
|
48 |
<div class=section id=news> |
49 |
<h2 data-lang-container> |
50 |
<span lang=en>What's new?</span> |
51 |
<span lang=ja>最新情報</span> |
52 |
</h2> |
53 |
|
54 |
<ul> |
55 |
|
56 |
<li><time>2008-10-21</time>: |
57 |
<span data-lang-container=replace> |
58 |
<span lang=en>The first version is released!</span> |
59 |
<span lang=ja>最初の版を公開しました。</span> |
60 |
</span> |
61 |
|
62 |
</ul> |
63 |
</div> |
64 |
|
65 |
<div class=section id=usage> |
66 |
<h2 data-lang-container> |
67 |
<span lang=en>Usage</span> |
68 |
<span lang=ja>使い方</span> |
69 |
</h2> |
70 |
|
71 |
<ol> |
72 |
|
73 |
<li> |
74 |
|
75 |
<p data-lang-container> |
76 |
|
77 |
<span lang=en>First, prepare a source HTML document |
78 |
<var>html-document.src</var>. The document can be marked up in HTML |
79 |
as usual, except for <a href="#markup-reference">the special markup |
80 |
for <i lang=ja>harusame</i></a> to identify alternative blocks written |
81 |
in various languages.</span> |
82 |
|
83 |
<p data-lang-container> |
84 |
|
85 |
<span lang=en>An input document might look like:</span> |
86 |
|
87 |
<pre class=example lang=mul><code><!DOCTYPE HTML> |
88 |
<html lang=mul> |
89 |
<title>Example Document</title> |
90 |
|
91 |
<h1 <mark>data-lang-container</mark>> |
92 |
<span <mark>lang=en</mark>>Example document</span> |
93 |
<span <mark>lang=ja</mark>>文書の例</span> |
94 |
</h1> |
95 |
|
96 |
<p <mark>data-lang-container</mark>> |
97 |
<span <mark>lang=en</mark>>This is an example of document with multiple languages.</span> |
98 |
<span <mark>lang=ja</mark>>これは複数の言語で記述された文書の例です。</span> |
99 |
</code></pre> |
100 |
|
101 |
<li> |
102 |
|
103 |
<p>Then, invoke the <code>harusame.pl</code> for each language to |
104 |
generate, as: |
105 |
|
106 |
<pre lang=en> |
107 |
$ <kbd>perl harusame.pl --lang en < <var>html-document.src</var> > <var>html-document.en</var></kbd> |
108 |
$ <kbd>perl harusame.pl --lang ja < <var>html-document.src</var> > <var>html-document.ja</var></kbd></pre> |
109 |
|
110 |
<p>For more information on the <code>harusame.pl</code> command-line |
111 |
options, see <a href="bin/harusame.html">its documentation</a>. |
112 |
|
113 |
</ol> |
114 |
|
115 |
</div> |
116 |
|
117 |
<div class=section id=markup-reference> |
118 |
<h2><i lang=ja>Harusame</i> Markup Reference</h2> |
119 |
|
120 |
<p>Special markup for <i lang=ja>harusame</i> processing is |
121 |
represented as <code>data-lang-<var>*</var></code> attributes on HTML |
122 |
elements, as follows: |
123 |
|
124 |
<dl> |
125 |
|
126 |
<dt lang=en><dfn |
127 |
id=attr-data-lang-container><code>data-lang-container</code></dfn> |
128 |
|
129 |
<dd> |
130 |
|
131 |
<p>If this attribute is specified to an HTML element, then it is |
132 |
treated as a container element that contains versions of the content |
133 |
in various languages. |
134 |
|
135 |
<p>An element with this attribute must contain one or more HTML |
136 |
elements. One of them, whose language (<code>lang</code> attribute |
137 |
value) matches with the language specified as <code>--lang</code> |
138 |
command-line option, is <i>selected</i>. If there are more than one |
139 |
such elements, then the first one is <i>selected</i>. If there is no |
140 |
element whose language matches to the <code>--lang</code> option, then |
141 |
the first element (of whatever language) is <i>selected</i>. |
142 |
|
143 |
<p>If the attribute value is <code>replace</code>, then the element |
144 |
itself is replaced by the <i>selected</i> element. Otherwise, the |
145 |
<em>content</em> of the element is replaced by the <i>selected</i> |
146 |
element. |
147 |
|
148 |
<dt lang=en><dfn |
149 |
id=attr-data-lang-content><code>data-lang-content</code></dfn> |
150 |
|
151 |
<p>If this attribute is specified to an HTML element, then its content |
152 |
is replaced by the content of another element. |
153 |
|
154 |
<p>If this attribute is specified, its value must be an ID of another |
155 |
HTML element in the document. |
156 |
|
157 |
<p>A child element of the element addressed by the ID is |
158 |
<i>selected</i> in the similar way to the |
159 |
<code>data-lang-container</code> attribute. Then, the content of the |
160 |
element with the <code>data-lang-content</code> attribute is replaced |
161 |
by the text content (the value of the <code>textContent</code> DOM |
162 |
attribute) of the <i>selected</i> element. |
163 |
|
164 |
<p>If the element addressed by the ID has |
165 |
<code>data-lang-declaration</code> attribute, then the element will be |
166 |
removed from the document at the end of the whole processing. |
167 |
|
168 |
<p>This attribute is useful when an HTML element does not allow to |
169 |
insert elements as its content. For example, the content model of the |
170 |
<code>title</code> element does not allow child elements, so that this |
171 |
attribute can be used to provide translations to the |
172 |
<code>title</code> element content like this: |
173 |
|
174 |
<pre class=example lang=mul> |
175 |
<code><title <mark>data-lang-content="title-content"</mark>>Example</title> |
176 |
|
177 |
<div <mark>id="title-content" data-lang-declaration</mark>> |
178 |
<span lang=en>Example</span> |
179 |
<span lang=ja>例</span> |
180 |
</div> |
181 |
</code></pre> |
182 |
|
183 |
<dt lang=en><dfn |
184 |
id=attr-data-lang-declaration><code>data-lang-declaration</code></dfn> |
185 |
|
186 |
<dd> |
187 |
|
188 |
<p>This attribute indicates that the element declares a set of |
189 |
alternatives in various languages. |
190 |
|
191 |
<p>This attribute must not be used for an element that is not pointed |
192 |
by a <code>data-lang-content</code> attribute in the same document. |
193 |
|
194 |
</dl> |
195 |
|
196 |
</div> |
197 |
|
198 |
<div class=section id=examples> |
199 |
<h2 data-lang-container> |
200 |
<span lang=en>Example</span> |
201 |
<span lang=ja>利用例</span> |
202 |
</h2> |
203 |
|
204 |
<p data-lang-container> |
205 |
|
206 |
<span lang=en>This document is itself prepared using <i |
207 |
lang=ja>harusame</i>. <a href="readme.html.src">See the source |
208 |
document to learn it can be used</a>.</span> |
209 |
|
210 |
<span lang=ja>この文書自体も春雨を使って生成しています。<a |
211 |
href="readme.html.src">春雨の使い方の例として、原始文書をご覧ください |
212 |
</a>。</span> |
213 |
|
214 |
</div> |
215 |
|
216 |
<div class=section id=dependency> |
217 |
<h2>Dependency</h2> |
218 |
|
219 |
<p>This software requires Perl 5.8 or later, as well as <a |
220 |
href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai-core</a> |
221 |
and <a |
222 |
href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a> |
223 |
packages. |
224 |
|
225 |
</div> |
226 |
|
227 |
<div class=section id=download> |
228 |
<h2>Download</h2> |
229 |
|
230 |
<p>This software is available from <a |
231 |
href="http://suika.fam.cx/gate/cvs/webroot/www/harusame/">the CVS |
232 |
repository</a>. |
233 |
|
234 |
<p><a |
235 |
href="http://suika.fam.cx/gate/cvs/webroot/www/harusame/harusame.tar.gz?tarball=1">The |
236 |
tarball for the latest version</a> is also available. |
237 |
|
238 |
<p>There is no installer. Just copy the script file to some |
239 |
directory. |
240 |
|
241 |
</div> |
242 |
|
243 |
<div class="section" id="author"> |
244 |
<h2 data-lang-container> |
245 |
<span lang=en>Author</span> |
246 |
<span lang=ja>著者</span> |
247 |
</h2> |
248 |
|
249 |
<p><a href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>.</p> |
250 |
</div> |
251 |
|
252 |
<div class="section" id="license"> |
253 |
<h2>License</h2> |
254 |
|
255 |
<p>Copyright 2008 <a |
256 |
href="http://suika.fam.cx/~wakaba/who?">Wakaba</a> <code |
257 |
class="mail"><<a href="mailto:w@suika.fam.cx" |
258 |
rel="author">w@suika.fam.cx</a>></code>.</p> |
259 |
|
260 |
<p>This library is free software; you can redistribute it and/or |
261 |
modify it under the same terms as Perl itself.</p> |
262 |
|
263 |
</div> |
264 |
|
265 |
<footer> |
266 |
[<a rel=alternate hreflang=en href=readme.en lang=en>English</a>] |
267 |
[<a rel=alternate hreflang=ja href=readme.ja lang=ja>日本語</a>] |
268 |
</footer> |