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