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