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